1. Contact us page fixed - Model_View_Contact had not been updated to match new arguments for Model_View_Base.\n 2. Logo border radius increased to hide pencil icon watermark in bottom right hand corner. \n 3. Nav layout structure now dynamic based on user permissions
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
62
app.py
62
app.py
@@ -72,6 +72,7 @@ app.ID_AUTH0_CLIENT = Config.ID_AUTH0_CLIENT
|
|||||||
app.ID_AUTH0_CLIENT_SECRET = Config.ID_AUTH0_CLIENT_SECRET
|
app.ID_AUTH0_CLIENT_SECRET = Config.ID_AUTH0_CLIENT_SECRET
|
||||||
app.DOMAIN_AUTH0 = Config.DOMAIN_AUTH0
|
app.DOMAIN_AUTH0 = Config.DOMAIN_AUTH0
|
||||||
app.ID_TOKEN_USER = Config.ID_TOKEN_USER
|
app.ID_TOKEN_USER = Config.ID_TOKEN_USER
|
||||||
|
app.URL_HOST = Config.URL_HOST
|
||||||
|
|
||||||
app.config.SQLALCHEMY_DATABASE_URI = Config.SQLALCHEMY_DATABASE_URI
|
app.config.SQLALCHEMY_DATABASE_URI = Config.SQLALCHEMY_DATABASE_URI
|
||||||
app.config.SQLALCHEMY_TRACK_MODIFICATIONS = Config.SQLALCHEMY_TRACK_MODIFICATIONS
|
app.config.SQLALCHEMY_TRACK_MODIFICATIONS = Config.SQLALCHEMY_TRACK_MODIFICATIONS
|
||||||
@@ -79,7 +80,7 @@ app.config.ID_AUTH0_CLIENT = Config.ID_AUTH0_CLIENT
|
|||||||
app.config.ID_AUTH0_CLIENT_SECRET = Config.ID_AUTH0_CLIENT_SECRET
|
app.config.ID_AUTH0_CLIENT_SECRET = Config.ID_AUTH0_CLIENT_SECRET
|
||||||
app.config.DOMAIN_AUTH0 = Config.DOMAIN_AUTH0
|
app.config.DOMAIN_AUTH0 = Config.DOMAIN_AUTH0
|
||||||
app.config.ID_TOKEN_USER = Config.ID_TOKEN_USER
|
app.config.ID_TOKEN_USER = Config.ID_TOKEN_USER
|
||||||
|
app.config.URL_HOST = Config.URL_HOST
|
||||||
app.config['SQLALCHEMY_DATABASE_URI'] = Config.SQLALCHEMY_DATABASE_URI
|
app.config['SQLALCHEMY_DATABASE_URI'] = Config.SQLALCHEMY_DATABASE_URI
|
||||||
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = Config.SQLALCHEMY_TRACK_MODIFICATIONS
|
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = Config.SQLALCHEMY_TRACK_MODIFICATIONS
|
||||||
app.config['ID_AUTH0_CLIENT'] = Config.ID_AUTH0_CLIENT
|
app.config['ID_AUTH0_CLIENT'] = Config.ID_AUTH0_CLIENT
|
||||||
@@ -123,7 +124,6 @@ app.config['RECAPTCHA_PRIVATE_KEY'] = Config.RECAPTCHA_PRIVATE_KEY
|
|||||||
# db = SQLAlchemy(app)
|
# db = SQLAlchemy(app)
|
||||||
app.config['SQLALCHEMY_DATABASE_URI'] = Config.SQLALCHEMY_DATABASE_URI
|
app.config['SQLALCHEMY_DATABASE_URI'] = Config.SQLALCHEMY_DATABASE_URI
|
||||||
|
|
||||||
"""
|
|
||||||
oauth = OAuth(app)
|
oauth = OAuth(app)
|
||||||
oauth.register(
|
oauth.register(
|
||||||
"auth0",
|
"auth0",
|
||||||
@@ -131,11 +131,11 @@ oauth.register(
|
|||||||
client_secret = app.ID_AUTH0_CLIENT_SECRET, # =env.get("AUTH0_CLIENT_SECRET"),
|
client_secret = app.ID_AUTH0_CLIENT_SECRET, # =env.get("AUTH0_CLIENT_SECRET"),
|
||||||
client_kwargs={
|
client_kwargs={
|
||||||
"scope": "openid profile email",
|
"scope": "openid profile email",
|
||||||
},
|
}
|
||||||
server_metadata_url=f'https://{app.DOMAIN_AUTH0}/.well-known/openid-configuration'
|
# server_metadata_url=f'https://{app.DOMAIN_AUTH0}/.well-known/openid-configuration'
|
||||||
)
|
)
|
||||||
# session[app.ID_TOKEN_USER] = {'userinfo': {'sub': ''}}
|
# session[app.ID_TOKEN_USER] = {'userinfo': {'sub': ''}}
|
||||||
"""
|
|
||||||
|
|
||||||
db = SQLAlchemy()
|
db = SQLAlchemy()
|
||||||
db.init_app(app)
|
db.init_app(app)
|
||||||
@@ -176,6 +176,7 @@ def application(environ, start_response):
|
|||||||
def home():
|
def home():
|
||||||
try:
|
try:
|
||||||
model = Model_View_Home(app, db)
|
model = Model_View_Home(app, db)
|
||||||
|
print('nips')
|
||||||
html_body = render_template('_page_home.html', model = model)
|
html_body = render_template('_page_home.html', model = model)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
return str(e)
|
return str(e)
|
||||||
@@ -366,6 +367,57 @@ def stock_save():
|
|||||||
return jsonify({'status': 'failure', 'Message': f'Bad data received by controller.\n{e}'})
|
return jsonify({'status': 'failure', 'Message': f'Bad data received by controller.\n{e}'})
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
# User authentication
|
||||||
|
@app.route("/login")
|
||||||
|
def login():
|
||||||
|
try:
|
||||||
|
data = request.json
|
||||||
|
except:
|
||||||
|
data = {}
|
||||||
|
callback_login = F'{Model_View_Base.HASH_CALLBACK_LOGIN}/{data.get(Model_View_Base.KEY_CALLBACK, Model_View_Base.HASH_PAGE_HOME)}'
|
||||||
|
uri_redirect = url_for(callback_login, _external=True)
|
||||||
|
print(f'redirect uri: {uri_redirect}')
|
||||||
|
return oauth.auth0.authorize_redirect(
|
||||||
|
redirect_uri = uri_redirect
|
||||||
|
)
|
||||||
|
|
||||||
|
@app.route("/login_callback/<path:subpath>")
|
||||||
|
def login_callback(subpath):
|
||||||
|
token = oauth.auth0.authorize_access_token()
|
||||||
|
session[app.ID_TOKEN_USER] = token
|
||||||
|
|
||||||
|
# import user id
|
||||||
|
print(f'str(type(token)) = {str(type(token))}')
|
||||||
|
print(f'token = {token}')
|
||||||
|
userinfo = token.get('userinfo')
|
||||||
|
print(f'user info: {userinfo}')
|
||||||
|
# id_user = token.get('sub')
|
||||||
|
id_user = userinfo.get('sub')
|
||||||
|
print(f'user ID: {id_user}')
|
||||||
|
|
||||||
|
# id_user = get_id_user()
|
||||||
|
# add user to database
|
||||||
|
# DataStore_Store(db, userinfo).add_new_user(id_user) # this is part of get basket - should occur on page load
|
||||||
|
|
||||||
|
return redirect(subpath)
|
||||||
|
|
||||||
|
@app.route("/logout")
|
||||||
|
def logout():
|
||||||
|
session.clear()
|
||||||
|
return redirect(
|
||||||
|
"https://" + app.DOMAIN_AUTH0
|
||||||
|
+ "/v2/logout?"
|
||||||
|
+ urlencode(
|
||||||
|
{
|
||||||
|
"returnTo": url_for("home", _external=True),
|
||||||
|
"client_id": app.ID_AUTH0_CLIENT,
|
||||||
|
},
|
||||||
|
quote_via=quote_plus,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
# snore
|
# snore
|
||||||
@app.route('/license', methods=['GET'])
|
@app.route('/license', methods=['GET'])
|
||||||
def license():
|
def license():
|
||||||
|
|||||||
BIN
business_objects/__pycache__/user.cpython-312.pyc
Normal file
BIN
business_objects/__pycache__/user.cpython-312.pyc
Normal file
Binary file not shown.
209
business_objects/user.py
Normal file
209
business_objects/user.py
Normal file
@@ -0,0 +1,209 @@
|
|||||||
|
"""
|
||||||
|
Project: PARTS Website
|
||||||
|
Author: Edward Middleton-Smith
|
||||||
|
Precision And Research Technology Systems Limited
|
||||||
|
|
||||||
|
Technology: Business Objects
|
||||||
|
Feature: User Business Object
|
||||||
|
"""
|
||||||
|
|
||||||
|
# internal
|
||||||
|
import lib.argument_validation as av
|
||||||
|
from lib import data_types
|
||||||
|
from forms import Form_Filters_User
|
||||||
|
from business_objects.product import Product, Product_Permutation, Price
|
||||||
|
from business_objects.variation import Variation
|
||||||
|
from business_objects.image import Image
|
||||||
|
from business_objects.delivery_option import Delivery_Option
|
||||||
|
from business_objects.discount import Discount
|
||||||
|
from business_objects.stock_item import Stock_Item
|
||||||
|
# external
|
||||||
|
from enum import Enum
|
||||||
|
from datetime import datetime, timedelta
|
||||||
|
import locale
|
||||||
|
from flask_sqlalchemy import SQLAlchemy
|
||||||
|
from dataclasses import dataclass
|
||||||
|
from typing import ClassVar
|
||||||
|
|
||||||
|
|
||||||
|
db = SQLAlchemy()
|
||||||
|
|
||||||
|
|
||||||
|
class User(db.Model):
|
||||||
|
id_user = db.Column(db.Integer, primary_key=True)
|
||||||
|
id_user_auth0 = db.Column(db.String(255))
|
||||||
|
firstname = db.Column(db.String(255))
|
||||||
|
surname = db.Column(db.String(255))
|
||||||
|
email = db.Column(db.String(255))
|
||||||
|
is_email_verified = db.Column(db.Boolean)
|
||||||
|
is_super_user = db.Column(db.Boolean)
|
||||||
|
id_currency_default = db.Column(db.Integer)
|
||||||
|
id_region_default = db.Column(db.Integer)
|
||||||
|
is_included_VAT_default = db.Column(db.Boolean)
|
||||||
|
can_admin_store = db.Column(db.Boolean)
|
||||||
|
can_admin_user = db.Column(db.Boolean)
|
||||||
|
|
||||||
|
is_user_logged_in: bool = False
|
||||||
|
|
||||||
|
def make_from_DB_user(query_row):
|
||||||
|
user = User()
|
||||||
|
user.id_user = query_row[0]
|
||||||
|
user.id_user_auth0 = query_row[1]
|
||||||
|
user.firstname = query_row[2]
|
||||||
|
user.surname = query_row[3]
|
||||||
|
user.email = query_row[4]
|
||||||
|
user.is_email_verified = query_row[5]
|
||||||
|
user.is_super_user = query_row[6]
|
||||||
|
user.id_currency_default = query_row[7]
|
||||||
|
user.id_region_default = query_row[8]
|
||||||
|
user.is_included_VAT_default = query_row[9]
|
||||||
|
user.can_admin_store = query_row[10]
|
||||||
|
user.can_admin_user = query_row[11]
|
||||||
|
return user
|
||||||
|
|
||||||
|
def __repr__(self):
|
||||||
|
return f'''
|
||||||
|
id_user: {self.id_user}
|
||||||
|
id_user_auth0: {self.id_user_auth0}
|
||||||
|
firstname: {self.firstname}
|
||||||
|
surname: {self.surname}
|
||||||
|
email: {self.email}
|
||||||
|
is_email_verified: {self.is_email_verified}
|
||||||
|
is_super_user: {self.is_super_user}
|
||||||
|
id_currency_default: {self.id_currency_default}
|
||||||
|
id_region_default: {self.id_region_default}
|
||||||
|
is_included_VAT_default: {self.is_included_VAT_default}
|
||||||
|
can_admin_store: {self.can_admin_store}
|
||||||
|
can_admin_user: {self.can_admin_user}
|
||||||
|
'''
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def get_default():
|
||||||
|
user = User()
|
||||||
|
user.id_user = None
|
||||||
|
return user
|
||||||
|
|
||||||
|
@dataclass
|
||||||
|
class User_Filters():
|
||||||
|
get_all_user: bool
|
||||||
|
get_inactive_user: bool
|
||||||
|
get_first_user_only: bool
|
||||||
|
ids_user: str
|
||||||
|
ids_user_auth0: str
|
||||||
|
|
||||||
|
def to_json(self):
|
||||||
|
return {
|
||||||
|
'a_get_all_user': self.get_all_user,
|
||||||
|
'a_get_inactive_user': self.get_inactive_user,
|
||||||
|
'a_get_first_user_only': self.get_first_user_only,
|
||||||
|
'a_ids_user': self.ids_user,
|
||||||
|
'a_ids_user_auth0': self.ids_user_auth0,
|
||||||
|
}
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def from_form(form):
|
||||||
|
av.val_instance(form, 'form', 'User_Filters.from_form', Form_Filters_User)
|
||||||
|
get_inactive = av.input_bool(form.active_only.data, "active_only", "User_Filters.from_form")
|
||||||
|
id_user = form.id_user.data
|
||||||
|
return User_Filters(
|
||||||
|
get_all_user = (id_user is None),
|
||||||
|
get_inactive_user = get_inactive,
|
||||||
|
get_first_user_only = False,
|
||||||
|
ids_user = id_user,
|
||||||
|
ids_user_auth0 = '',
|
||||||
|
)
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def get_default(datastore_store):
|
||||||
|
user = datastore_store.get_login_user()
|
||||||
|
return User_Filters(
|
||||||
|
get_all_user = False,
|
||||||
|
get_inactive_user = False,
|
||||||
|
get_first_user_only = False,
|
||||||
|
ids_user = user.id_user,
|
||||||
|
ids_user_auth0 = '',
|
||||||
|
)
|
||||||
|
""" User_Eval
|
||||||
|
@dataclass
|
||||||
|
class User_Filters():
|
||||||
|
ids_user: str
|
||||||
|
get_inactive_users: bool
|
||||||
|
ids_permission: str
|
||||||
|
ids_access_level: str
|
||||||
|
ids_product: str
|
||||||
|
|
||||||
|
def to_json(self):
|
||||||
|
return {
|
||||||
|
'a_ids_user': self.ids_user,
|
||||||
|
'a_get_inactive_users': self.get_inactive_users,
|
||||||
|
'a_ids_permission': self.ids_permission,
|
||||||
|
'a_ids_access_level': self.ids_access_level,
|
||||||
|
'a_ids_product': self.ids_product,
|
||||||
|
}
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def from_form(form):
|
||||||
|
av.val_instance(form, 'form', 'User_Filters.from_form', Form_Filters_User)
|
||||||
|
get_inactive = av.input_bool(form.active_only.data, "active_only", "User_Filters.from_form")
|
||||||
|
return User_Filters(
|
||||||
|
ids_user = form.id_user.data,
|
||||||
|
get_inactive_users = get_inactive,
|
||||||
|
ids_permission = form.ids_permission.data,
|
||||||
|
ids_access_level = form.ids_access_level.data,
|
||||||
|
ids_product = form.ids_product.data,
|
||||||
|
)
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def get_default(datastore_store):
|
||||||
|
is_user_logged_in, id_user = datastore_store.get_login_user()
|
||||||
|
return User_Filters(
|
||||||
|
ids_user = id_user,
|
||||||
|
get_inactive_users = False,
|
||||||
|
ids_permission = '',
|
||||||
|
ids_access_level = '',
|
||||||
|
ids_product = '',
|
||||||
|
)
|
||||||
|
"""
|
||||||
|
|
||||||
|
class User_Permission_Evaluation(db.Model):
|
||||||
|
id_evaluation = db.Column(db.Integer, primary_key=True)
|
||||||
|
guid = db.Column(db.String(255))
|
||||||
|
id_user = db.Column(db.Integer)
|
||||||
|
id_permission_required = db.Column(db.Integer)
|
||||||
|
priority_access_level_required = db.Column(db.Integer)
|
||||||
|
id_product = db.Column(db.Integer)
|
||||||
|
is_super_user = db.Column(db.Boolean)
|
||||||
|
priority_access_level_user = db.Column(db.Integer)
|
||||||
|
can_view = db.Column(db.Boolean)
|
||||||
|
can_edit = db.Column(db.Boolean)
|
||||||
|
can_admin = db.Column(db.Boolean)
|
||||||
|
|
||||||
|
def make_from_DB_user_eval(query_row):
|
||||||
|
user_permission_evaluation = User_Permission_Evaluation()
|
||||||
|
user_permission_evaluation.id_evaluation = query_row[0]
|
||||||
|
user_permission_evaluation.guid = query_row[1]
|
||||||
|
user_permission_evaluation.id_user = query_row[2]
|
||||||
|
user_permission_evaluation.id_permission_required = query_row[3]
|
||||||
|
user_permission_evaluation.priority_access_level_required = query_row[4]
|
||||||
|
user_permission_evaluation.id_product = query_row[5]
|
||||||
|
user_permission_evaluation.is_super_user = query_row[6]
|
||||||
|
user_permission_evaluation.priority_access_level_user = query_row[7]
|
||||||
|
user_permission_evaluation.can_view = query_row[8]
|
||||||
|
user_permission_evaluation.can_edit = query_row[9]
|
||||||
|
user_permission_evaluation.can_admin = query_row[10]
|
||||||
|
return user_permission_evaluation
|
||||||
|
|
||||||
|
def __repr__(self):
|
||||||
|
return f'''
|
||||||
|
id_evaluation: {self.id_evaluation}
|
||||||
|
guid: {self.guid}
|
||||||
|
id_user: {self.id_user}
|
||||||
|
id_permission_required: {self.id_permission_required}
|
||||||
|
priority_access_level_required: {self.priority_access_level_required}
|
||||||
|
id_product: {self.id_product}
|
||||||
|
is_super_user: {self.is_super_user}
|
||||||
|
priority_access_level_user: {self.priority_access_level_user}
|
||||||
|
can_view: {self.can_view}
|
||||||
|
can_edit: {self.can_edit}
|
||||||
|
can_admin: {self.can_admin}
|
||||||
|
'''
|
||||||
@@ -59,6 +59,7 @@ class Config:
|
|||||||
# Miscellaneous
|
# Miscellaneous
|
||||||
DEBUG = False
|
DEBUG = False
|
||||||
TESTING = False
|
TESTING = False
|
||||||
|
URL_HOST = os.getenv('URL_HOST')
|
||||||
|
|
||||||
class DevelopmentConfig(Config):
|
class DevelopmentConfig(Config):
|
||||||
DEBUG = True
|
DEBUG = True
|
||||||
|
|||||||
Binary file not shown.
@@ -29,6 +29,7 @@ from business_objects.order import Order
|
|||||||
from business_objects.product import Product, Product_Permutation, Price, Product_Filters # Permutation_Variation_Link
|
from business_objects.product import Product, Product_Permutation, Price, Product_Filters # Permutation_Variation_Link
|
||||||
from business_objects.sql_error import SQL_Error
|
from business_objects.sql_error import SQL_Error
|
||||||
from business_objects.stock_item import Stock_Item, Stock_Item_Filters
|
from business_objects.stock_item import Stock_Item, Stock_Item_Filters
|
||||||
|
from business_objects.user import User, User_Filters, User_Permission_Evaluation
|
||||||
from business_objects.variation import Variation
|
from business_objects.variation import Variation
|
||||||
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!
|
||||||
@@ -115,8 +116,8 @@ class DataStore_Store(BaseModel):
|
|||||||
}
|
}
|
||||||
"""
|
"""
|
||||||
argument_dict = product_filters.to_json()
|
argument_dict = product_filters.to_json()
|
||||||
is_user_logged_in, id_user = self.get_login_user()
|
user = self.get_login_user()
|
||||||
argument_dict['a_id_user'] = 'auth0|6582b95c895d09a70ba10fef' # id_user
|
argument_dict['a_id_user'] = 1 # 'auth0|6582b95c895d09a70ba10fef' # id_user
|
||||||
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 = self.db_procedure_execute('p_shop_get_many_product', argument_dict)
|
result = self.db_procedure_execute('p_shop_get_many_product', argument_dict)
|
||||||
@@ -536,8 +537,8 @@ class DataStore_Store(BaseModel):
|
|||||||
_m = 'DataStore_Store.get_many_stock_item'
|
_m = 'DataStore_Store.get_many_stock_item'
|
||||||
av.val_instance(stock_item_filters, 'stock_item_filters', _m, Stock_Item_Filters)
|
av.val_instance(stock_item_filters, 'stock_item_filters', _m, Stock_Item_Filters)
|
||||||
argument_dict = stock_item_filters.to_json()
|
argument_dict = stock_item_filters.to_json()
|
||||||
is_user_logged_in, id_user = self.get_login_user()
|
user = self.get_login_user()
|
||||||
argument_dict['a_id_user'] = 'auth0|6582b95c895d09a70ba10fef' # id_user
|
argument_dict['a_id_user'] = 1 # 'auth0|6582b95c895d09a70ba10fef' # id_user
|
||||||
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)
|
||||||
@@ -886,13 +887,14 @@ class DataStore_Store(BaseModel):
|
|||||||
return id_currency, id_region_delivery, is_included_VAT
|
return id_currency, id_region_delivery, is_included_VAT
|
||||||
|
|
||||||
def get_login_user(self):
|
def get_login_user(self):
|
||||||
|
user = User.get_default()
|
||||||
try:
|
try:
|
||||||
info_user = self.session[self.app.ID_TOKEN_USER].get('userinfo')
|
info_user = self.session[self.app.ID_TOKEN_USER].get('userinfo')
|
||||||
is_user_logged_in = ('sub' in list(info_user.keys()) and not info_user['sub'] == '' and not str(type(info_user['sub'])) == "<class 'NoneType'?")
|
user.is_logged_in = ('sub' in list(info_user.keys()) and not info_user['sub'] == '' and not str(type(info_user['sub'])) == "<class 'NoneType'?")
|
||||||
id_user = info_user['sub'] if self.is_user_logged_in else None
|
user.id_user = info_user['sub'] if self.is_user_logged_in else None
|
||||||
return is_user_logged_in, id_user
|
|
||||||
except:
|
except:
|
||||||
return False, None
|
pass
|
||||||
|
return user
|
||||||
|
|
||||||
def save_permutations(self, comment, permutations):
|
def save_permutations(self, comment, permutations):
|
||||||
_m = 'DataStore_Store.save_permutations'
|
_m = 'DataStore_Store.save_permutations'
|
||||||
@@ -901,11 +903,11 @@ class DataStore_Store(BaseModel):
|
|||||||
|
|
||||||
guid = Helper_DB_MySQL.create_guid()
|
guid = Helper_DB_MySQL.create_guid()
|
||||||
now = datetime.now()
|
now = datetime.now()
|
||||||
is_user_logged_in, id_user = self.get_login_user()
|
user = self.get_login_user()
|
||||||
for permutation in permutations:
|
for permutation in permutations:
|
||||||
setattr(permutation, 'guid', guid)
|
setattr(permutation, 'guid', guid)
|
||||||
setattr(permutation, 'created_on', now)
|
setattr(permutation, 'created_on', now)
|
||||||
setattr(permutation, 'created_by', id_user)
|
setattr(permutation, 'created_by', user.id_user)
|
||||||
|
|
||||||
cursor = self.db.cursor()
|
cursor = self.db.cursor()
|
||||||
cursor.executemany(
|
cursor.executemany(
|
||||||
@@ -915,10 +917,69 @@ class DataStore_Store(BaseModel):
|
|||||||
self.db.commit()
|
self.db.commit()
|
||||||
|
|
||||||
argument_dict_list = {
|
argument_dict_list = {
|
||||||
'a_id_user': id_user,
|
'a_id_user': user.id_user,
|
||||||
'a_comment': comment,
|
'a_comment': comment,
|
||||||
'a_guid': guid
|
'a_guid': guid
|
||||||
}
|
}
|
||||||
self.db_procedure_execute('p_shop_save_permutation', argument_dict_list)
|
self.db_procedure_execute('p_shop_save_permutation', argument_dict_list)
|
||||||
|
|
||||||
cursor.close()
|
cursor.close()
|
||||||
|
|
||||||
|
def get_many_user(self, user_filters):
|
||||||
|
_m = 'DataStore_Store.get_many_user'
|
||||||
|
# av.val_str(user_filters, 'user_filters', _m)
|
||||||
|
# av.val_list(permutations, 'list_permutations', _m, Product_Permutation, 1)
|
||||||
|
av.val_instance(user_filters, 'user_filters', _m, User_Filters)
|
||||||
|
|
||||||
|
guid = Helper_DB_MySQL.create_guid()
|
||||||
|
# now = datetime.now()
|
||||||
|
# user = self.get_login_user()
|
||||||
|
|
||||||
|
"""
|
||||||
|
argument_dict_list = {
|
||||||
|
'a_id_user': id_user,
|
||||||
|
'a_comment': comment,
|
||||||
|
'a_guid': guid
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
user = self.get_login_user()
|
||||||
|
argument_dict_list = {
|
||||||
|
# 'a_guid': guid
|
||||||
|
'a_id_user': user.id_user
|
||||||
|
, **user_filters.to_json()
|
||||||
|
}
|
||||||
|
# argument_dict_list['a_guid'] = guid
|
||||||
|
result = self.db_procedure_execute('p_get_many_user', argument_dict_list)
|
||||||
|
"""
|
||||||
|
query = text(f"SELECT * FROM Shop_User_Eval_Temp UE_T WHERE UE_T.guid = '{guid}'")
|
||||||
|
result = self.db.session.execute(query)
|
||||||
|
"""
|
||||||
|
cursor = result.cursor
|
||||||
|
result_set = cursor.fetchall()
|
||||||
|
"""
|
||||||
|
user_permission_evals = []
|
||||||
|
for row in result_set:
|
||||||
|
user_permission_eval = User_Permission_Evaluation.make_from_DB_user_eval(row)
|
||||||
|
user_permission_evals.append(user_permission_eval)
|
||||||
|
print(f'user_permission_evals: {user_permission_evals}')
|
||||||
|
"""
|
||||||
|
users = []
|
||||||
|
for row in result_set:
|
||||||
|
print(f'row: {row}')
|
||||||
|
user = User.make_from_DB_user(row)
|
||||||
|
users.append(user)
|
||||||
|
print(f'user: {user}')
|
||||||
|
|
||||||
|
# error_list, cursor = self.get_error_list_from_cursor(cursor)
|
||||||
|
errors = []
|
||||||
|
cursor.nextset()
|
||||||
|
result_set_e = cursor.fetchall()
|
||||||
|
print(f'raw errors: {result_set_e}')
|
||||||
|
if len(result_set_e) > 0:
|
||||||
|
errors = [SQL_Error.make_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.db_cursor_clear(cursor)
|
||||||
|
|
||||||
|
return users, errors
|
||||||
7
forms.py
7
forms.py
@@ -136,4 +136,9 @@ class Form_Filters_Stock_Item(FlaskForm):
|
|||||||
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')
|
||||||
# submit = SubmitField('Submit')
|
# submit = SubmitField('Submit')
|
||||||
|
|
||||||
|
|
||||||
|
class Form_Filters_User(FlaskForm):
|
||||||
|
active_only = BooleanField('Active only?')
|
||||||
|
id_user = SelectField('User ID', validators=[Optional()], choices=[])
|
||||||
Binary file not shown.
@@ -449,6 +449,7 @@ def input_bool(v_input, v_name, method, suppress_errors = False, suppress_consol
|
|||||||
# optional bool suppress_console_outputs
|
# optional bool suppress_console_outputs
|
||||||
# ARGUMENT VALIDATION
|
# ARGUMENT VALIDATION
|
||||||
my_f = 'input_bool'
|
my_f = 'input_bool'
|
||||||
|
if v_input is None: return False
|
||||||
# suppress_errors
|
# suppress_errors
|
||||||
val_bool(suppress_errors, 'suppress_errors', my_f)
|
val_bool(suppress_errors, 'suppress_errors', my_f)
|
||||||
# suppress_console_outputs
|
# suppress_console_outputs
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
@@ -19,7 +19,8 @@ Base data model for views
|
|||||||
# from routes import bp_home
|
# from routes import bp_home
|
||||||
import lib.argument_validation as av
|
import lib.argument_validation as av
|
||||||
from forms import Form_Is_Included_VAT, Form_Delivery_Region, Form_Currency
|
from forms import Form_Is_Included_VAT, Form_Delivery_Region, Form_Currency
|
||||||
|
from datastores.datastore_store import DataStore_Store
|
||||||
|
from business_objects.user import User_Filters
|
||||||
# external
|
# external
|
||||||
from abc import ABC, abstractmethod
|
from abc import ABC, abstractmethod
|
||||||
from flask_sqlalchemy import SQLAlchemy
|
from flask_sqlalchemy import SQLAlchemy
|
||||||
@@ -58,17 +59,20 @@ class Model_View_Base(BaseModel, ABC):
|
|||||||
FLAG_SCROLLABLE: ClassVar[str] = 'scrollable'
|
FLAG_SCROLLABLE: ClassVar[str] = 'scrollable'
|
||||||
FLAG_SUBMITTED: ClassVar[str] = 'submitted'
|
FLAG_SUBMITTED: ClassVar[str] = 'submitted'
|
||||||
# flagIsDatePicker: ClassVar[str] = 'is-date-picker'
|
# flagIsDatePicker: ClassVar[str] = 'is-date-picker'
|
||||||
|
HASH_APPLY_FILTERS_STORE_PRODUCT_PERMUTATION: ClassVar[str] = '/store/permutation_filter'
|
||||||
|
HASH_CALLBACK_LOGIN: ClassVar[str] = '/callback-login'
|
||||||
HASH_PAGE_ACCESSIBILITY_STATEMENT: ClassVar[str] = '/accessibility-statement'
|
HASH_PAGE_ACCESSIBILITY_STATEMENT: ClassVar[str] = '/accessibility-statement'
|
||||||
|
HASH_PAGE_ADMIN: ClassVar[str] = '/admin'
|
||||||
HASH_PAGE_CONTACT: ClassVar[str] = '/contact'
|
HASH_PAGE_CONTACT: ClassVar[str] = '/contact'
|
||||||
HASH_PAGE_ERROR_NO_PERMISSION: ClassVar[str] = '/error'
|
HASH_PAGE_ERROR_NO_PERMISSION: ClassVar[str] = '/error'
|
||||||
HASH_PAGE_HOME: ClassVar[str] = '/'
|
HASH_PAGE_HOME: ClassVar[str] = '/'
|
||||||
HASH_PAGE_LICENSE: ClassVar[str] = '/license'
|
HASH_PAGE_LICENSE: ClassVar[str] = '/license'
|
||||||
HASH_PAGE_SERVICES: ClassVar[str] = '/services'
|
HASH_PAGE_SERVICES: ClassVar[str] = '/services'
|
||||||
HASH_PAGE_STORE_HOME: ClassVar[str] = '/store'
|
HASH_PAGE_STORE_HOME: ClassVar[str] = '/store'
|
||||||
HASH_PAGE_STORE_PRODUCT: ClassVar[str] = '/store/product'
|
HASH_PAGE_STORE_PRODUCTS: ClassVar[str] = '/store/product'
|
||||||
HASH_PAGE_STORE_PRODUCT_PERMUTATION: ClassVar[str] = '/store/permutation'
|
HASH_PAGE_STORE_PRODUCT_PERMUTATIONS: ClassVar[str] = '/store/permutation'
|
||||||
HASH_PAGE_STORE_PRODUCT_PERMUTATION_FILTER: ClassVar[str] = '/store/permutation_filter'
|
HASH_PAGE_STORE_STOCK_ITEMS: ClassVar[str] = '/store/stock_items'
|
||||||
HASH_PAGE_STORE_PRODUCT_PERMUTATION_SAVE: ClassVar[str] = '/store/permutation_save'
|
HASH_SAVE_STORE_PRODUCT_PERMUTATION: ClassVar[str] = '/store/permutation_save'
|
||||||
ID_BUTTON_ADD: ClassVar[str] = 'buttonAdd'
|
ID_BUTTON_ADD: ClassVar[str] = 'buttonAdd'
|
||||||
ID_BUTTON_CANCEL: ClassVar[str] = 'buttonCancel'
|
ID_BUTTON_CANCEL: ClassVar[str] = 'buttonCancel'
|
||||||
ID_BUTTON_HAMBURGER: ClassVar[str] = 'buttonHamburger'
|
ID_BUTTON_HAMBURGER: ClassVar[str] = 'buttonHamburger'
|
||||||
@@ -80,21 +84,24 @@ class Model_View_Base(BaseModel, ABC):
|
|||||||
ID_LABEL_ERROR: ClassVar[str] = 'labelError'
|
ID_LABEL_ERROR: ClassVar[str] = 'labelError'
|
||||||
ID_MODAL_SERVICES: ClassVar[str] = 'modalServices'
|
ID_MODAL_SERVICES: ClassVar[str] = 'modalServices'
|
||||||
ID_MODAL_TECHNOLOGIES: ClassVar[str] = 'modalTechnologies'
|
ID_MODAL_TECHNOLOGIES: ClassVar[str] = 'modalTechnologies'
|
||||||
|
ID_NAV_ADMIN: ClassVar[str] = 'navAdmin'
|
||||||
ID_NAV_CONTACT: ClassVar[str] = 'navContact'
|
ID_NAV_CONTACT: ClassVar[str] = 'navContact'
|
||||||
ID_NAV_HOME: ClassVar[str] = 'navHome'
|
ID_NAV_HOME: ClassVar[str] = 'navHome'
|
||||||
ID_NAV_SERVICES: ClassVar[str] = 'navServices'
|
ID_NAV_SERVICES: ClassVar[str] = 'navServices'
|
||||||
ID_NAV_STORE_HOME: ClassVar[str] = 'navStoreHome'
|
ID_NAV_STORE_HOME: ClassVar[str] = 'navStoreHome'
|
||||||
ID_NAV_STORE_PERMUTATIONS: ClassVar[str] = 'navStorePermutations'
|
ID_NAV_STORE_PERMUTATIONS: ClassVar[str] = 'navStorePermutations'
|
||||||
ID_NAV_STORE_PRODUCT: ClassVar[str] = 'navStoreProduct'
|
ID_NAV_STORE_PRODUCT: ClassVar[str] = 'navStoreProduct'
|
||||||
|
ID_NAV_STORE_STOCK_ITEMS: ClassVar[str] = 'navStoreStockItems'
|
||||||
ID_OVERLAY_CONFIRM: ClassVar[str] = 'overlayConfirm'
|
ID_OVERLAY_CONFIRM: ClassVar[str] = 'overlayConfirm'
|
||||||
ID_OVERLAY_HAMBURGER: ClassVar[str] = 'overlayHamburger'
|
ID_OVERLAY_HAMBURGER: ClassVar[str] = 'overlayHamburger'
|
||||||
ID_PAGE_BODY: ClassVar[str] = 'pageBody'
|
ID_PAGE_BODY: ClassVar[str] = 'pageBody'
|
||||||
ID_TABLE_MAIN: ClassVar[str] = 'tableMain'
|
ID_TABLE_MAIN: ClassVar[str] = 'tableMain'
|
||||||
ID_TEXTAREA_CONFIRM: ClassVar[str] = 'textareaConfirm'
|
ID_TEXTAREA_CONFIRM: ClassVar[str] = 'textareaConfirm'
|
||||||
|
KEY_CALLBACK: ClassVar[str] = 'callback'
|
||||||
KEY_FORM: ClassVar[str] = 'form'
|
KEY_FORM: ClassVar[str] = 'form'
|
||||||
KEY_FORM_FILTERS: ClassVar[str] = KEY_FORM + 'Filters'
|
KEY_FORM_FILTERS: ClassVar[str] = KEY_FORM + 'Filters'
|
||||||
NAME_COMPANY: ClassVar[str] = 'Precision And Research Technology Systems Limited'
|
NAME_COMPANY: ClassVar[str] = 'Precision And Research Technology Systems Limited'
|
||||||
URL_HOST: ClassVar[str] = 'http://127.0.0.1:5000' # 'https://www.partsltd.co.uk'
|
# URL_HOST: ClassVar[str] = os.env() 'http://127.0.0.1:5000' # 'https://www.partsltd.co.uk'
|
||||||
URL_GITHUB: ClassVar[str] = 'https://github.com/Teddy-1024'
|
URL_GITHUB: ClassVar[str] = 'https://github.com/Teddy-1024'
|
||||||
URL_LINKEDIN: ClassVar[str] = 'https://uk.linkedin.com/in/lordteddyms'
|
URL_LINKEDIN: ClassVar[str] = 'https://uk.linkedin.com/in/lordteddyms'
|
||||||
|
|
||||||
@@ -156,6 +163,25 @@ class Model_View_Base(BaseModel, ABC):
|
|||||||
# self.form_delivery_region = Form_Delivery_Region()
|
# self.form_delivery_region = Form_Delivery_Region()
|
||||||
# self.form_currency = Form_Currency()
|
# self.form_currency = Form_Currency()
|
||||||
self.is_page_store = False
|
self.is_page_store = False
|
||||||
|
print(f'session: {self.session}')
|
||||||
|
# self.is_user_logged_in =
|
||||||
|
|
||||||
def output_bool(self, boolean):
|
def output_bool(self, boolean):
|
||||||
return str(boolean).lower()
|
return str(boolean).lower()
|
||||||
|
|
||||||
|
def get_url_host(self):
|
||||||
|
return self.app.config.URL_HOST
|
||||||
|
|
||||||
|
def get_is_admin_store_user(self):
|
||||||
|
datastore_store = DataStore_Store(self.app, self.db)
|
||||||
|
filters_user = User_Filters.get_default(datastore_store)
|
||||||
|
users, errors = datastore_store.get_many_user(filters_user)
|
||||||
|
user = users[0]
|
||||||
|
return av.input_bool(user.can_admin_store, 'can_admin_store', 'Model_View_Base.get_is_admin_store_user')
|
||||||
|
|
||||||
|
def get_is_admin_user_user(self):
|
||||||
|
datastore_store = DataStore_Store(self.app, self.db)
|
||||||
|
filters_user = User_Filters.get_default(datastore_store)
|
||||||
|
users, errors = datastore_store.get_many_user(filters_user)
|
||||||
|
user = users[0]
|
||||||
|
return av.input_bool(user.can_admin_user, 'can_admin_user', 'Model_View_Base.get_is_admin_user_user')
|
||||||
@@ -10,40 +10,28 @@ Description:
|
|||||||
Data model for contact view
|
Data model for contact view
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# IMPORTS
|
|
||||||
# VARIABLE INSTANTIATION
|
|
||||||
# METHODS
|
|
||||||
|
|
||||||
# IMPORTS
|
|
||||||
# internal
|
# internal
|
||||||
from models.model_view_base import Model_View_Base
|
from models.model_view_base import Model_View_Base
|
||||||
# from routes import bp_home
|
# from routes import bp_home
|
||||||
from lib import argument_validation as av
|
from lib import argument_validation as av
|
||||||
|
from forms import Form_Contact
|
||||||
# external
|
# external
|
||||||
from flask_wtf import FlaskForm
|
from flask_wtf import FlaskForm
|
||||||
from abc import abstractproperty
|
from abc import abstractproperty
|
||||||
|
from pydantic import BaseModel
|
||||||
|
|
||||||
# VARIABLE INSTANTIATION
|
|
||||||
|
|
||||||
|
|
||||||
# CLASSES
|
|
||||||
class Model_View_Contact(Model_View_Base):
|
class Model_View_Contact(Model_View_Base):
|
||||||
# Attributes
|
# Attributes
|
||||||
ID_EMAIL: str = 'email'
|
ID_EMAIL: str = 'email'
|
||||||
ID_MESSAGE: str = 'msg'
|
ID_MESSAGE: str = 'msg'
|
||||||
ID_NAME: str = 'name'
|
ID_NAME: str = 'name'
|
||||||
|
|
||||||
|
form_contact: Form_Contact
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def title(self):
|
def title(self):
|
||||||
return 'Contact'
|
return 'Contact'
|
||||||
|
|
||||||
def __new__(cls, db, info_user, app, form):
|
def __init__(self, app, db, form_contact, **kwargs):
|
||||||
# Initialiser - validation
|
super().__init__(app=app, db=db, form_contact=form_contact, **kwargs)
|
||||||
_m = 'Model_View_Contact.__new__'
|
# self.form = form
|
||||||
av.val_instance(form, 'form', _m, FlaskForm)
|
|
||||||
return super(Model_View_Contact, cls).__new__(cls, db, info_user, app)
|
|
||||||
|
|
||||||
def __init__(self, db, info_user, app, form):
|
|
||||||
# Constructor
|
|
||||||
super().__init__(db, info_user, app)
|
|
||||||
self.form = form
|
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ SET MAIL_PASSWORD=
|
|||||||
SET RECAPTCHA_PUBLIC_KEY=
|
SET RECAPTCHA_PUBLIC_KEY=
|
||||||
SET RECAPTCHA_PRIVATE_KEY=
|
SET RECAPTCHA_PRIVATE_KEY=
|
||||||
SET SQLALCHEMY_DATABASE_URI=
|
SET SQLALCHEMY_DATABASE_URI=
|
||||||
|
SET URL_HOST=
|
||||||
"""
|
"""
|
||||||
# SET SQLALCHEMY_DATABASE_URI = mysql://username:password@localhost/dbname
|
# SET SQLALCHEMY_DATABASE_URI = mysql://username:password@localhost/dbname
|
||||||
# Replace 'username', 'password', 'localhost', and 'dbname' with your actual database credentials
|
# Replace 'username', 'password', 'localhost', and 'dbname' with your actual database credentials
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -8,6 +8,6 @@ SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning
|
|||||||
CREATE TABLE Shop_Product_Change_Set (
|
CREATE TABLE Shop_Product_Change_Set (
|
||||||
id_change_set INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
id_change_set INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||||
comment VARCHAR(500),
|
comment VARCHAR(500),
|
||||||
updated_last_on DATETIME,
|
updated_last_on TIMESTAMP,
|
||||||
updated_last_by VARCHAR(100)
|
updated_last_by VARCHAR(100)
|
||||||
);
|
);
|
||||||
@@ -8,6 +8,6 @@ SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning
|
|||||||
CREATE TABLE IF NOT EXISTS Shop_User_Change_Set (
|
CREATE TABLE IF NOT EXISTS Shop_User_Change_Set (
|
||||||
id_change_set INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
id_change_set INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||||
comment VARCHAR(500),
|
comment VARCHAR(500),
|
||||||
updated_last_on DATETIME,
|
updated_last_on TIMESTAMP,
|
||||||
updated_last_by VARCHAR(100)
|
updated_last_by VARCHAR(100)
|
||||||
);
|
);
|
||||||
@@ -8,6 +8,6 @@ SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning
|
|||||||
CREATE TABLE Shop_Sales_And_Purchasing_Change_Set (
|
CREATE TABLE Shop_Sales_And_Purchasing_Change_Set (
|
||||||
id_change_set INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
id_change_set INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||||
comment VARCHAR(500),
|
comment VARCHAR(500),
|
||||||
updated_last_on DATETIME,
|
updated_last_on TIMESTAMP,
|
||||||
updated_last_by VARCHAR(100)
|
updated_last_by VARCHAR(100)
|
||||||
);
|
);
|
||||||
@@ -12,7 +12,7 @@ CREATE TABLE IF NOT EXISTS Shop_Access_Level (
|
|||||||
priority INT NOT NULL,
|
priority INT NOT NULL,
|
||||||
active BIT NOT NULL DEFAULT 1,
|
active BIT NOT NULL DEFAULT 1,
|
||||||
display_order INT NOT NULL,
|
display_order INT NOT NULL,
|
||||||
created_on DATETIME,
|
created_on TIMESTAMP,
|
||||||
created_by VARCHAR(100),
|
created_by VARCHAR(100),
|
||||||
id_change_set INT,
|
id_change_set INT,
|
||||||
CONSTRAINT FK_Shop_Access_Level_id_change_set
|
CONSTRAINT FK_Shop_Access_Level_id_change_set
|
||||||
|
|||||||
@@ -10,8 +10,8 @@ CREATE TABLE IF NOT EXISTS File_Type (
|
|||||||
code VARCHAR(50),
|
code VARCHAR(50),
|
||||||
name VARCHAR(100),
|
name VARCHAR(100),
|
||||||
extension VARCHAR(50),
|
extension VARCHAR(50),
|
||||||
created_on DATETIME,
|
created_on TIMESTAMP,
|
||||||
created_by VARCHAR(100),
|
created_by VARCHAR(100),
|
||||||
updated_last_on DATETIME,
|
updated_last_on TIMESTAMP,
|
||||||
updated_last_by VARCHAR(100)
|
updated_last_by VARCHAR(100)
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -15,8 +15,8 @@ CREATE TABLE IF NOT EXISTS File_Type_Audit (
|
|||||||
name_field VARCHAR(50),
|
name_field VARCHAR(50),
|
||||||
value_prev VARCHAR(500),
|
value_prev VARCHAR(500),
|
||||||
value_new VARCHAR(500),
|
value_new VARCHAR(500),
|
||||||
created_on DATETIME,
|
created_on TIMESTAMP,
|
||||||
created_by VARCHAR(100),
|
created_by VARCHAR(100),
|
||||||
updated_last_on DATETIME,
|
updated_last_on TIMESTAMP,
|
||||||
updated_last_by VARCHAR(100)
|
updated_last_by VARCHAR(100)
|
||||||
);
|
);
|
||||||
@@ -8,7 +8,7 @@ SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning
|
|||||||
CREATE TABLE IF NOT EXISTS Shop_General (
|
CREATE TABLE IF NOT EXISTS Shop_General (
|
||||||
id_general INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
id_general INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||||
quantity_max FLOAT,
|
quantity_max FLOAT,
|
||||||
created_on DATETIME,
|
created_on TIMESTAMP,
|
||||||
created_by VARCHAR(100),
|
created_by VARCHAR(100),
|
||||||
id_change_set INT,
|
id_change_set INT,
|
||||||
CONSTRAINT CHK_Shop_General_id_change_set
|
CONSTRAINT CHK_Shop_General_id_change_set
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ CREATE TABLE IF NOT EXISTS Shop_Image_Type (
|
|||||||
name_plural VARCHAR(256),
|
name_plural VARCHAR(256),
|
||||||
active BIT NOT NULL DEFAULT 1,
|
active BIT NOT NULL DEFAULT 1,
|
||||||
display_order INT NOT NULL,
|
display_order INT NOT NULL,
|
||||||
created_on DATETIME,
|
created_on TIMESTAMP,
|
||||||
created_by VARCHAR(100),
|
created_by VARCHAR(100),
|
||||||
id_change_set INT,
|
id_change_set INT,
|
||||||
CONSTRAINT FK_Shop_Image_Type_id_change_set
|
CONSTRAINT FK_Shop_Image_Type_id_change_set
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ CREATE TABLE IF NOT EXISTS Shop_Region (
|
|||||||
name VARCHAR(200) NOT NULL,
|
name VARCHAR(200) NOT NULL,
|
||||||
active BIT NOT NULL DEFAULT 1,
|
active BIT NOT NULL DEFAULT 1,
|
||||||
display_order INT NOT NULL,
|
display_order INT NOT NULL,
|
||||||
created_on DATETIME,
|
created_on TIMESTAMP,
|
||||||
created_by VARCHAR(100),
|
created_by VARCHAR(100),
|
||||||
id_change_set INT,
|
id_change_set INT,
|
||||||
CONSTRAINT FK_Shop_Region_id_change_set
|
CONSTRAINT FK_Shop_Region_id_change_set
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ CREATE TABLE IF NOT EXISTS Shop_Region_Temp (
|
|||||||
name VARCHAR(200) NOT NULL,
|
name VARCHAR(200) NOT NULL,
|
||||||
active BIT NOT NULL DEFAULT 1,
|
active BIT NOT NULL DEFAULT 1,
|
||||||
display_order INT NOT NULL,
|
display_order INT NOT NULL,
|
||||||
created_on DATETIME,
|
created_on TIMESTAMP,
|
||||||
created_by VARCHAR(100),
|
created_by VARCHAR(100),
|
||||||
id_change_set INT,
|
id_change_set INT,
|
||||||
CONSTRAINT FK_Shop_Region_Temp_id_change_set
|
CONSTRAINT FK_Shop_Region_Temp_id_change_set
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ CREATE TABLE IF NOT EXISTS Shop_Region_Branch (
|
|||||||
-- depth INT NOT NULL,
|
-- depth INT NOT NULL,
|
||||||
active BIT NOT NULL DEFAULT 1,
|
active BIT NOT NULL DEFAULT 1,
|
||||||
display_order INT NOT NULL,
|
display_order INT NOT NULL,
|
||||||
created_on DATETIME,
|
created_on TIMESTAMP,
|
||||||
created_by VARCHAR(100),
|
created_by VARCHAR(100),
|
||||||
id_change_set INT,
|
id_change_set INT,
|
||||||
CONSTRAINT FK_Shop_Region_Branch_id_change_set
|
CONSTRAINT FK_Shop_Region_Branch_id_change_set
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ CREATE TABLE IF NOT EXISTS Shop_Plant (
|
|||||||
id_address INT NOT NULL,
|
id_address INT NOT NULL,
|
||||||
id_user_manager INT NOT NULL,
|
id_user_manager INT NOT NULL,
|
||||||
active BIT NOT NULL DEFAULT 1,
|
active BIT NOT NULL DEFAULT 1,
|
||||||
created_on DATETIME,
|
created_on TIMESTAMP,
|
||||||
created_by VARCHAR(100),
|
created_by VARCHAR(100),
|
||||||
id_change_set INT,
|
id_change_set INT,
|
||||||
CONSTRAINT FK_Shop_Plant_id_change_set
|
CONSTRAINT FK_Shop_Plant_id_change_set
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ CREATE TABLE IF NOT EXISTS Shop_Storage_Location (
|
|||||||
code VARCHAR(50) NOT NULL,
|
code VARCHAR(50) NOT NULL,
|
||||||
name VARCHAR(500) NOT NULL,
|
name VARCHAR(500) NOT NULL,
|
||||||
active BIT NOT NULL DEFAULT 1,
|
active BIT NOT NULL DEFAULT 1,
|
||||||
created_on DATETIME,
|
created_on TIMESTAMP,
|
||||||
created_by VARCHAR(100),
|
created_by VARCHAR(100),
|
||||||
id_change_set INT,
|
id_change_set INT,
|
||||||
CONSTRAINT FK_Shop_Storage_Location_id_change_set
|
CONSTRAINT FK_Shop_Storage_Location_id_change_set
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ CREATE TABLE IF NOT EXISTS Shop_Storage_Location_Branch (
|
|||||||
-- depth INT NOT NULL,
|
-- depth INT NOT NULL,
|
||||||
active BIT NOT NULL DEFAULT 1,
|
active BIT NOT NULL DEFAULT 1,
|
||||||
display_order INT NOT NULL,
|
display_order INT NOT NULL,
|
||||||
created_on DATETIME,
|
created_on TIMESTAMP,
|
||||||
created_by VARCHAR(100),
|
created_by VARCHAR(100),
|
||||||
id_change_set INT,
|
id_change_set INT,
|
||||||
CONSTRAINT FK_Shop_Storage_Location_Branch_id_change_set
|
CONSTRAINT FK_Shop_Storage_Location_Branch_id_change_set
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ CREATE TABLE IF NOT EXISTS Shop_Currency (
|
|||||||
factor_from_GBP FLOAT NOT NULL,
|
factor_from_GBP FLOAT NOT NULL,
|
||||||
active BIT NOT NULL DEFAULT 1,
|
active BIT NOT NULL DEFAULT 1,
|
||||||
display_order INT NOT NULL,
|
display_order INT NOT NULL,
|
||||||
created_on DATETIME,
|
created_on TIMESTAMP,
|
||||||
created_by VARCHAR(100),
|
created_by VARCHAR(100),
|
||||||
id_change_set INT,
|
id_change_set INT,
|
||||||
CONSTRAINT FK_Shop_Currency_id_change_set
|
CONSTRAINT FK_Shop_Currency_id_change_set
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ CREATE TABLE Shop_Tax_Or_Surcharge (
|
|||||||
quantity_max FLOAT NOT NULL,
|
quantity_max FLOAT NOT NULL,
|
||||||
active BIT NOT NULL DEFAULT 1,
|
active BIT NOT NULL DEFAULT 1,
|
||||||
display_order INT NOT NULL,
|
display_order INT NOT NULL,
|
||||||
created_on DATETIME,
|
created_on TIMESTAMP,
|
||||||
created_by VARCHAR(100),
|
created_by VARCHAR(100),
|
||||||
id_change_set INT,
|
id_change_set INT,
|
||||||
CONSTRAINT FK_Shop_Tax_Or_Surcharge_id_change_set
|
CONSTRAINT FK_Shop_Tax_Or_Surcharge_id_change_set
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ CREATE TABLE IF NOT EXISTS Shop_Unit_Measurement (
|
|||||||
is_unit_of_time BIT NOT NULL DEFAULT 0,
|
is_unit_of_time BIT NOT NULL DEFAULT 0,
|
||||||
is_unit_of_volume BIT NOT NULL DEFAULT 0,
|
is_unit_of_volume BIT NOT NULL DEFAULT 0,
|
||||||
active BIT NOT NULL DEFAULT 1,
|
active BIT NOT NULL DEFAULT 1,
|
||||||
created_on DATETIME,
|
created_on TIMESTAMP,
|
||||||
created_by VARCHAR(100),
|
created_by VARCHAR(100),
|
||||||
id_change_set INT,
|
id_change_set INT,
|
||||||
CONSTRAINT FK_Shop_Unit_Measurement_id_change_set
|
CONSTRAINT FK_Shop_Unit_Measurement_id_change_set
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ CREATE TABLE IF NOT EXISTS Shop_Unit_Measurement_Conversion (
|
|||||||
multiplier_unit_base FLOAT NOT NULL,
|
multiplier_unit_base FLOAT NOT NULL,
|
||||||
increment_unit_base FLOAT NOT NULL,
|
increment_unit_base FLOAT NOT NULL,
|
||||||
active BIT NOT NULL DEFAULT 1,
|
active BIT NOT NULL DEFAULT 1,
|
||||||
created_on DATETIME,
|
created_on TIMESTAMP,
|
||||||
created_by VARCHAR(100),
|
created_by VARCHAR(100),
|
||||||
id_change_set INT,
|
id_change_set INT,
|
||||||
CONSTRAINT FK_Shop_Unit_Measurement_Conversion_id_change_set
|
CONSTRAINT FK_Shop_Unit_Measurement_Conversion_id_change_set
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ CREATE TABLE IF NOT EXISTS Shop_Category (
|
|||||||
description VARCHAR(4000),
|
description VARCHAR(4000),
|
||||||
active BIT NOT NULL DEFAULT 1,
|
active BIT NOT NULL DEFAULT 1,
|
||||||
display_order INT NOT NULL,
|
display_order INT NOT NULL,
|
||||||
created_on DATETIME,
|
created_on TIMESTAMP,
|
||||||
created_by VARCHAR(100),
|
created_by VARCHAR(100),
|
||||||
id_change_set INT,
|
id_change_set INT,
|
||||||
CONSTRAINT FK_Shop_Category_id_change_set
|
CONSTRAINT FK_Shop_Category_id_change_set
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ CREATE TABLE IF NOT EXISTS Shop_Product (
|
|||||||
# id_stripe_price VARCHAR(100) NOT NULL,
|
# id_stripe_price VARCHAR(100) NOT NULL,
|
||||||
active BIT NOT NULL DEFAULT 1,
|
active BIT NOT NULL DEFAULT 1,
|
||||||
display_order INT NOT NULL,
|
display_order INT NOT NULL,
|
||||||
created_on DATETIME,
|
created_on TIMESTAMP,
|
||||||
created_by VARCHAR(100),
|
created_by VARCHAR(100),
|
||||||
id_change_set INT,
|
id_change_set INT,
|
||||||
CONSTRAINT FK_Shop_Product_id_change_set
|
CONSTRAINT FK_Shop_Product_id_change_set
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ CREATE TABLE IF NOT EXISTS Shop_Product_Permutation (
|
|||||||
count_interval_expiration_unsealed INT,
|
count_interval_expiration_unsealed INT,
|
||||||
active BIT NOT NULL DEFAULT 1,
|
active BIT NOT NULL DEFAULT 1,
|
||||||
display_order INT NOT NULL,
|
display_order INT NOT NULL,
|
||||||
created_on DATETIME,
|
created_on TIMESTAMP,
|
||||||
created_by VARCHAR(100),
|
created_by VARCHAR(100),
|
||||||
id_change_set INT,
|
id_change_set INT,
|
||||||
CONSTRAINT FK_Shop_Product_Permutation_id_change_set
|
CONSTRAINT FK_Shop_Product_Permutation_id_change_set
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ CREATE TABLE IF NOT EXISTS Shop_Product_Permutation_Temp (
|
|||||||
count_interval_expiration_unsealed INT,
|
count_interval_expiration_unsealed INT,
|
||||||
active BIT NOT NULL DEFAULT 1,
|
active BIT NOT NULL DEFAULT 1,
|
||||||
display_order INT NOT NULL,
|
display_order INT NOT NULL,
|
||||||
created_on DATETIME,
|
created_on TIMESTAMP,
|
||||||
created_by VARCHAR(100),
|
created_by VARCHAR(100),
|
||||||
guid VARCHAR(36)
|
guid BINARY(36)
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ CREATE TABLE IF NOT EXISTS Shop_Variation_Type (
|
|||||||
name_plural VARCHAR(256),
|
name_plural VARCHAR(256),
|
||||||
active BIT NOT NULL DEFAULT 1,
|
active BIT NOT NULL DEFAULT 1,
|
||||||
display_order INT NOT NULL,
|
display_order INT NOT NULL,
|
||||||
created_on DATETIME,
|
created_on TIMESTAMP,
|
||||||
created_by VARCHAR(100),
|
created_by VARCHAR(100),
|
||||||
id_change_set INT,
|
id_change_set INT,
|
||||||
CONSTRAINT FK_Shop_Variation_Type_id_change_set
|
CONSTRAINT FK_Shop_Variation_Type_id_change_set
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ CREATE TABLE Shop_Variation (
|
|||||||
name VARCHAR(255),
|
name VARCHAR(255),
|
||||||
active BIT NOT NULL DEFAULT 1,
|
active BIT NOT NULL DEFAULT 1,
|
||||||
display_order INT NOT NULL,
|
display_order INT NOT NULL,
|
||||||
created_on DATETIME,
|
created_on TIMESTAMP,
|
||||||
created_by VARCHAR(100),
|
created_by VARCHAR(100),
|
||||||
id_change_set INT,
|
id_change_set INT,
|
||||||
CONSTRAINT FK_Shop_Variation_id_change_set
|
CONSTRAINT FK_Shop_Variation_id_change_set
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ CREATE TABLE IF NOT EXISTS Shop_Product_Permutation_Variation_Link (
|
|||||||
ON UPDATE RESTRICT,
|
ON UPDATE RESTRICT,
|
||||||
active BIT NOT NULL DEFAULT 1,
|
active BIT NOT NULL DEFAULT 1,
|
||||||
display_order INT NOT NULL,
|
display_order INT NOT NULL,
|
||||||
created_on DATETIME,
|
created_on TIMESTAMP,
|
||||||
created_by VARCHAR(100),
|
created_by VARCHAR(100),
|
||||||
id_change_set INT,
|
id_change_set INT,
|
||||||
CONSTRAINT FK_Shop_Product_Permutation_Variation_Link_id_change_set
|
CONSTRAINT FK_Shop_Product_Permutation_Variation_Link_id_change_set
|
||||||
|
|||||||
@@ -11,8 +11,8 @@ CREATE TABLE IF NOT EXISTS Shop_Stock_Item (
|
|||||||
CONSTRAINT FK_Shop_Stock_Item_id_permutation
|
CONSTRAINT FK_Shop_Stock_Item_id_permutation
|
||||||
FOREIGN KEY (id_permutation)
|
FOREIGN KEY (id_permutation)
|
||||||
REFERENCES Shop_Product_Permutation(id_permutation),
|
REFERENCES Shop_Product_Permutation(id_permutation),
|
||||||
date_purchased DATETIME NOT NULL,
|
date_purchased TIMESTAMP NOT NULL,
|
||||||
date_received DATETIME NULL,
|
date_received TIMESTAMP NULL,
|
||||||
id_location_storage INT NOT NULL,
|
id_location_storage INT NOT NULL,
|
||||||
CONSTRAINT FK_Shop_Stock_Item_id_location_storage
|
CONSTRAINT FK_Shop_Stock_Item_id_location_storage
|
||||||
FOREIGN KEY (id_location_storage)
|
FOREIGN KEY (id_location_storage)
|
||||||
@@ -24,12 +24,12 @@ CREATE TABLE IF NOT EXISTS Shop_Stock_Item (
|
|||||||
cost_local_VAT_incl FLOAT NOT NULL,
|
cost_local_VAT_incl FLOAT NOT NULL,
|
||||||
cost_local_VAT_excl FLOAT NOT NULL,
|
cost_local_VAT_excl FLOAT NOT NULL,
|
||||||
is_sealed BIT NOT NULL DEFAULT 1,
|
is_sealed BIT NOT NULL DEFAULT 1,
|
||||||
date_unsealed DATETIME NULL,
|
date_unsealed TIMESTAMP NULL,
|
||||||
date_expiration DATETIME NOT NULL,
|
date_expiration TIMESTAMP NOT NULL,
|
||||||
is_consumed BIT NOT NULL DEFAULT 0,
|
is_consumed BIT NOT NULL DEFAULT 0,
|
||||||
date_consumed DATETIME NULL,
|
date_consumed TIMESTAMP NULL,
|
||||||
active BIT NOT NULL DEFAULT 1,
|
active BIT NOT NULL DEFAULT 1,
|
||||||
created_on DATETIME,
|
created_on TIMESTAMP,
|
||||||
created_by VARCHAR(100),
|
created_by VARCHAR(100),
|
||||||
id_change_set INT,
|
id_change_set INT,
|
||||||
CONSTRAINT FK_Shop_Stock_Item_id_change_set
|
CONSTRAINT FK_Shop_Stock_Item_id_change_set
|
||||||
|
|||||||
@@ -8,15 +8,15 @@ SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning
|
|||||||
CREATE TABLE IF NOT EXISTS Shop_Stock_Item_Temp (
|
CREATE TABLE IF NOT EXISTS Shop_Stock_Item_Temp (
|
||||||
id_stock INT NOT NULL PRIMARY KEY,
|
id_stock INT NOT NULL PRIMARY KEY,
|
||||||
id_permutation INT NOT NULL,
|
id_permutation INT NOT NULL,
|
||||||
date_purchased DATETIME NOT NULL,
|
date_purchased TIMESTAMP NOT NULL,
|
||||||
id_location_storage INT NOT NULL,
|
id_location_storage INT NOT NULL,
|
||||||
id_currency INT NOT NULL,
|
id_currency INT NOT NULL,
|
||||||
cost_local_VAT_incl FLOAT NOT NULL,
|
cost_local_VAT_incl FLOAT NOT NULL,
|
||||||
cost_local_VAT_excl FLOAT NOT NULL,
|
cost_local_VAT_excl FLOAT NOT NULL,
|
||||||
is_sealed BIT NOT NULL DEFAULT 1,
|
is_sealed BIT NOT NULL DEFAULT 1,
|
||||||
date_unsealed DATETIME NULL,
|
date_unsealed TIMESTAMP NULL,
|
||||||
date_expiration DATETIME NULL,
|
date_expiration TIMESTAMP NULL,
|
||||||
is_consumed BIT NOT NULL DEFAULT 0,
|
is_consumed BIT NOT NULL DEFAULT 0,
|
||||||
date_consumed DATETIME NULL,
|
date_consumed TIMESTAMP NULL,
|
||||||
active BIT NOT NULL DEFAULT 1
|
active BIT NOT NULL DEFAULT 1
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ CREATE TABLE IF NOT EXISTS Shop_Product_Price (
|
|||||||
price_local_VAT_excl FLOAT NULL,
|
price_local_VAT_excl FLOAT NULL,
|
||||||
id_stripe_price VARCHAR(200),
|
id_stripe_price VARCHAR(200),
|
||||||
active BIT NOT NULL DEFAULT 1,
|
active BIT NOT NULL DEFAULT 1,
|
||||||
created_on DATETIME,
|
created_on TIMESTAMP,
|
||||||
created_by VARCHAR(100),
|
created_by VARCHAR(100),
|
||||||
id_change_set INT,
|
id_change_set INT,
|
||||||
CONSTRAINT FK_Shop_Product_Price_id_change_set
|
CONSTRAINT FK_Shop_Product_Price_id_change_set
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ CREATE TABLE IF NOT EXISTS Shop_Product_Image (
|
|||||||
url VARCHAR(255),
|
url VARCHAR(255),
|
||||||
active BIT NOT NULL DEFAULT 1,
|
active BIT NOT NULL DEFAULT 1,
|
||||||
display_order INT NOT NULL,
|
display_order INT NOT NULL,
|
||||||
created_on DATETIME,
|
created_on TIMESTAMP,
|
||||||
created_by VARCHAR(100),
|
created_by VARCHAR(100),
|
||||||
id_change_set INT,
|
id_change_set INT,
|
||||||
CONSTRAINT FK_Shop_Product_Image_id_change_set
|
CONSTRAINT FK_Shop_Product_Image_id_change_set
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ CREATE TABLE IF NOT EXISTS Shop_Delivery_Option (
|
|||||||
quantity_max INT NOT NULL,
|
quantity_max INT NOT NULL,
|
||||||
active BIT NOT NULL DEFAULT 1,
|
active BIT NOT NULL DEFAULT 1,
|
||||||
display_order INT NOT NULL,
|
display_order INT NOT NULL,
|
||||||
created_on DATETIME,
|
created_on TIMESTAMP,
|
||||||
created_by VARCHAR(100),
|
created_by VARCHAR(100),
|
||||||
id_change_set INT,
|
id_change_set INT,
|
||||||
CONSTRAINT FK_Shop_Delivery_Option_Type_id_change_set
|
CONSTRAINT FK_Shop_Delivery_Option_Type_id_change_set
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ CREATE TABLE IF NOT EXISTS Shop_Product_Delivery_Option_Link (
|
|||||||
price_local FLOAT NOT NULL,
|
price_local FLOAT NOT NULL,
|
||||||
active BIT NOT NULL DEFAULT 1,
|
active BIT NOT NULL DEFAULT 1,
|
||||||
display_order INT NOT NULL,
|
display_order INT NOT NULL,
|
||||||
created_on DATETIME,
|
created_on TIMESTAMP,
|
||||||
created_by VARCHAR(100),
|
created_by VARCHAR(100),
|
||||||
id_change_set INT,
|
id_change_set INT,
|
||||||
CONSTRAINT FK_Shop_Product_Delivery_Option_Link_id_change_set
|
CONSTRAINT FK_Shop_Product_Delivery_Option_Link_id_change_set
|
||||||
|
|||||||
@@ -35,11 +35,11 @@ CREATE TABLE Shop_Discount (
|
|||||||
apply_multiplier_first BIT DEFAULT 1,
|
apply_multiplier_first BIT DEFAULT 1,
|
||||||
quantity_min FLOAT NOT NULL DEFAULT 0,
|
quantity_min FLOAT NOT NULL DEFAULT 0,
|
||||||
quantity_max FLOAT NOT NULL,
|
quantity_max FLOAT NOT NULL,
|
||||||
date_start DATETIME NOT NULL,
|
date_start TIMESTAMP NOT NULL,
|
||||||
date_end DATETIME NOT NULL,
|
date_end TIMESTAMP NOT NULL,
|
||||||
active BIT NOT NULL DEFAULT 1,
|
active BIT NOT NULL DEFAULT 1,
|
||||||
display_order INT NOT NULL,
|
display_order INT NOT NULL,
|
||||||
created_on DATETIME,
|
created_on TIMESTAMP,
|
||||||
created_by VARCHAR(100),
|
created_by VARCHAR(100),
|
||||||
id_change_set INT,
|
id_change_set INT,
|
||||||
CONSTRAINT FK_Shop_Discount_id_change_set
|
CONSTRAINT FK_Shop_Discount_id_change_set
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ CREATE TABLE IF NOT EXISTS Shop_Discount_Region_Currency_Link (
|
|||||||
REFERENCES Shop_Currency(id_currency)
|
REFERENCES Shop_Currency(id_currency)
|
||||||
ON UPDATE RESTRICT,
|
ON UPDATE RESTRICT,
|
||||||
active BIT NOT NULL DEFAULT 1,
|
active BIT NOT NULL DEFAULT 1,
|
||||||
created_on DATETIME,
|
created_on TIMESTAMP,
|
||||||
created_by VARCHAR(100),
|
created_by VARCHAR(100),
|
||||||
id_change_set INT,
|
id_change_set INT,
|
||||||
CONSTRAINT FK_Shop_Discount_Region_Currency_Link_id_change_set
|
CONSTRAINT FK_Shop_Discount_Region_Currency_Link_id_change_set
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ CREATE TABLE IF NOT EXISTS Shop_Product_Currency_Region_Link (
|
|||||||
price_local_VAT_excl FLOAT NULL,
|
price_local_VAT_excl FLOAT NULL,
|
||||||
id_stripe_price VARCHAR(200),
|
id_stripe_price VARCHAR(200),
|
||||||
active BIT NOT NULL DEFAULT 1,
|
active BIT NOT NULL DEFAULT 1,
|
||||||
created_on DATETIME,
|
created_on TIMESTAMP,
|
||||||
created_by VARCHAR(100),
|
created_by VARCHAR(100),
|
||||||
id_change_set INT,
|
id_change_set INT,
|
||||||
CONSTRAINT FK_Shop_Product_Currency_Region_Link_id_change_set
|
CONSTRAINT FK_Shop_Product_Currency_Region_Link_id_change_set
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ CREATE TABLE IF NOT EXISTS Shop_Permission_Group (
|
|||||||
name VARCHAR(255),
|
name VARCHAR(255),
|
||||||
active BIT NOT NULL DEFAULT 1,
|
active BIT NOT NULL DEFAULT 1,
|
||||||
display_order INT NOT NULL,
|
display_order INT NOT NULL,
|
||||||
created_on DATETIME,
|
created_on TIMESTAMP,
|
||||||
created_by VARCHAR(100),
|
created_by VARCHAR(100),
|
||||||
id_change_set INT,
|
id_change_set INT,
|
||||||
CONSTRAINT FK_Shop_Permission_Group_id_change_set
|
CONSTRAINT FK_Shop_Permission_Group_id_change_set
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ CREATE TABLE IF NOT EXISTS Shop_Permission (
|
|||||||
REFERENCES Shop_Access_Level(id_access_level),
|
REFERENCES Shop_Access_Level(id_access_level),
|
||||||
active BIT NOT NULL DEFAULT 1,
|
active BIT NOT NULL DEFAULT 1,
|
||||||
display_order INT NOT NULL,
|
display_order INT NOT NULL,
|
||||||
created_on DATETIME,
|
created_on TIMESTAMP,
|
||||||
created_by VARCHAR(100),
|
created_by VARCHAR(100),
|
||||||
id_change_set INT,
|
id_change_set INT,
|
||||||
CONSTRAINT FK_Shop_Permission_id_change_set
|
CONSTRAINT FK_Shop_Permission_id_change_set
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ CREATE TABLE IF NOT EXISTS Shop_Role (
|
|||||||
name VARCHAR(255),
|
name VARCHAR(255),
|
||||||
active BIT NOT NULL DEFAULT 1,
|
active BIT NOT NULL DEFAULT 1,
|
||||||
display_order INT NOT NULL,
|
display_order INT NOT NULL,
|
||||||
created_on DATETIME,
|
created_on TIMESTAMP,
|
||||||
created_by VARCHAR(100),
|
created_by VARCHAR(100),
|
||||||
id_change_set INT,
|
id_change_set INT,
|
||||||
CONSTRAINT FK_Shop_Role_id_change_set
|
CONSTRAINT FK_Shop_Role_id_change_set
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ CREATE TABLE IF NOT EXISTS Shop_Role_Permission_Link (
|
|||||||
FOREIGN KEY (id_access_level)
|
FOREIGN KEY (id_access_level)
|
||||||
REFERENCES Shop_Access_Level(id_access_level),
|
REFERENCES Shop_Access_Level(id_access_level),
|
||||||
active BIT NOT NULL DEFAULT 1,
|
active BIT NOT NULL DEFAULT 1,
|
||||||
created_on DATETIME,
|
created_on TIMESTAMP,
|
||||||
created_by VARCHAR(100),
|
created_by VARCHAR(100),
|
||||||
id_change_set INT,
|
id_change_set INT,
|
||||||
CONSTRAINT FK_Shop_Role_Permission_Link_id_change_set
|
CONSTRAINT FK_Shop_Role_Permission_Link_id_change_set
|
||||||
|
|||||||
@@ -6,13 +6,18 @@ USE PARTSLTD_PROD;
|
|||||||
SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_User';
|
SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_User';
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS Shop_User (
|
CREATE TABLE IF NOT EXISTS Shop_User (
|
||||||
id_user VARCHAR(200) NOT NULL PRIMARY KEY,
|
id_user INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||||
name VARCHAR(255) NOT NULL,
|
id_user_auth0 VARCHAR(200) NOT NULL,
|
||||||
|
firstname VARCHAR(255) NOT NULL,
|
||||||
|
surname VARCHAR(255) NOT NULL,
|
||||||
email VARCHAR(254) NOT NULL,
|
email VARCHAR(254) NOT NULL,
|
||||||
email_verified BIT NOT NULL DEFAULT 0,
|
is_email_verified BIT NOT NULL DEFAULT 0,
|
||||||
is_super_user BIT NOT NULL DEFAULT 0,
|
is_super_user BIT NOT NULL DEFAULT 0,
|
||||||
|
id_currency_default INT NULL,
|
||||||
|
id_region_default INT NULL,
|
||||||
|
is_included_VAT_default BIT NOT NULL DEFAULT 1,
|
||||||
active BIT NOT NULL DEFAULT 1,
|
active BIT NOT NULL DEFAULT 1,
|
||||||
created_on DATETIME,
|
created_on TIMESTAMP,
|
||||||
created_by VARCHAR(100),
|
created_by VARCHAR(100),
|
||||||
id_change_set INT,
|
id_change_set INT,
|
||||||
CONSTRAINT FK_Shop_User_id_change_set
|
CONSTRAINT FK_Shop_User_id_change_set
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning
|
|||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS Shop_User_Audit (
|
CREATE TABLE IF NOT EXISTS Shop_User_Audit (
|
||||||
id_audit INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
id_audit INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||||
id_user VARCHAR(200) NOT NULL,
|
id_user INT NOT NULL,
|
||||||
CONSTRAINT FK_Shop_User_Audit_id_user
|
CONSTRAINT FK_Shop_User_Audit_id_user
|
||||||
FOREIGN KEY (id_user)
|
FOREIGN KEY (id_user)
|
||||||
REFERENCES Shop_User(id_user)
|
REFERENCES Shop_User(id_user)
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning
|
|||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS Shop_User_Role_Link (
|
CREATE TABLE IF NOT EXISTS Shop_User_Role_Link (
|
||||||
id_link INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
id_link INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||||
id_user VARCHAR(200) NOT NULL,
|
id_user INT NOT NULL,
|
||||||
CONSTRAINT FK_Shop_User_Role_Link_id_user
|
CONSTRAINT FK_Shop_User_Role_Link_id_user
|
||||||
FOREIGN KEY (id_user)
|
FOREIGN KEY (id_user)
|
||||||
REFERENCES Shop_User(id_user)
|
REFERENCES Shop_User(id_user)
|
||||||
@@ -17,7 +17,7 @@ CREATE TABLE IF NOT EXISTS Shop_User_Role_Link (
|
|||||||
FOREIGN KEY (id_role)
|
FOREIGN KEY (id_role)
|
||||||
REFERENCES Shop_Role(id_role),
|
REFERENCES Shop_Role(id_role),
|
||||||
active BIT NOT NULL DEFAULT 1,
|
active BIT NOT NULL DEFAULT 1,
|
||||||
created_on DATETIME,
|
created_on TIMESTAMP,
|
||||||
created_by VARCHAR(100),
|
created_by VARCHAR(100),
|
||||||
id_change_set INT,
|
id_change_set INT,
|
||||||
CONSTRAINT FK_Shop_User_Role_Link_id_change_set
|
CONSTRAINT FK_Shop_User_Role_Link_id_change_set
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning
|
|||||||
|
|
||||||
CREATE TABLE Shop_Address (
|
CREATE TABLE Shop_Address (
|
||||||
id_address INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
id_address INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||||
id_user VARCHAR(200) NOT NULL,
|
id_user INT NOT NULL,
|
||||||
CONSTRAINT FK_Shop_Address_id_user
|
CONSTRAINT FK_Shop_Address_id_user
|
||||||
FOREIGN KEY (id_user)
|
FOREIGN KEY (id_user)
|
||||||
REFERENCES Shop_User(id_user)
|
REFERENCES Shop_User(id_user)
|
||||||
@@ -22,7 +22,7 @@ CREATE TABLE Shop_Address (
|
|||||||
city VARCHAR(50) NOT NULL,
|
city VARCHAR(50) NOT NULL,
|
||||||
county VARCHAR(100) NOT NULL,
|
county VARCHAR(100) NOT NULL,
|
||||||
active BIT NOT NULL DEFAULT 1,
|
active BIT NOT NULL DEFAULT 1,
|
||||||
created_on DATETIME,
|
created_on TIMESTAMP,
|
||||||
created_by VARCHAR(100),
|
created_by VARCHAR(100),
|
||||||
id_change_set INT,
|
id_change_set INT,
|
||||||
CONSTRAINT FK_Shop_Address_id_change_set
|
CONSTRAINT FK_Shop_Address_id_change_set
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning
|
|||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS Shop_User_Basket (
|
CREATE TABLE IF NOT EXISTS Shop_User_Basket (
|
||||||
id_item INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
id_item INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||||
id_user VARCHAR(200) NOT NULL,
|
id_user INT NOT NULL,
|
||||||
CONSTRAINT FK_Shop_User_Basket_id_user
|
CONSTRAINT FK_Shop_User_Basket_id_user
|
||||||
FOREIGN KEY (id_user)
|
FOREIGN KEY (id_user)
|
||||||
REFERENCES Shop_User(id_user)
|
REFERENCES Shop_User(id_user)
|
||||||
@@ -24,7 +24,7 @@ CREATE TABLE IF NOT EXISTS Shop_User_Basket (
|
|||||||
ON UPDATE RESTRICT,
|
ON UPDATE RESTRICT,
|
||||||
quantity INT NOT NULL,
|
quantity INT NOT NULL,
|
||||||
active BIT NOT NULL DEFAULT 1,
|
active BIT NOT NULL DEFAULT 1,
|
||||||
created_on DATETIME,
|
created_on TIMESTAMP,
|
||||||
created_by VARCHAR(100),
|
created_by VARCHAR(100),
|
||||||
id_change_set_user INT,
|
id_change_set_user INT,
|
||||||
CONSTRAINT FK_Shop_User_Basket_id_change_set_user
|
CONSTRAINT FK_Shop_User_Basket_id_change_set_user
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ CREATE TABLE IF NOT EXISTS Shop_User_Order_Status (
|
|||||||
name_plural VARCHAR(256),
|
name_plural VARCHAR(256),
|
||||||
active BIT NOT NULL DEFAULT 1,
|
active BIT NOT NULL DEFAULT 1,
|
||||||
display_order INT NOT NULL,
|
display_order INT NOT NULL,
|
||||||
created_on DATETIME,
|
created_on TIMESTAMP,
|
||||||
created_by VARCHAR(100),
|
created_by VARCHAR(100),
|
||||||
id_change_set INT,
|
id_change_set INT,
|
||||||
CONSTRAINT FK_Shop_User_Order_Status_id_change_set
|
CONSTRAINT FK_Shop_User_Order_Status_id_change_set
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ CREATE TABLE IF NOT EXISTS Shop_Supplier (
|
|||||||
FOREIGN KEY (id_currency)
|
FOREIGN KEY (id_currency)
|
||||||
REFERENCES Shop_Currency(id_currency),
|
REFERENCES Shop_Currency(id_currency),
|
||||||
active BIT NOT NULL DEFAULT 1,
|
active BIT NOT NULL DEFAULT 1,
|
||||||
created_on DATETIME,
|
created_on TIMESTAMP,
|
||||||
created_by VARCHAR(100),
|
created_by VARCHAR(100),
|
||||||
id_change_set INT,
|
id_change_set INT,
|
||||||
CONSTRAINT FK_Shop_Supplier_id_change_set
|
CONSTRAINT FK_Shop_Supplier_id_change_set
|
||||||
|
|||||||
@@ -30,9 +30,9 @@ CREATE TABLE IF NOT EXISTS Shop_Supplier_Purchase_Order (
|
|||||||
display_order INT NOT NULL,
|
display_order INT NOT NULL,
|
||||||
*/
|
*/
|
||||||
active BIT NOT NULL DEFAULT 1,
|
active BIT NOT NULL DEFAULT 1,
|
||||||
created_on DATETIME,
|
created_on TIMESTAMP,
|
||||||
created_by VARCHAR(100),
|
created_by VARCHAR(100),
|
||||||
updated_last_on DATETIME NULL,
|
updated_last_on TIMESTAMP NULL,
|
||||||
created_last_by VARCHAR(100) NULL,
|
created_last_by VARCHAR(100) NULL,
|
||||||
id_change_set INT NULL,
|
id_change_set INT NULL,
|
||||||
CONSTRAINT FK_Shop_Supplier_Purchase_Order_id_change_set
|
CONSTRAINT FK_Shop_Supplier_Purchase_Order_id_change_set
|
||||||
|
|||||||
@@ -26,9 +26,9 @@ CREATE TABLE IF NOT EXISTS Shop_Supplier_Purchase_Order_Product_Link (
|
|||||||
latency_delivery_days INT NOT NULL,
|
latency_delivery_days INT NOT NULL,
|
||||||
display_order INT NOT NULL,
|
display_order INT NOT NULL,
|
||||||
active BIT NOT NULL,
|
active BIT NOT NULL,
|
||||||
created_on DATETIME,
|
created_on TIMESTAMP,
|
||||||
created_by VARCHAR(100),
|
created_by VARCHAR(100),
|
||||||
updated_last_on DATETIME NULL,
|
updated_last_on TIMESTAMP NULL,
|
||||||
created_last_by VARCHAR(100) NULL,
|
created_last_by VARCHAR(100) NULL,
|
||||||
id_change_set INT NULL,
|
id_change_set INT NULL,
|
||||||
CONSTRAINT FK_Shop_Supplier_Purchase_Order_Product_Link_id_change_set
|
CONSTRAINT FK_Shop_Supplier_Purchase_Order_Product_Link_id_change_set
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning
|
|||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS Shop_Supplier_Purchase_Order_Product_Link_Temp (
|
CREATE TABLE IF NOT EXISTS Shop_Supplier_Purchase_Order_Product_Link_Temp (
|
||||||
id_link INT NOT NULL PRIMARY KEY,
|
id_link INT NOT NULL PRIMARY KEY,
|
||||||
GUID VARCHAR(36) NOT NULL,
|
GUID BINARY(36) NOT NULL,
|
||||||
id_order INT NOT NULL,
|
id_order INT NOT NULL,
|
||||||
/*
|
/*
|
||||||
CONSTRAINT FK_Supplier_Purchase_Order_Product_Link_Temp_id_order
|
CONSTRAINT FK_Supplier_Purchase_Order_Product_Link_Temp_id_order
|
||||||
|
|||||||
@@ -22,9 +22,9 @@ CREATE TABLE IF NOT EXISTS Shop_Manufacturing_Purchase_Order (
|
|||||||
display_order INT NOT NULL,
|
display_order INT NOT NULL,
|
||||||
*/
|
*/
|
||||||
active BIT NOT NULL DEFAULT 1,
|
active BIT NOT NULL DEFAULT 1,
|
||||||
created_on DATETIME,
|
created_on TIMESTAMP,
|
||||||
created_by VARCHAR(100),
|
created_by VARCHAR(100),
|
||||||
updated_last_on DATETIME NULL,
|
updated_last_on TIMESTAMP NULL,
|
||||||
created_last_by VARCHAR(100) NULL,
|
created_last_by VARCHAR(100) NULL,
|
||||||
id_change_set INT NULL,
|
id_change_set INT NULL,
|
||||||
CONSTRAINT FK_Shop_Manufacturing_Purchase_Order_id_change_set
|
CONSTRAINT FK_Shop_Manufacturing_Purchase_Order_id_change_set
|
||||||
|
|||||||
@@ -27,9 +27,9 @@ CREATE TABLE IF NOT EXISTS Shop_Manufacturing_Purchase_Order_Product_Link (
|
|||||||
quantity_produced FLOAT NOT NULL,
|
quantity_produced FLOAT NOT NULL,
|
||||||
display_order INT NOT NULL,
|
display_order INT NOT NULL,
|
||||||
active BIT NOT NULL,
|
active BIT NOT NULL,
|
||||||
created_on DATETIME,
|
created_on TIMESTAMP,
|
||||||
created_by VARCHAR(100),
|
created_by VARCHAR(100),
|
||||||
updated_last_on DATETIME NULL,
|
updated_last_on TIMESTAMP NULL,
|
||||||
created_last_by VARCHAR(100) NULL,
|
created_last_by VARCHAR(100) NULL,
|
||||||
id_change_set INT NULL,
|
id_change_set INT NULL,
|
||||||
CONSTRAINT FK_Manufacturing_Purchase_Order_id_change_set
|
CONSTRAINT FK_Manufacturing_Purchase_Order_id_change_set
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning
|
|||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS Shop_Manufacturing_Purchase_Order_Product_Link_Temp (
|
CREATE TABLE IF NOT EXISTS Shop_Manufacturing_Purchase_Order_Product_Link_Temp (
|
||||||
id_link INT NOT NULL PRIMARY KEY,
|
id_link INT NOT NULL PRIMARY KEY,
|
||||||
GUID VARCHAR(36) NOT NULL,
|
GUID BINARY(36) NOT NULL,
|
||||||
id_order INT NOT NULL,
|
id_order INT NOT NULL,
|
||||||
/*
|
/*
|
||||||
CONSTRAINT FK_Manuf_Purch_Order_Product_Link_Temp_id_order
|
CONSTRAINT FK_Manuf_Purch_Order_Product_Link_Temp_id_order
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ CREATE TABLE IF NOT EXISTS Shop_Customer (
|
|||||||
FOREIGN KEY (id_currency)
|
FOREIGN KEY (id_currency)
|
||||||
REFERENCES Shop_Currency(id_currency),
|
REFERENCES Shop_Currency(id_currency),
|
||||||
active BIT NOT NULL DEFAULT 1,
|
active BIT NOT NULL DEFAULT 1,
|
||||||
created_on DATETIME,
|
created_on TIMESTAMP,
|
||||||
created_by VARCHAR(100),
|
created_by VARCHAR(100),
|
||||||
id_change_set INT,
|
id_change_set INT,
|
||||||
CONSTRAINT FK_Shop_Customer_id_change_set
|
CONSTRAINT FK_Shop_Customer_id_change_set
|
||||||
|
|||||||
@@ -24,9 +24,9 @@ CREATE TABLE IF NOT EXISTS Shop_Customer_Sales_Order (
|
|||||||
display_order INT NOT NULL,
|
display_order INT NOT NULL,
|
||||||
*/
|
*/
|
||||||
active BIT NOT NULL DEFAULT 1,
|
active BIT NOT NULL DEFAULT 1,
|
||||||
created_on DATETIME,
|
created_on TIMESTAMP,
|
||||||
created_by VARCHAR(100),
|
created_by VARCHAR(100),
|
||||||
updated_last_on DATETIME NULL,
|
updated_last_on TIMESTAMP NULL,
|
||||||
created_last_by VARCHAR(100) NULL,
|
created_last_by VARCHAR(100) NULL,
|
||||||
id_change_set INT NULL,
|
id_change_set INT NULL,
|
||||||
CONSTRAINT FK_Shop_Customer_Sales_Order_id_change_set
|
CONSTRAINT FK_Shop_Customer_Sales_Order_id_change_set
|
||||||
|
|||||||
@@ -27,9 +27,9 @@ CREATE TABLE IF NOT EXISTS Shop_Customer_Sales_Order_Product_Link (
|
|||||||
display_order INT NOT NULL,
|
display_order INT NOT NULL,
|
||||||
|
|
||||||
active BIT NOT NULL,
|
active BIT NOT NULL,
|
||||||
created_on DATETIME,
|
created_on TIMESTAMP,
|
||||||
created_by VARCHAR(100),
|
created_by VARCHAR(100),
|
||||||
updated_last_on DATETIME NULL,
|
updated_last_on TIMESTAMP NULL,
|
||||||
created_last_by VARCHAR(100) NULL,
|
created_last_by VARCHAR(100) NULL,
|
||||||
id_change_set INT NULL,
|
id_change_set INT NULL,
|
||||||
CONSTRAINT FK_Shop_Customer_Sales_Order_Product_Link_id_change_set
|
CONSTRAINT FK_Shop_Customer_Sales_Order_Product_Link_id_change_set
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning
|
|||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS Shop_Customer_Sales_Order_Product_Link_Temp (
|
CREATE TABLE IF NOT EXISTS Shop_Customer_Sales_Order_Product_Link_Temp (
|
||||||
id_link INT NOT NULL PRIMARY KEY,
|
id_link INT NOT NULL PRIMARY KEY,
|
||||||
GUID VARCHAR(36) NOT NULL,
|
GUID BINARY(36) NOT NULL,
|
||||||
id_order INT NOT NULL,
|
id_order INT NOT NULL,
|
||||||
/*
|
/*
|
||||||
CONSTRAINT FK_Customer_Sales_Order_Product_Link_Temp_id_order
|
CONSTRAINT FK_Customer_Sales_Order_Product_Link_Temp_id_order
|
||||||
|
|||||||
@@ -39,9 +39,25 @@ BEGIN
|
|||||||
value_new,
|
value_new,
|
||||||
id_change_set
|
id_change_set
|
||||||
)
|
)
|
||||||
# Changed name
|
# Changed id_user_auth0
|
||||||
SELECT NEW.id_user, 'name', OLD.name, NEW.name, NEW.id_change_set
|
SELECT NEW.id_user, 'id_user_auth0', OLD.id_user_auth0, NEW.id_user_auth0, NEW.id_change_set
|
||||||
WHERE NOT (OLD.name <=> NEW.name)
|
WHERE NOT (OLD.id_user_auth0 <=> NEW.id_user_auth0)
|
||||||
|
UNION
|
||||||
|
# Changed firstname
|
||||||
|
SELECT NEW.id_user, 'firstname', OLD.firstname, NEW.firstname, NEW.id_change_set
|
||||||
|
WHERE NOT (OLD.firstname <=> NEW.firstname)
|
||||||
|
UNION
|
||||||
|
# Changed surname
|
||||||
|
SELECT NEW.id_user, 'surname', OLD.surname, NEW.surname, NEW.id_change_set
|
||||||
|
WHERE NOT (OLD.surname <=> NEW.surname)
|
||||||
|
UNION
|
||||||
|
# Changed email
|
||||||
|
SELECT NEW.id_user, 'email', OLD.email, NEW.email, NEW.id_change_set
|
||||||
|
WHERE NOT (OLD.email <=> NEW.email)
|
||||||
|
UNION
|
||||||
|
# Changed is_email_verified
|
||||||
|
SELECT NEW.id_user, 'is_email_verified', CONVERT(CONVERT(OLD.is_email_verified, SIGNED), CHAR), CONVERT(CONVERT(NEW.is_email_verified, SIGNED), CHAR), NEW.id_change_set
|
||||||
|
WHERE NOT (OLD.is_email_verified <=> NEW.is_email_verified)
|
||||||
UNION
|
UNION
|
||||||
# Changed is_super_user
|
# Changed is_super_user
|
||||||
SELECT NEW.id_user, 'is_super_user', CONVERT(CONVERT(OLD.is_super_user, SIGNED), CHAR), CONVERT(CONVERT(NEW.is_super_user, SIGNED), CHAR), NEW.id_change_set
|
SELECT NEW.id_user, 'is_super_user', CONVERT(CONVERT(OLD.is_super_user, SIGNED), CHAR), CONVERT(CONVERT(NEW.is_super_user, SIGNED), CHAR), NEW.id_change_set
|
||||||
@@ -50,6 +66,18 @@ BEGIN
|
|||||||
# Changed active
|
# Changed active
|
||||||
SELECT NEW.id_user, 'active', CONVERT(CONVERT(OLD.active, SIGNED), CHAR), CONVERT(CONVERT(NEW.active, SIGNED), CHAR), NEW.id_change_set
|
SELECT NEW.id_user, 'active', CONVERT(CONVERT(OLD.active, SIGNED), CHAR), CONVERT(CONVERT(NEW.active, SIGNED), CHAR), NEW.id_change_set
|
||||||
WHERE NOT (OLD.active <=> NEW.active)
|
WHERE NOT (OLD.active <=> NEW.active)
|
||||||
|
UNION
|
||||||
|
# Changed id_currency_default
|
||||||
|
SELECT NEW.id_user, 'id_currency_default', CONVERT(OLD.id_currency_default, CHAR), CONVERT(NEW.id_currency_default, CHAR), NEW.id_change_set
|
||||||
|
WHERE NOT (OLD.id_currency_default <=> NEW.id_currency_default)
|
||||||
|
UNION
|
||||||
|
# Changed id_region_default
|
||||||
|
SELECT NEW.id_user, 'id_region_default', CONVERT(OLD.id_region_default, CHAR), CONVERT(NEW.id_region_default, CHAR), NEW.id_change_set
|
||||||
|
WHERE NOT (OLD.id_region_default <=> NEW.id_region_default)
|
||||||
|
UNION
|
||||||
|
# Changed is_included_VAT_default
|
||||||
|
SELECT NEW.id_user, 'is_included_VAT_default', CONVERT(CONVERT(OLD.is_included_VAT_default, SIGNED), CHAR), CONVERT(CONVERT(NEW.is_included_VAT_default, SIGNED), CHAR), NEW.id_change_set
|
||||||
|
WHERE NOT (OLD.is_included_VAT_default <=> NEW.is_included_VAT_default)
|
||||||
;
|
;
|
||||||
END //
|
END //
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
@@ -31,22 +31,11 @@ BEGIN
|
|||||||
DECLARE v_i_end INT;
|
DECLARE v_i_end INT;
|
||||||
DECLARE v_current_item VARCHAR(4000);
|
DECLARE v_current_item VARCHAR(4000);
|
||||||
|
|
||||||
|
|
||||||
-- Argument validation + default values
|
-- Argument validation + default values
|
||||||
IF a_string IS NULL THEN
|
SET a_string := IFNULL(a_string, '');
|
||||||
SET a_string = '';
|
SET a_separator := IFNULL(a_separator, '');
|
||||||
ELSE
|
|
||||||
SET a_string = TRIM(a_string);
|
|
||||||
END IF;
|
|
||||||
IF a_separator IS NULL THEN
|
|
||||||
SET a_separator = '';
|
|
||||||
ELSE
|
|
||||||
SET a_separator = TRIM(a_separator);
|
|
||||||
END IF;
|
|
||||||
/*
|
|
||||||
IF a_allow_empty IS NULL THEN
|
|
||||||
SET a_allow_empty = 0;
|
|
||||||
END IF;
|
|
||||||
*/
|
|
||||||
|
|
||||||
-- Temporary tables
|
-- Temporary tables
|
||||||
DROP TABLE IF EXISTS Split_Temp;
|
DROP TABLE IF EXISTS Split_Temp;
|
||||||
@@ -61,7 +50,7 @@ BEGIN
|
|||||||
SET v_has_string = CASE WHEN a_string = '' THEN 0 ELSE 1 END;
|
SET v_has_string = CASE WHEN a_string = '' THEN 0 ELSE 1 END;
|
||||||
SET v_has_separator = CASE WHEN a_separator = '' THEN 0 ELSE 1 END;
|
SET v_has_separator = CASE WHEN a_separator = '' THEN 0 ELSE 1 END;
|
||||||
|
|
||||||
IF (v_has_string AND v_has_separator) THEN
|
IF v_has_string THEN
|
||||||
|
|
||||||
SET v_i_start = 1;
|
SET v_i_start = 1;
|
||||||
SET v_i_end = LOCATE(',', a_string);
|
SET v_i_end = LOCATE(',', a_string);
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ USE PARTSLTD_PROD;
|
|||||||
|
|
||||||
CALL p_shop_user_eval (
|
CALL p_shop_user_eval (
|
||||||
UUID(), # a_guid
|
UUID(), # a_guid
|
||||||
'', # a_id_user
|
'', # a_ids_user
|
||||||
0, # a_get_inactive_users
|
0, # a_get_inactive_users
|
||||||
'1', # a_ids_permission
|
'1', # a_ids_permission
|
||||||
'', # a_ids_access_level
|
'', # a_ids_access_level
|
||||||
@@ -21,8 +21,8 @@ DROP PROCEDURE IF EXISTS p_shop_user_eval;
|
|||||||
|
|
||||||
DELIMITER //
|
DELIMITER //
|
||||||
CREATE PROCEDURE p_shop_user_eval (
|
CREATE PROCEDURE p_shop_user_eval (
|
||||||
IN a_guid VARCHAR(36),
|
IN a_guid BINARY(36),
|
||||||
IN a_id_user VARCHAR(200),
|
IN a_ids_user LONGTEXT,
|
||||||
IN a_get_inactive_users BIT,
|
IN a_get_inactive_users BIT,
|
||||||
IN a_ids_permission VARCHAR(500),
|
IN a_ids_permission VARCHAR(500),
|
||||||
IN a_ids_access_level VARCHAR(100),
|
IN a_ids_access_level VARCHAR(100),
|
||||||
@@ -45,7 +45,7 @@ BEGIN
|
|||||||
DECLARE v_priority_access_level_admin INT;
|
DECLARE v_priority_access_level_admin INT;
|
||||||
DECLARE v_id_access_level INT;
|
DECLARE v_id_access_level INT;
|
||||||
DECLARE v_priority_access_level INT;
|
DECLARE v_priority_access_level INT;
|
||||||
DECLARE v_now DATETIME;
|
DECLARE v_now TIMESTAMP;
|
||||||
DECLARE v_ids_row_delete VARCHAR(500);
|
DECLARE v_ids_row_delete VARCHAR(500);
|
||||||
DECLARE v_code_error_data VARCHAR(200);
|
DECLARE v_code_error_data VARCHAR(200);
|
||||||
DECLARE v_id_error_data INT;
|
DECLARE v_id_error_data INT;
|
||||||
@@ -64,52 +64,18 @@ BEGIN
|
|||||||
|
|
||||||
|
|
||||||
-- Parse arguments + get default values
|
-- Parse arguments + get default values
|
||||||
/*
|
SET a_guid := IFNULL(a_guid, UUID());
|
||||||
IF a_guid IS NULL THEN
|
SET a_ids_user := TRIM(IFNULL(a_ids_user, ''));
|
||||||
SET a_guid = UUID();
|
SET a_get_inactive_users := IFNULL(a_get_inactive_users, 0);
|
||||||
END IF;
|
SET a_ids_permission := TRIM(IFNULL(a_ids_permission, ''));
|
||||||
*/
|
SET a_ids_access_level := TRIM(IFNULL(a_ids_access_level, ''));
|
||||||
IF a_id_user IS NULL THEN
|
SET a_ids_product := TRIM(IFNULL(a_ids_product, ''));
|
||||||
SET a_id_user = '';
|
|
||||||
ELSE
|
|
||||||
SET a_id_user = TRIM(a_id_user);
|
|
||||||
END IF;
|
|
||||||
IF a_get_inactive_users IS NULL THEN
|
|
||||||
SET a_get_inactive_users = 0;
|
|
||||||
END IF;
|
|
||||||
/*
|
|
||||||
IF a_get_user_permissions IS NULL THEN
|
|
||||||
SET a_get_user_permissions = 0;
|
|
||||||
END IF;
|
|
||||||
*/
|
|
||||||
IF a_ids_permission IS NULL THEN
|
|
||||||
SET a_ids_permission = '';
|
|
||||||
ELSE
|
|
||||||
SET a_ids_permission = TRIM(a_ids_permission);
|
|
||||||
END IF;
|
|
||||||
IF a_ids_access_level IS NULL THEN
|
|
||||||
SET a_ids_access_level = '';
|
|
||||||
ELSE
|
|
||||||
SET a_ids_access_level = TRIM(a_ids_access_level);
|
|
||||||
END IF;
|
|
||||||
/*
|
|
||||||
IF a_ids_permutation IS NULL THEN
|
|
||||||
SET a_ids_permutation = '';
|
|
||||||
ELSE
|
|
||||||
SET a_ids_permutation = TRIM(a_ids_permutation);
|
|
||||||
END IF;
|
|
||||||
*/
|
|
||||||
IF a_ids_product IS NULL THEN
|
|
||||||
SET a_ids_product = '';
|
|
||||||
ELSE
|
|
||||||
SET a_ids_product = TRIM(a_ids_product);
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
-- Permanent Table
|
-- Permanent Table
|
||||||
CREATE TABLE IF NOT EXISTS Shop_User_Eval_Temp (
|
CREATE TABLE IF NOT EXISTS Shop_User_Eval_Temp (
|
||||||
id_row INT PRIMARY KEY AUTO_INCREMENT NOT NULL,
|
id_row INT PRIMARY KEY AUTO_INCREMENT NOT NULL,
|
||||||
guid VARCHAR(36) NOT NULL,
|
guid BINARY(36) NOT NULL,
|
||||||
id_user VARCHAR(200),
|
id_user INT NULL,
|
||||||
id_permission_required INT NOT NULL,
|
id_permission_required INT NOT NULL,
|
||||||
CONSTRAINT FK_Shop_User_Eval_Temp_id_permission_required
|
CONSTRAINT FK_Shop_User_Eval_Temp_id_permission_required
|
||||||
FOREIGN KEY (id_permission_required)
|
FOREIGN KEY (id_permission_required)
|
||||||
@@ -148,30 +114,18 @@ BEGIN
|
|||||||
can_admin BIT -- DEFAULT 0
|
can_admin BIT -- DEFAULT 0
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS tmp_Shop_Product_p_Shop_User_Eval (
|
CREATE TEMPORARY TABLE IF NOT EXISTS tmp_Shop_Product_p_Shop_User_Eval (
|
||||||
id_row INT PRIMARY KEY AUTO_INCREMENT NOT NULL,
|
id_row INT PRIMARY KEY AUTO_INCREMENT NOT NULL,
|
||||||
id_product INT NOT NULL,
|
id_product INT NOT NULL,
|
||||||
CONSTRAINT FK_tmp_Shop_Product_p_Shop_User_Eval_id_product FOREIGN KEY (id_product)
|
|
||||||
REFERENCES Shop_Product (id_product),
|
|
||||||
/*
|
|
||||||
id_permutation INT NOT NULL,
|
|
||||||
CONSTRAINT FK_tmp_Shop_Product_p_Shop_User_Eval_id_permutation FOREIGN KEY (id_permutation)
|
|
||||||
REFERENCES Shop_Product_Permutation (id_permutation),
|
|
||||||
*/
|
|
||||||
id_access_level_required INT NOT NULL,
|
id_access_level_required INT NOT NULL,
|
||||||
CONSTRAINT FK_tmp_Shop_Product_p_Shop_User_Eval_id_access_level_required FOREIGN KEY (id_access_level_required)
|
guid BINARY(36) NOT NULL,
|
||||||
REFERENCES Shop_Access_Level (id_access_level),
|
|
||||||
guid VARCHAR(36) NOT NULL,
|
|
||||||
rank_product INT NOT NULL
|
rank_product INT NOT NULL
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE 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 VARCHAR(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
|
|
||||||
FOREIGN KEY (id_type)
|
|
||||||
REFERENCES Shop_Msg_Error_Type (id_type),
|
|
||||||
code VARCHAR(50) NOT NULL,
|
code VARCHAR(50) NOT NULL,
|
||||||
msg VARCHAR(4000) NOT NULL
|
msg VARCHAR(4000) NOT NULL
|
||||||
);
|
);
|
||||||
@@ -194,7 +148,7 @@ BEGIN
|
|||||||
)
|
)
|
||||||
;
|
;
|
||||||
END IF;
|
END IF;
|
||||||
SET v_has_filter_user = CASE WHEN a_id_user = '' THEN 0 ELSE 1 END;
|
SET v_has_filter_user = CASE WHEN a_ids_user = '' THEN 0 ELSE 1 END;
|
||||||
SET a_ids_permission = REPLACE(a_ids_permission, '|', ',');
|
SET a_ids_permission = REPLACE(a_ids_permission, '|', ',');
|
||||||
SET v_has_filter_permission = CASE WHEN a_ids_permission = '' THEN 0 ELSE 1 END;
|
SET v_has_filter_permission = CASE WHEN a_ids_permission = '' THEN 0 ELSE 1 END;
|
||||||
SET a_ids_access_level = REPLACE(a_ids_access_level, '|', ',');
|
SET a_ids_access_level = REPLACE(a_ids_access_level, '|', ',');
|
||||||
@@ -441,10 +395,10 @@ BEGIN
|
|||||||
IF NOT EXISTS (SELECT * FROM tmp_Msg_Error WHERE GUID = a_guid) THEN
|
IF NOT EXISTS (SELECT * FROM tmp_Msg_Error WHERE GUID = a_guid) THEN
|
||||||
IF v_has_filter_user = 1 THEN
|
IF v_has_filter_user = 1 THEN
|
||||||
/*
|
/*
|
||||||
SET a_id_user := (SELECT id_user FROM Shop_User WHERE id_user LIKE a_id_user AND active);
|
SET a_ids_user := (SELECT id_user FROM Shop_User WHERE id_user LIKE a_ids_user AND active);
|
||||||
SET v_has_filter_user = NOT (a_id_user <=> NULL);
|
SET v_has_filter_user = NOT (a_ids_user <=> NULL);
|
||||||
*/
|
*/
|
||||||
IF ISNULL((SELECT id_user FROM Shop_User WHERE id_user LIKE a_id_user AND active)) THEN -- NOT v_has_filter_user THEN
|
IF ISNULL((SELECT id_user FROM Shop_User WHERE id_user LIKE a_ids_user AND active)) THEN -- NOT v_has_filter_user THEN
|
||||||
INSERT INTO tmp_Msg_Error (
|
INSERT INTO tmp_Msg_Error (
|
||||||
guid,
|
guid,
|
||||||
id_type,
|
id_type,
|
||||||
@@ -455,10 +409,10 @@ BEGIN
|
|||||||
a_guid,
|
a_guid,
|
||||||
(SELECT id_type FROM Shop_Msg_Error_Type WHERE code = v_code_error_data LIMIT 1),
|
(SELECT id_type FROM Shop_Msg_Error_Type WHERE code = v_code_error_data LIMIT 1),
|
||||||
v_code_error_data,
|
v_code_error_data,
|
||||||
CONCAT('Invalid user ID: ', IFNULL(a_id_user, 'NULL'))
|
CONCAT('Invalid user ID: ', IFNULL(a_ids_user, 'NULL'))
|
||||||
)
|
)
|
||||||
;
|
;
|
||||||
SET a_id_user = NULL;
|
SET a_ids_user = NULL;
|
||||||
SET v_has_filter_user = 0;
|
SET v_has_filter_user = 0;
|
||||||
ELSE
|
ELSE
|
||||||
SET v_has_filter_user = 1;
|
SET v_has_filter_user = 1;
|
||||||
@@ -482,13 +436,20 @@ BEGIN
|
|||||||
*/
|
*/
|
||||||
)
|
)
|
||||||
SELECT a_guid,
|
SELECT a_guid,
|
||||||
a_id_user,
|
U.id_user,
|
||||||
P.id_permission,
|
P.id_permission,
|
||||||
AL.priority
|
AL.priority
|
||||||
FROM Shop_Permission P
|
FROM Shop_Permission P
|
||||||
INNER JOIN Shop_Access_Level AL
|
INNER JOIN Shop_Access_Level AL
|
||||||
ON P.id_access_level_required = AL.id_access_level
|
ON P.id_access_level_required = AL.id_access_level
|
||||||
AND AL.active
|
AND AL.active
|
||||||
|
CROSS JOIN (
|
||||||
|
SELECT id_user
|
||||||
|
FROM Shop_User U
|
||||||
|
WHERE 1=1
|
||||||
|
AND FIND_IN_SET(U.id_user, a_ids_user) > 0
|
||||||
|
AND U.active
|
||||||
|
) U
|
||||||
WHERE FIND_IN_SET(P.id_permission, a_ids_permission) > 0
|
WHERE FIND_IN_SET(P.id_permission, a_ids_permission) > 0
|
||||||
;
|
;
|
||||||
|
|
||||||
@@ -515,7 +476,7 @@ BEGIN
|
|||||||
ON t_P.id_access_leveL_required = AL.id_access_level
|
ON t_P.id_access_leveL_required = AL.id_access_level
|
||||||
AND AL.active
|
AND AL.active
|
||||||
CROSS JOIN Shop_User_Eval_Temp UE_T
|
CROSS JOIN Shop_User_Eval_Temp UE_T
|
||||||
ON a_id_user = UE_T.id_user
|
ON a_ids_user = UE_T.id_user
|
||||||
WHERE a_guid = t_P.guid
|
WHERE a_guid = t_P.guid
|
||||||
;
|
;
|
||||||
|
|
||||||
@@ -546,7 +507,7 @@ BEGIN
|
|||||||
ON t_P.id_access_leveL_required = AL.id_access_level
|
ON t_P.id_access_leveL_required = AL.id_access_level
|
||||||
AND AL.active
|
AND AL.active
|
||||||
CROSS JOIN Shop_User_Eval_Temp UE_T
|
CROSS JOIN Shop_User_Eval_Temp UE_T
|
||||||
ON a_id_user = UE_T.id_user
|
ON a_ids_user = UE_T.id_user
|
||||||
WHERE a_guid = t_P.guid
|
WHERE a_guid = t_P.guid
|
||||||
;
|
;
|
||||||
|
|
||||||
@@ -598,7 +559,7 @@ BEGIN
|
|||||||
INNER JOIN Shop_Access_Level AL
|
INNER JOIN Shop_Access_Level AL
|
||||||
ON RPL.id_access_level = AL.id_access_level
|
ON RPL.id_access_level = AL.id_access_level
|
||||||
AND AL.active
|
AND AL.active
|
||||||
WHERE U.id_user = a_id_user
|
WHERE U.id_user = a_ids_user
|
||||||
AND (a_get_inactive_users OR U.active)
|
AND (a_get_inactive_users OR U.active)
|
||||||
AND FIND_IN_SET(P.id_permission, a_ids_permission) > 0
|
AND FIND_IN_SET(P.id_permission, a_ids_permission) > 0
|
||||||
# AND v_id_permission = P.id_permission
|
# AND v_id_permission = P.id_permission
|
||||||
@@ -627,7 +588,7 @@ BEGIN
|
|||||||
UE_T.can_edit = CASE WHEN U.is_super_user THEN 1 ELSE CASE WHEN NOT ISNULL(AL.priority) AND AL.priority <= v_priority_access_level_edit AND AL.priority <= UE_T.priority_access_level_required THEN 1 ELSE 0 END END,
|
UE_T.can_edit = CASE WHEN U.is_super_user THEN 1 ELSE CASE WHEN NOT ISNULL(AL.priority) AND AL.priority <= v_priority_access_level_edit AND AL.priority <= UE_T.priority_access_level_required THEN 1 ELSE 0 END END,
|
||||||
UE_T.can_admin = CASE WHEN U.is_super_user THEN 1 ELSE CASE WHEN NOT ISNULL(AL.priority) AND AL.priority <= v_priority_access_level_admin AND AL.priority <= UE_T.priority_access_level_required THEN 1 ELSE 0 END END
|
UE_T.can_admin = CASE WHEN U.is_super_user THEN 1 ELSE CASE WHEN NOT ISNULL(AL.priority) AND AL.priority <= v_priority_access_level_admin AND AL.priority <= UE_T.priority_access_level_required THEN 1 ELSE 0 END END
|
||||||
WHERE UE_T.guid = a_guid
|
WHERE UE_T.guid = a_guid
|
||||||
AND UE_T.id_user = a_id_user
|
AND UE_T.id_user = a_ids_user
|
||||||
AND RPL.id_permission = UE_T.id_permission_required
|
AND RPL.id_permission = UE_T.id_permission_required
|
||||||
# GROUP BY UE_T.id_user
|
# GROUP BY UE_T.id_user
|
||||||
;
|
;
|
||||||
@@ -639,7 +600,7 @@ BEGIN
|
|||||||
UE_T.can_edit = 0,
|
UE_T.can_edit = 0,
|
||||||
UE_T.can_admin = 0
|
UE_T.can_admin = 0
|
||||||
WHERE UE_T.guid = a_guid
|
WHERE UE_T.guid = a_guid
|
||||||
AND UE_T.id_user = a_id_user
|
AND UE_T.id_user = a_ids_user
|
||||||
# GROUP BY UE_T.id_user
|
# GROUP BY UE_T.id_user
|
||||||
;
|
;
|
||||||
END IF;
|
END IF;
|
||||||
@@ -680,7 +641,7 @@ select * from shop_product;
|
|||||||
CALL p_shop_user_eval (
|
CALL p_shop_user_eval (
|
||||||
-- '00550ef3-2bfa-11ef-b83e-b42e9986184a', NULL, 0, '2', '1', '1,2,3,4,5,6');
|
-- '00550ef3-2bfa-11ef-b83e-b42e9986184a', NULL, 0, '2', '1', '1,2,3,4,5,6');
|
||||||
'56c9dfc1-e22f-11ee-aab4-b42e9986184a', # a_guid
|
'56c9dfc1-e22f-11ee-aab4-b42e9986184a', # a_guid
|
||||||
'', # a_id_user # 'auth0|6582b95c895d09a70ba10fef',
|
'', # a_ids_user # 'auth0|6582b95c895d09a70ba10fef',
|
||||||
false, # a_get_inactive_users
|
false, # a_get_inactive_users
|
||||||
'4,5', # a_ids_permission
|
'4,5', # a_ids_permission
|
||||||
'1', # a_ids_access_level
|
'1', # a_ids_access_level
|
||||||
|
|||||||
@@ -4,15 +4,22 @@ USE PARTSLTD_PROD;
|
|||||||
|
|
||||||
-- Clear previous proc
|
-- Clear previous proc
|
||||||
DROP PROCEDURE IF EXISTS p_save_product;
|
DROP PROCEDURE IF EXISTS p_save_product;
|
||||||
|
DROP PROCEDURE IF EXISTS p_shop_save_product;
|
||||||
|
|
||||||
|
|
||||||
DELIMITER //
|
DELIMITER //
|
||||||
CREATE PROCEDURE p_save_product (
|
CREATE PROCEDURE p_shop_save_product (
|
||||||
IN a_guid BINARY(36),
|
IN a_guid BINARY(36),
|
||||||
IN a_id_user VARCHAR(200),
|
IN a_id_user INT,
|
||||||
IN a_comment VARCHAR(500)
|
IN a_comment VARCHAR(500)
|
||||||
)
|
)
|
||||||
BEGIN
|
BEGIN
|
||||||
|
DECLARE v_code_type_error_bad_data VARCHAR(100);
|
||||||
|
DECLARE v_id_type_error_bad_data INT;
|
||||||
|
DECLARE v_id_permission_product INT;
|
||||||
|
DECLARE v_ids_product_permission LONGTEXT;
|
||||||
|
DECLARE v_id_change_set INT;
|
||||||
|
|
||||||
DECLARE exit handler for SQLEXCEPTION
|
DECLARE exit handler for SQLEXCEPTION
|
||||||
BEGIN
|
BEGIN
|
||||||
-- Get diagnostic information
|
-- Get diagnostic information
|
||||||
@@ -40,13 +47,9 @@ BEGIN
|
|||||||
, @text
|
, @text
|
||||||
;
|
;
|
||||||
END;
|
END;
|
||||||
DECLARE v_code_type_error_bad_data VARCHAR(100);
|
|
||||||
DECLARE v_id_type_error_bad_data INT;
|
|
||||||
DECLARE v_ids_product_permission LONGTEXT;
|
|
||||||
|
|
||||||
SET v_code_type_error_bad_data := 'BAD_DATA';
|
SET v_code_type_error_bad_data := 'BAD_DATA';
|
||||||
SET v_id_type_error_bad_data := (SELECT id_type FROM Shop_Msg_Error_Type WHERE code = v_code_type_error_bad_data LIMIT 1);
|
SET v_id_type_error_bad_data := (SELECT id_type FROM Shop_Msg_Error_Type WHERE code = v_code_type_error_bad_data LIMIT 1);
|
||||||
SET v_now := NOW();
|
|
||||||
|
|
||||||
SET a_guid := IFNULL(a_guid, UUID());
|
SET a_guid := IFNULL(a_guid, UUID());
|
||||||
|
|
||||||
@@ -165,23 +168,21 @@ BEGIN
|
|||||||
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(item SEPARATOR ',') FROM tmp_Shop_Product WHERE is_new = 0);
|
||||||
IF NOT ISNULL(v_ids_product_permission) THEN
|
IF NOT ISNULL(v_ids_product_permission) THEN
|
||||||
SET v_guid_permission = UUID();
|
|
||||||
SET v_id_user = CURRENT_USER();
|
|
||||||
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_user_eval(v_guid_permission, v_id_user, v_id_permission_product, v_ids_product_permission);
|
CALL p_shop_user_eval(a_guid, a_id_user, v_id_permission_product, v_ids_product_permission);
|
||||||
|
|
||||||
UPDATE tmp_Product t_P
|
UPDATE tmp_Product t_P
|
||||||
INNER JOIN Shop_User_Eval_Temp UE_T
|
INNER JOIN Shop_User_Eval_Temp UE_T
|
||||||
ON t_P.id_product = UE_T.id_product
|
ON t_P.id_product = UE_T.id_product
|
||||||
AND UE_T.GUID = v_guid_permission
|
AND UE_T.GUID = a_guid
|
||||||
SET
|
SET
|
||||||
t_P.can_view = UE_T.can_view
|
t_P.can_view = UE_T.can_view
|
||||||
, t_P.can_edit = UE_T.can_edit
|
, t_P.can_edit = UE_T.can_edit
|
||||||
, t_P.can_admin = UE_T.can_admin
|
, t_P.can_admin = UE_T.can_admin
|
||||||
;
|
;
|
||||||
|
|
||||||
CALL p_shop_user_eval_clear_temp(v_guid_permission);
|
CALL p_shop_user_eval_clear_temp(a_guid);
|
||||||
END IF;
|
END IF;
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ DROP PROCEDURE IF EXISTS p_shop_get_many_product;
|
|||||||
|
|
||||||
DELIMITER //
|
DELIMITER //
|
||||||
CREATE PROCEDURE p_shop_get_many_product (
|
CREATE PROCEDURE p_shop_get_many_product (
|
||||||
IN a_id_user VARCHAR(200),
|
IN a_id_user INT,
|
||||||
IN a_get_all_category BIT,
|
IN a_get_all_category BIT,
|
||||||
IN a_get_inactive_category BIT,
|
IN a_get_inactive_category BIT,
|
||||||
IN a_get_first_category_only BIT,
|
IN a_get_first_category_only BIT,
|
||||||
@@ -51,14 +51,14 @@ BEGIN
|
|||||||
DECLARE v_has_filter_delivery_region BIT;
|
DECLARE v_has_filter_delivery_region BIT;
|
||||||
DECLARE v_has_filter_currency BIT;
|
DECLARE v_has_filter_currency BIT;
|
||||||
DECLARE v_has_filter_discount BIT;
|
DECLARE v_has_filter_discount BIT;
|
||||||
DECLARE v_guid VARCHAR(36);
|
DECLARE v_guid BINARY(36);
|
||||||
# DECLARE v_id_user VARCHAR(100);
|
# DECLARE v_id_user VARCHAR(100);
|
||||||
DECLARE v_ids_permutation_unavailable VARCHAR(4000);
|
DECLARE v_ids_permutation_unavailable VARCHAR(4000);
|
||||||
DECLARE v_id_permission_product INT;
|
DECLARE v_id_permission_product INT;
|
||||||
DECLARE v_ids_product_permission VARCHAR(4000);
|
DECLARE v_ids_product_permission VARCHAR(4000);
|
||||||
-- DECLARE v_ids_permutation_permission VARCHAR(4000);
|
-- DECLARE v_ids_permutation_permission VARCHAR(4000);
|
||||||
DECLARE v_id_access_level_view INT;
|
DECLARE v_id_access_level_view INT;
|
||||||
-- DECLARE v_now DATETIME;
|
-- DECLARE v_now TIMESTAMP;
|
||||||
DECLARE v_id_minimum INT;
|
DECLARE v_id_minimum INT;
|
||||||
|
|
||||||
SET v_guid := UUID();
|
SET v_guid := UUID();
|
||||||
@@ -289,7 +289,7 @@ BEGIN
|
|||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS tmp_Msg_Error (
|
CREATE 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 VARCHAR(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
|
||||||
FOREIGN KEY (id_type)
|
FOREIGN KEY (id_type)
|
||||||
|
|||||||
@@ -16,13 +16,13 @@ DROP PROCEDURE IF EXISTS p_shop_get_many_stripe_product_new;
|
|||||||
|
|
||||||
DELIMITER //
|
DELIMITER //
|
||||||
CREATE PROCEDURE p_shop_get_many_stripe_product_new (
|
CREATE PROCEDURE p_shop_get_many_stripe_product_new (
|
||||||
IN a_id_user VARCHAR(200)
|
IN a_id_user INT
|
||||||
)
|
)
|
||||||
BEGIN
|
BEGIN
|
||||||
DECLARE v_has_filter_user BIT;
|
DECLARE v_has_filter_user BIT;
|
||||||
DECLARE v_code_error_data VARCHAR(200);
|
DECLARE v_code_error_data VARCHAR(200);
|
||||||
DECLARE v_code_error_permission VARCHAR(200);
|
DECLARE v_code_error_permission VARCHAR(200);
|
||||||
DECLARE v_guid VARCHAR(36);
|
DECLARE v_guid BINARY(36);
|
||||||
|
|
||||||
SET v_code_error_data := (SELECT code FROM Shop_Msg_Error_Type WHERE id_type = 1);
|
SET v_code_error_data := (SELECT code FROM Shop_Msg_Error_Type WHERE id_type = 1);
|
||||||
SET v_code_error_permission := (SELECT code FROM Shop_Msg_Error_Type WHERE id_type = 2);
|
SET v_code_error_permission := (SELECT code FROM Shop_Msg_Error_Type WHERE id_type = 2);
|
||||||
@@ -42,7 +42,7 @@ BEGIN
|
|||||||
DROP TABLE IF EXISTS tmp_Shop_User;
|
DROP TABLE IF EXISTS tmp_Shop_User;
|
||||||
|
|
||||||
CREATE TABLE tmp_Shop_User(
|
CREATE TABLE tmp_Shop_User(
|
||||||
id_user VARCHAR(200) NOT NULL PRIMARY KEY,
|
id_user INT NOT NULL PRIMARY KEY,
|
||||||
CONSTRAINT FK_tmp_Shop_User_id_user
|
CONSTRAINT FK_tmp_Shop_User_id_user
|
||||||
FOREIGN KEY (id_user)
|
FOREIGN KEY (id_user)
|
||||||
REFERENCES Shop_User(id_user),
|
REFERENCES Shop_User(id_user),
|
||||||
@@ -67,7 +67,7 @@ BEGIN
|
|||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS tmp_Msg_Error ( # IF NOT EXISTS
|
CREATE TABLE IF NOT EXISTS tmp_Msg_Error ( # IF NOT EXISTS
|
||||||
display_order INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
display_order INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
||||||
guid VARCHAR(36) NOT NULL,
|
guid BINARY(36) NOT NULL,
|
||||||
code VARCHAR(50) NOT NULL,
|
code VARCHAR(50) NOT NULL,
|
||||||
# CONSTRAINT chk_tmp_Msg_Error_code CHECK (code IN (SELECT code FROM Shop_Msg_Error_Type)),
|
# CONSTRAINT chk_tmp_Msg_Error_code CHECK (code IN (SELECT code FROM Shop_Msg_Error_Type)),
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ DROP TABLE IF EXISTS tmp_Msg_Error;
|
|||||||
DELIMITER //
|
DELIMITER //
|
||||||
CREATE PROCEDURE p_shop_save_permutation (
|
CREATE PROCEDURE p_shop_save_permutation (
|
||||||
IN a_guid VARCHAR(500),
|
IN a_guid VARCHAR(500),
|
||||||
IN a_id_user VARCHAR(200),
|
IN a_id_user INT,
|
||||||
IN a_id_order INT,
|
IN a_id_order INT,
|
||||||
-- IN a_id_supplier_ordered INT,
|
-- IN a_id_supplier_ordered INT,
|
||||||
IN a_id_currency_cost INT,
|
IN a_id_currency_cost INT,
|
||||||
@@ -23,7 +23,7 @@ BEGIN
|
|||||||
DECLARE v_code_error_type_bad_data VARCHAR(50);
|
DECLARE v_code_error_type_bad_data VARCHAR(50);
|
||||||
DECLARE v_id_error_type_no_permission INT;
|
DECLARE v_id_error_type_no_permission INT;
|
||||||
DECLARE v_code_error_type_no_permission VARCHAR(50);
|
DECLARE v_code_error_type_no_permission VARCHAR(50);
|
||||||
DECLARE v_guid_permission VARCHAR(36);
|
DECLARE v_guid_permission BINARY(36);
|
||||||
-- DECLARE v_id_user VARCHAR(100);
|
-- DECLARE v_id_user VARCHAR(100);
|
||||||
DECLARE v_id_permission_manufacturing_purchase_order INT;
|
DECLARE v_id_permission_manufacturing_purchase_order INT;
|
||||||
DECLARE v_id_access_level_EDIT INT;
|
DECLARE v_id_access_level_EDIT INT;
|
||||||
@@ -94,7 +94,7 @@ BEGIN
|
|||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS tmp_Msg_Error (
|
CREATE 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 VARCHAR(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
|
||||||
FOREIGN KEY (id_type)
|
FOREIGN KEY (id_type)
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ DROP PROCEDURE IF EXISTS p_shop_get_many_stock_item;
|
|||||||
|
|
||||||
DELIMITER //
|
DELIMITER //
|
||||||
CREATE PROCEDURE p_shop_get_many_stock_item (
|
CREATE PROCEDURE p_shop_get_many_stock_item (
|
||||||
IN a_id_user VARCHAR(200),
|
IN a_id_user INT,
|
||||||
IN a_get_all_category BIT,
|
IN a_get_all_category BIT,
|
||||||
IN a_get_inactive_category BIT,
|
IN a_get_inactive_category BIT,
|
||||||
IN a_get_first_category_only BIT,
|
IN a_get_first_category_only BIT,
|
||||||
@@ -37,7 +37,7 @@ CREATE PROCEDURE p_shop_get_many_stock_item (
|
|||||||
IN a_get_inactive_location_storage BIT,
|
IN a_get_inactive_location_storage BIT,
|
||||||
IN a_get_first_location_storage_only BIT,
|
IN a_get_first_location_storage_only BIT,
|
||||||
IN a_ids_location_storage TEXT,
|
IN a_ids_location_storage TEXT,
|
||||||
IN a_date_received_to DATETIME,
|
IN a_date_received_to TIMESTAMP,
|
||||||
IN a_get_sealed_stock_item_only BIT,
|
IN a_get_sealed_stock_item_only BIT,
|
||||||
IN a_get_unsealed_stock_item_only BIT,
|
IN a_get_unsealed_stock_item_only BIT,
|
||||||
IN a_get_expired_stock_item_only BIT,
|
IN a_get_expired_stock_item_only BIT,
|
||||||
@@ -55,15 +55,15 @@ BEGIN
|
|||||||
DECLARE v_has_filter_region_storage BIT;
|
DECLARE v_has_filter_region_storage BIT;
|
||||||
DECLARE v_has_filter_plant_storage BIT;
|
DECLARE v_has_filter_plant_storage BIT;
|
||||||
DECLARE v_has_filter_location_storage BIT;
|
DECLARE v_has_filter_location_storage BIT;
|
||||||
DECLARE v_guid VARCHAR(36);
|
DECLARE v_guid BINARY(36);
|
||||||
-- DECLARE v_ids_permutation_unavailable LONGTEXT;
|
-- DECLARE v_ids_permutation_unavailable LONGTEXT;
|
||||||
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_ids_permutation_permission VARCHAR(4000);
|
-- DECLARE v_ids_permutation_permission VARCHAR(4000);
|
||||||
DECLARE v_id_access_level_view INT;
|
DECLARE v_id_access_level_view INT;
|
||||||
-- DECLARE v_now DATETIME;
|
-- DECLARE v_now TIMESTAMP;
|
||||||
-- DECLARE v_id_minimum INT;
|
-- DECLARE v_id_minimum INT;
|
||||||
DECLARE v_now DATETIME;
|
DECLARE v_now TIMESTAMP;
|
||||||
|
|
||||||
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');
|
SET v_id_access_level_view := (SELECT id_access_level FROM Shop_Access_Level WHERE code = 'VIEW');
|
||||||
@@ -216,8 +216,8 @@ BEGIN
|
|||||||
FOREIGN KEY (id_category)
|
FOREIGN KEY (id_category)
|
||||||
REFERENCES Shop_Category(id_category),
|
REFERENCES Shop_Category(id_category),
|
||||||
*/
|
*/
|
||||||
, date_purchased DATETIME NOT NULL
|
, date_purchased TIMESTAMP NOT NULL
|
||||||
, date_received DATETIME NULL
|
, date_received TIMESTAMP NULL
|
||||||
, id_location_storage INT NOT NULL
|
, id_location_storage INT NOT NULL
|
||||||
/*
|
/*
|
||||||
CONSTRAINT FK_tmp_Stock_Item_id_location_storage
|
CONSTRAINT FK_tmp_Stock_Item_id_location_storage
|
||||||
@@ -233,10 +233,10 @@ BEGIN
|
|||||||
, cost_local_VAT_incl FLOAT NOT NULL
|
, cost_local_VAT_incl FLOAT NOT NULL
|
||||||
, cost_local_VAT_excl FLOAT NOT NULL
|
, cost_local_VAT_excl FLOAT NOT NULL
|
||||||
, is_sealed BIT NOT NULL DEFAULT 1
|
, is_sealed BIT NOT NULL DEFAULT 1
|
||||||
, date_unsealed DATETIME NULL
|
, date_unsealed TIMESTAMP NULL
|
||||||
, date_expiration DATETIME NOT NULL
|
, date_expiration TIMESTAMP NOT NULL
|
||||||
, is_consumed BIT NOT NULL DEFAULT 0
|
, is_consumed BIT NOT NULL DEFAULT 0
|
||||||
, date_consumed DATETIME NULL
|
, date_consumed TIMESTAMP NULL
|
||||||
, active_stock_item BIT NOT NULL DEFAULT 1
|
, active_stock_item BIT NOT NULL DEFAULT 1
|
||||||
, active_permutation BIT NOT NULL
|
, active_permutation BIT NOT NULL
|
||||||
, active_product BIT NOT NULL
|
, active_product BIT NOT NULL
|
||||||
@@ -284,7 +284,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 VARCHAR(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
|
||||||
@@ -798,8 +798,9 @@ BEGIN
|
|||||||
END //
|
END //
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
|
||||||
|
/*
|
||||||
CALL p_shop_get_many_stock_item (
|
CALL p_shop_get_many_stock_item (
|
||||||
'', # a_id_user
|
0, # a_id_user
|
||||||
1, # a_get_all_category
|
1, # a_get_all_category
|
||||||
0, # a_get_inactive_category
|
0, # a_get_inactive_category
|
||||||
0, # a_get_first_category_only
|
0, # a_get_first_category_only
|
||||||
@@ -837,7 +838,6 @@ CALL p_shop_get_many_stock_item (
|
|||||||
0 # a_get_nonconsumed_stock_item_only
|
0 # a_get_nonconsumed_stock_item_only
|
||||||
);
|
);
|
||||||
|
|
||||||
/*
|
|
||||||
|
|
||||||
DROP TABLE IF EXISTS tmp_Msg_Error;
|
DROP TABLE IF EXISTS tmp_Msg_Error;
|
||||||
|
|
||||||
|
|||||||
@@ -16,13 +16,13 @@ DROP PROCEDURE IF EXISTS p_shop_get_many_stripe_price_new;
|
|||||||
|
|
||||||
DELIMITER //
|
DELIMITER //
|
||||||
CREATE PROCEDURE p_shop_get_many_stripe_price_new (
|
CREATE PROCEDURE p_shop_get_many_stripe_price_new (
|
||||||
IN a_id_user VARCHAR(200)
|
IN a_id_user INT
|
||||||
)
|
)
|
||||||
BEGIN
|
BEGIN
|
||||||
DECLARE v_has_filter_user BIT;
|
DECLARE v_has_filter_user BIT;
|
||||||
DECLARE v_code_error_data VARCHAR(200);
|
DECLARE v_code_error_data VARCHAR(200);
|
||||||
DECLARE v_code_error_permission VARCHAR(200);
|
DECLARE v_code_error_permission VARCHAR(200);
|
||||||
DECLARE v_guid VARCHAR(36);
|
DECLARE v_guid BINARY(36);
|
||||||
|
|
||||||
SET v_code_error_data := (SELECT code FROM Shop_Msg_Error_Type WHERE id_type = 1);
|
SET v_code_error_data := (SELECT code FROM Shop_Msg_Error_Type WHERE id_type = 1);
|
||||||
SET v_code_error_permission := (SELECT code FROM Shop_Msg_Error_Type WHERE id_type = 2);
|
SET v_code_error_permission := (SELECT code FROM Shop_Msg_Error_Type WHERE id_type = 2);
|
||||||
@@ -43,7 +43,7 @@ BEGIN
|
|||||||
DROP TABLE IF EXISTS tmp_Shop_User;
|
DROP TABLE IF EXISTS tmp_Shop_User;
|
||||||
|
|
||||||
CREATE TABLE tmp_Shop_User(
|
CREATE TABLE tmp_Shop_User(
|
||||||
id_user VARCHAR(200) NOT NULL PRIMARY KEY,
|
id_user INT NOT NULL PRIMARY KEY,
|
||||||
CONSTRAINT FK_tmp_Shop_User_id_user
|
CONSTRAINT FK_tmp_Shop_User_id_user
|
||||||
FOREIGN KEY (id_user)
|
FOREIGN KEY (id_user)
|
||||||
REFERENCES Shop_User(id_user),
|
REFERENCES Shop_User(id_user),
|
||||||
@@ -72,7 +72,7 @@ BEGIN
|
|||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS tmp_Msg_Error ( # IF NOT EXISTS
|
CREATE TABLE IF NOT EXISTS tmp_Msg_Error ( # IF NOT EXISTS
|
||||||
display_order INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
display_order INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
||||||
guid VARCHAR(36) NOT NULL,
|
guid BINARY(36) NOT NULL,
|
||||||
code VARCHAR(50) NOT NULL,
|
code VARCHAR(50) NOT NULL,
|
||||||
# CONSTRAINT chk_tmp_Msg_Error_code CHECK (code IN (SELECT code FROM Shop_Msg_Error_Type)),
|
# CONSTRAINT chk_tmp_Msg_Error_code CHECK (code IN (SELECT code FROM Shop_Msg_Error_Type)),
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ DROP PROCEDURE IF EXISTS p_shop_edit_user;
|
|||||||
|
|
||||||
DELIMITER //
|
DELIMITER //
|
||||||
CREATE PROCEDURE p_shop_edit_user (
|
CREATE PROCEDURE p_shop_edit_user (
|
||||||
IN a_id_user VARCHAR(200),
|
IN a_id_user INT,
|
||||||
IN a_name VARCHAR(255),
|
IN a_name VARCHAR(255),
|
||||||
IN a_email VARCHAR(254),
|
IN a_email VARCHAR(254),
|
||||||
IN a_email_verified BIT
|
IN a_email_verified BIT
|
||||||
@@ -28,7 +28,7 @@ BEGIN
|
|||||||
-- Argument redeclaration
|
-- Argument redeclaration
|
||||||
-- Variable declaration
|
-- Variable declaration
|
||||||
DECLARE v_has_filter_user BIT;
|
DECLARE v_has_filter_user BIT;
|
||||||
-- DECLARE v_now DATETIME;
|
-- DECLARE v_now TIMESTAMP;
|
||||||
|
|
||||||
|
|
||||||
-- Argument validation + default values
|
-- Argument validation + default values
|
||||||
@@ -56,7 +56,7 @@ BEGIN
|
|||||||
DROP TABLE IF EXISTS tmp_Shop_User;
|
DROP TABLE IF EXISTS tmp_Shop_User;
|
||||||
|
|
||||||
CREATE TABLE tmp_Shop_User (
|
CREATE TABLE tmp_Shop_User (
|
||||||
id_user VARCHAR(200) NOT NULL,
|
id_user INT NOT NULL,
|
||||||
CONSTRAINT FK_tmp_Shop_User_id_user
|
CONSTRAINT FK_tmp_Shop_User_id_user
|
||||||
FOREIGN KEY (id_user)
|
FOREIGN KEY (id_user)
|
||||||
REFERENCES Shop_User(id_user),
|
REFERENCES Shop_User(id_user),
|
||||||
|
|||||||
231
static/MySQL/7313_p_get_many_user.sql
Normal file
231
static/MySQL/7313_p_get_many_user.sql
Normal file
@@ -0,0 +1,231 @@
|
|||||||
|
|
||||||
|
USE PARTSLTD_PROD;
|
||||||
|
|
||||||
|
|
||||||
|
-- Clear previous proc
|
||||||
|
DROP PROCEDURE IF EXISTS p_get_many_user;
|
||||||
|
|
||||||
|
|
||||||
|
DELIMITER //
|
||||||
|
CREATE PROCEDURE p_get_many_user (
|
||||||
|
IN a_id_user INT
|
||||||
|
, IN a_get_all_user BIT
|
||||||
|
, IN a_get_inactive_user BIT
|
||||||
|
, IN a_get_first_user_only BIT
|
||||||
|
, IN a_ids_user LONGTEXT
|
||||||
|
, IN a_ids_user_auth0 LONGTEXT
|
||||||
|
)
|
||||||
|
BEGIN
|
||||||
|
DECLARE v_id_access_level_view INT;
|
||||||
|
DECLARE v_id_permission_store_admin INT;
|
||||||
|
DECLARE v_id_permission_user INT;
|
||||||
|
DECLARE v_id_permission_user_admin INT;
|
||||||
|
DECLARE v_now TIMESTAMP;
|
||||||
|
DECLARE v_id_minimum INT;
|
||||||
|
DECLARE v_code_error_data VARCHAR(50);
|
||||||
|
DECLARE v_id_type_error_data INT;
|
||||||
|
DECLARE v_has_filter_user BIT;
|
||||||
|
DECLARE v_guid BINARY(36);
|
||||||
|
|
||||||
|
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_permission_store_admin := (SELECT id_permission FROM Shop_Permission WHERE code = 'STORE_ADMIN' LIMIT 1);
|
||||||
|
SET v_id_permission_user := (SELECT id_permission FROM Shop_Permission WHERE code = 'STORE_USER' LIMIT 1);
|
||||||
|
SET v_id_permission_user_admin := (SELECT id_permission FROM Shop_Permission WHERE code = 'STORE_USER_ADMIN' LIMIT 1);
|
||||||
|
SET v_code_error_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 a_ids_user := TRIM(IFNULL(a_ids_user, ''));
|
||||||
|
SET a_ids_user_auth0 := TRIM(IFNULL(a_ids_user_auth0, ''));
|
||||||
|
|
||||||
|
DROP TEMPORARY TABLE IF EXISTS tmp_User;
|
||||||
|
DROP TEMPORARY TABLE IF EXISTS tmp_Msg_Error;
|
||||||
|
|
||||||
|
CREATE TEMPORARY TABLE tmp_User (
|
||||||
|
id_user INT NOT NULL,
|
||||||
|
rank_user INT NULL
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE TEMPORARY TABLE tmp_Msg_Error (
|
||||||
|
display_order INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
||||||
|
guid BINARY(36) NOT NULL,
|
||||||
|
id_type INT NOT NULL,
|
||||||
|
code VARCHAR(50) NOT NULL,
|
||||||
|
msg VARCHAR(4000) NOT NULL
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
SET v_has_filter_user := CASE WHEN a_ids_user = '' AND a_ids_user_auth0= '' THEN 0 ELSE 1 END;
|
||||||
|
|
||||||
|
IF v_has_filter_user THEN
|
||||||
|
INSERT INTO tmp_User (
|
||||||
|
id_user
|
||||||
|
-- , active
|
||||||
|
, rank_user
|
||||||
|
)
|
||||||
|
SELECT
|
||||||
|
DISTINCT U.id_user
|
||||||
|
-- S.active
|
||||||
|
, RANK() OVER (ORDER BY id_user ASC) AS rank_user
|
||||||
|
FROM Shop_User U
|
||||||
|
WHERE 1=1
|
||||||
|
AND (
|
||||||
|
FIND_IN_SET(U.id_user, a_ids_user) > 0
|
||||||
|
OR FIND_IN_SET(U.id_user_auth0, a_ids_user_auth0) > 0
|
||||||
|
)
|
||||||
|
AND (
|
||||||
|
a_get_inactive_user
|
||||||
|
OR U.active
|
||||||
|
)
|
||||||
|
/*Shop_User_Eval_Temp UE_T
|
||||||
|
WHERE 1=1
|
||||||
|
AND UE_T.guid = v_guid
|
||||||
|
AND UE_T.active = 1
|
||||||
|
*/
|
||||||
|
;
|
||||||
|
|
||||||
|
IF a_get_first_user_only THEN
|
||||||
|
DELETE FROM tmp_User t_U
|
||||||
|
WHERE t_U.rank_user > 1
|
||||||
|
;
|
||||||
|
END IF;
|
||||||
|
END IF;
|
||||||
|
|
||||||
|
-- Permissions
|
||||||
|
IF NOT EXISTS (SELECT * FROM tmp_Msg_Error LIMIT 1) THEN
|
||||||
|
-- SELECT v_guid, a_id_user, false, v_id_permission_product, v_id_access_level_view, v_ids_permutation_permission;
|
||||||
|
-- select * from Shop_User_Eval_Temp;
|
||||||
|
|
||||||
|
CALL p_shop_user_eval(
|
||||||
|
v_guid, -- guid
|
||||||
|
a_id_user, -- ids_user
|
||||||
|
FALSE, -- get_inactive_user
|
||||||
|
CONCAT(v_id_permission_user, ',', v_id_permission_user_admin, ',', v_id_permission_store_admin), -- ids_permission
|
||||||
|
v_id_access_level_view, -- ids_access_level
|
||||||
|
'' -- ids_product
|
||||||
|
);
|
||||||
|
|
||||||
|
-- select * from Shop_User_Eval_Temp;
|
||||||
|
|
||||||
|
IF NOT EXISTS (
|
||||||
|
SELECT can_view
|
||||||
|
FROM Shop_User_Eval_Temp UE_T
|
||||||
|
WHERE 1=1
|
||||||
|
AND UE_T.GUID = v_guid
|
||||||
|
AND UE_T.id_permission_required = v_id_permission_user
|
||||||
|
) THEN
|
||||||
|
INSERT INTO tmp_Msg_Error (
|
||||||
|
guid,
|
||||||
|
id_type,
|
||||||
|
code,
|
||||||
|
msg
|
||||||
|
)
|
||||||
|
VALUES (
|
||||||
|
v_guid,
|
||||||
|
v_id_type_error_data,
|
||||||
|
v_code_error_data,
|
||||||
|
CONCAT('You do not have view permissions for ', (SELECT name FROM Shop_Permission WHERE id_permission = v_id_permission_user LIMIT 1))
|
||||||
|
)
|
||||||
|
;
|
||||||
|
END IF;
|
||||||
|
END IF;
|
||||||
|
|
||||||
|
|
||||||
|
-- Returns
|
||||||
|
/* NULL record required for flask sql_alchemy to detect result set
|
||||||
|
IF EXISTS (SELECT * FROM tmp_Msg_Error WHERE GUID = v_guid) THEN
|
||||||
|
DELETE FROM tmp_User;
|
||||||
|
END IF;
|
||||||
|
*/
|
||||||
|
|
||||||
|
IF NOT EXISTS (SELECT * FROM tmp_Msg_Error WHERE GUID = v_guid) THEN
|
||||||
|
SELECT
|
||||||
|
U.id_user
|
||||||
|
, U.id_user_auth0
|
||||||
|
, U.firstname
|
||||||
|
, U.surname
|
||||||
|
, U.email
|
||||||
|
, U.is_email_verified
|
||||||
|
, U.id_currency_default
|
||||||
|
, U.id_region_default
|
||||||
|
, U.is_included_VAT_default
|
||||||
|
, U.is_super_user
|
||||||
|
, UE_T_STORE.can_admin_store AS can_admin_store
|
||||||
|
, UE_T_USER.can_admin_user AS can_admin_user
|
||||||
|
FROM tmp_User t_U
|
||||||
|
INNER JOIN Shop_User U ON t_U.id_user = U.id_user
|
||||||
|
INNER JOIN (
|
||||||
|
SELECT
|
||||||
|
id_user
|
||||||
|
, id_permission_required
|
||||||
|
, can_admin AS can_admin_store
|
||||||
|
FROM Shop_User_Eval_Temp UE_T_STORE
|
||||||
|
WHERE 1=1
|
||||||
|
AND UE_T_STORE.guid = v_guid
|
||||||
|
AND UE_T_STORE.id_permission_required = v_id_permission_store_admin
|
||||||
|
) UE_T_STORE ON t_U.id_user = UE_T_STORE.id_user
|
||||||
|
INNER JOIN (
|
||||||
|
SELECT
|
||||||
|
id_user
|
||||||
|
, id_permission_required
|
||||||
|
, can_admin AS can_admin_user
|
||||||
|
FROM Shop_User_Eval_Temp UE_T_USER
|
||||||
|
WHERE 1=1
|
||||||
|
AND UE_T_USER.guid = v_guid
|
||||||
|
AND UE_T_USER.id_permission_required = v_id_permission_user_admin
|
||||||
|
) UE_T_USER ON t_U.id_user = UE_T_USER.id_user
|
||||||
|
;
|
||||||
|
ELSE
|
||||||
|
SELECT
|
||||||
|
NULL AS id_user
|
||||||
|
, NULL AS id_user_auth0
|
||||||
|
, NULL AS firstname
|
||||||
|
, NULL AS surname
|
||||||
|
, NULL AS email
|
||||||
|
, NULL AS is_email_verified
|
||||||
|
, NULL AS id_currency_default
|
||||||
|
, NULL AS id_region_default
|
||||||
|
, NULL AS is_included_VAT_default
|
||||||
|
, NULL AS is_super_user
|
||||||
|
, NULL AS can_admin_store
|
||||||
|
, NULL AS can_admin_user
|
||||||
|
;
|
||||||
|
END IF;
|
||||||
|
|
||||||
|
# Errors
|
||||||
|
SELECT
|
||||||
|
t_ME.display_order,
|
||||||
|
MET.code,
|
||||||
|
t_ME.msg,
|
||||||
|
MET.name,
|
||||||
|
MET.description
|
||||||
|
FROM tmp_Msg_Error t_ME
|
||||||
|
INNER JOIN Shop_Msg_Error_Type MET
|
||||||
|
ON t_ME.id_type = MET.id_type
|
||||||
|
WHERE guid = v_guid
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
-- Clean up
|
||||||
|
DROP TEMPORARY TABLE IF EXISTS tmp_User;
|
||||||
|
DROP TEMPORARY TABLE IF EXISTS tmp_Msg_Error;
|
||||||
|
|
||||||
|
DELETE FROM Shop_User_Eval_Temp
|
||||||
|
WHERE GUID = v_guid
|
||||||
|
;
|
||||||
|
END //
|
||||||
|
DELIMITER ;
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
CALL p_get_many_user (
|
||||||
|
NULL # a_id_user
|
||||||
|
, 0 # a_get_all_user
|
||||||
|
, 0 # a_get_inactive_user
|
||||||
|
, 0 # a_get_first_user_only
|
||||||
|
, NULL # a_ids_user
|
||||||
|
, '' -- auth0|6582b95c895d09a70ba10fef' # a_ids_user_auth0
|
||||||
|
);
|
||||||
|
|
||||||
|
*/
|
||||||
@@ -23,7 +23,7 @@ DROP PROCEDURE IF EXISTS p_shop_edit_user_basket;
|
|||||||
|
|
||||||
DELIMITER //
|
DELIMITER //
|
||||||
CREATE PROCEDURE p_shop_edit_user_basket (
|
CREATE PROCEDURE p_shop_edit_user_basket (
|
||||||
IN a_id_user VARCHAR(200),
|
IN a_id_user INT,
|
||||||
IN a_ids_permutation_basket VARCHAR(4000),
|
IN a_ids_permutation_basket VARCHAR(4000),
|
||||||
IN a_quantities_permutation_basket VARCHAR(4000),
|
IN a_quantities_permutation_basket VARCHAR(4000),
|
||||||
IN a_id_permutation_edit INT,
|
IN a_id_permutation_edit INT,
|
||||||
@@ -43,11 +43,11 @@ BEGIN
|
|||||||
DECLARE v_n_id_permutation_basket INT;
|
DECLARE v_n_id_permutation_basket INT;
|
||||||
DECLARE v_n_quantity_permutation_basket INT;
|
DECLARE v_n_quantity_permutation_basket INT;
|
||||||
DECLARE v_row_number INT;
|
DECLARE v_row_number INT;
|
||||||
DECLARE v_guid VARCHAR(36);
|
DECLARE v_guid BINARY(36);
|
||||||
# DECLARE v_id_user VARCHAR(100);
|
# DECLARE v_id_user VARCHAR(100);
|
||||||
DECLARE v_id_permission_product INT;
|
DECLARE v_id_permission_product INT;
|
||||||
DECLARE v_ids_permutation_permission VARCHAR(4000);
|
DECLARE v_ids_permutation_permission VARCHAR(4000);
|
||||||
DECLARE v_now DATETIME;
|
DECLARE v_now TIMESTAMP;
|
||||||
# DECLARE v_quantity_new INT;
|
# DECLARE v_quantity_new INT;
|
||||||
DECLARE v_change_set_used BIT;
|
DECLARE v_change_set_used BIT;
|
||||||
DECLARE v_id_change_set INT;
|
DECLARE v_id_change_set INT;
|
||||||
@@ -82,7 +82,7 @@ BEGIN
|
|||||||
DROP TABLE IF EXISTS tmp_Shop_User;
|
DROP TABLE IF EXISTS tmp_Shop_User;
|
||||||
|
|
||||||
CREATE TABLE tmp_Shop_User (
|
CREATE TABLE tmp_Shop_User (
|
||||||
id_user VARCHAR(200) NOT NULL,
|
id_user INT NOT NULL,
|
||||||
CONSTRAINT FK_tmp_Shop_User_id_user
|
CONSTRAINT FK_tmp_Shop_User_id_user
|
||||||
FOREIGN KEY (id_user)
|
FOREIGN KEY (id_user)
|
||||||
REFERENCES Shop_User(id_user),
|
REFERENCES Shop_User(id_user),
|
||||||
@@ -139,7 +139,7 @@ BEGIN
|
|||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS tmp_Msg_Error (
|
CREATE 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 VARCHAR(36) NOT NULL,
|
guid BINARY(36) NOT NULL,
|
||||||
id_type INT NOT NULL,
|
id_type INT NOT NULL,
|
||||||
# code VARCHAR(50) NOT NULL,
|
# code VARCHAR(50) NOT NULL,
|
||||||
# CONSTRAINT chk_tmp_Msg_Error_code CHECK (code IN (SELECT code FROM Shop_Msg_Error_Type)),
|
# CONSTRAINT chk_tmp_Msg_Error_code CHECK (code IN (SELECT code FROM Shop_Msg_Error_Type)),
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ DROP PROCEDURE IF EXISTS p_shop_save_supplier;
|
|||||||
DELIMITER //
|
DELIMITER //
|
||||||
CREATE PROCEDURE p_shop_save_supplier (
|
CREATE PROCEDURE p_shop_save_supplier (
|
||||||
IN a_guid VARCHAR(500),
|
IN a_guid VARCHAR(500),
|
||||||
IN a_id_user VARCHAR(200),
|
IN a_id_user INT,
|
||||||
IN a_comment VARCHAR(500),
|
IN a_comment VARCHAR(500),
|
||||||
IN a_id_supplier INT,
|
IN a_id_supplier INT,
|
||||||
IN a_name_company VARCHAR(256),
|
IN a_name_company VARCHAR(256),
|
||||||
@@ -26,7 +26,7 @@ CREATE PROCEDURE p_shop_save_supplier (
|
|||||||
BEGIN
|
BEGIN
|
||||||
DECLARE v_id_error_type_bad_data INT;
|
DECLARE v_id_error_type_bad_data INT;
|
||||||
DECLARE v_id_error_type_no_permission INT;
|
DECLARE v_id_error_type_no_permission INT;
|
||||||
DECLARE v_guid_permission VARCHAR(36);
|
DECLARE v_guid_permission BINARY(36);
|
||||||
DECLARE v_id_user VARCHAR(100);
|
DECLARE v_id_user VARCHAR(100);
|
||||||
DECLARE v_id_permission_supplier INT;
|
DECLARE v_id_permission_supplier INT;
|
||||||
-- DECLARE v_id_access_level_EDIT INT;
|
-- DECLARE v_id_access_level_EDIT INT;
|
||||||
@@ -74,7 +74,7 @@ BEGIN
|
|||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS tmp_Msg_Error (
|
CREATE 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 VARCHAR(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
|
||||||
FOREIGN KEY (id_type)
|
FOREIGN KEY (id_type)
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ DROP PROCEDURE IF EXISTS p_shop_get_many_supplier;
|
|||||||
|
|
||||||
DELIMITER //
|
DELIMITER //
|
||||||
CREATE PROCEDURE p_shop_get_many_supplier (
|
CREATE PROCEDURE p_shop_get_many_supplier (
|
||||||
IN a_id_user VARCHAR(200),
|
IN a_id_user INT,
|
||||||
IN a_get_all_supplier BIT,
|
IN a_get_all_supplier BIT,
|
||||||
IN a_get_inactive_supplier BIT,
|
IN a_get_inactive_supplier BIT,
|
||||||
IN a_get_first_supplier_only BIT,
|
IN a_get_first_supplier_only BIT,
|
||||||
@@ -30,14 +30,14 @@ BEGIN
|
|||||||
-- Argument redeclaration
|
-- Argument redeclaration
|
||||||
-- Variable declaration
|
-- Variable declaration
|
||||||
DECLARE v_has_filter_supplier BIT;
|
DECLARE v_has_filter_supplier BIT;
|
||||||
DECLARE v_guid VARCHAR(36);
|
DECLARE v_guid BINARY(36);
|
||||||
# DECLARE v_id_user VARCHAR(100);
|
# DECLARE v_id_user VARCHAR(100);
|
||||||
# DECLARE v_ids_permutation_unavailable VARCHAR(4000);
|
# DECLARE v_ids_permutation_unavailable VARCHAR(4000);
|
||||||
DECLARE v_id_permission_supplier INT;
|
DECLARE v_id_permission_supplier INT;
|
||||||
# DECLARE v_ids_product_permission VARCHAR(4000);
|
# DECLARE v_ids_product_permission VARCHAR(4000);
|
||||||
# DECLARE v_ids_permutation_permission VARCHAR(4000);
|
# DECLARE v_ids_permutation_permission VARCHAR(4000);
|
||||||
DECLARE v_id_access_level_view INT;
|
DECLARE v_id_access_level_view INT;
|
||||||
DECLARE v_now DATETIME;
|
DECLARE v_now TIMESTAMP;
|
||||||
DECLARE v_id_minimum INT;
|
DECLARE v_id_minimum INT;
|
||||||
DECLARE v_code_error_data VARCHAR(50);
|
DECLARE v_code_error_data VARCHAR(50);
|
||||||
|
|
||||||
@@ -81,7 +81,7 @@ BEGIN
|
|||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS tmp_Msg_Error (
|
CREATE 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 VARCHAR(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
|
||||||
FOREIGN KEY (id_type)
|
FOREIGN KEY (id_type)
|
||||||
@@ -266,4 +266,4 @@ insert into shop_product_change_set (comment)
|
|||||||
set is_subscription = 0,
|
set is_subscription = 0,
|
||||||
id_change_set = (select id_change_set from shop_product_change_set order by id_change_set desc limit 1)
|
id_change_set = (select id_change_set from shop_product_change_set order by id_change_set desc limit 1)
|
||||||
where id_product = 1
|
where id_product = 1
|
||||||
*/
|
*/
|
||||||
@@ -11,7 +11,7 @@ DROP TABLE IF EXISTS tmp_Msg_Error;
|
|||||||
DELIMITER //
|
DELIMITER //
|
||||||
CREATE PROCEDURE p_shop_save_supplier_purchase_order (
|
CREATE PROCEDURE p_shop_save_supplier_purchase_order (
|
||||||
IN a_guid VARCHAR(500),
|
IN a_guid VARCHAR(500),
|
||||||
IN a_id_user VARCHAR(200),
|
IN a_id_user INT,
|
||||||
IN a_comment VARCHAR(500),
|
IN a_comment VARCHAR(500),
|
||||||
IN a_id_order INT,
|
IN a_id_order INT,
|
||||||
IN a_id_supplier_ordered INT,
|
IN a_id_supplier_ordered INT,
|
||||||
@@ -23,7 +23,7 @@ BEGIN
|
|||||||
DECLARE v_code_error_type_bad_data VARCHAR(50);
|
DECLARE v_code_error_type_bad_data VARCHAR(50);
|
||||||
DECLARE v_id_error_type_no_permission INT;
|
DECLARE v_id_error_type_no_permission INT;
|
||||||
DECLARE v_code_error_type_no_permission VARCHAR(50);
|
DECLARE v_code_error_type_no_permission VARCHAR(50);
|
||||||
DECLARE v_guid_permission VARCHAR(36);
|
DECLARE v_guid_permission BINARY(36);
|
||||||
-- DECLARE v_id_user VARCHAR(100);
|
-- DECLARE v_id_user VARCHAR(100);
|
||||||
DECLARE v_id_permission_supplier_purchase_order INT;
|
DECLARE v_id_permission_supplier_purchase_order INT;
|
||||||
DECLARE v_id_access_level_EDIT INT;
|
DECLARE v_id_access_level_EDIT INT;
|
||||||
@@ -95,7 +95,7 @@ BEGIN
|
|||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS tmp_Msg_Error (
|
CREATE 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 VARCHAR(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
|
||||||
FOREIGN KEY (id_type)
|
FOREIGN KEY (id_type)
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ DROP PROCEDURE IF EXISTS p_shop_get_many_supplier_purchase_order;
|
|||||||
|
|
||||||
DELIMITER //
|
DELIMITER //
|
||||||
CREATE PROCEDURE p_shop_get_many_supplier_purchase_order (
|
CREATE PROCEDURE p_shop_get_many_supplier_purchase_order (
|
||||||
IN a_id_user VARCHAR(200),
|
IN a_id_user INT,
|
||||||
IN a_get_all_supplier BIT,
|
IN a_get_all_supplier BIT,
|
||||||
IN a_get_inactive_supplier BIT,
|
IN a_get_inactive_supplier BIT,
|
||||||
IN a_get_first_supplier_only BIT,
|
IN a_get_first_supplier_only BIT,
|
||||||
@@ -23,8 +23,8 @@ CREATE PROCEDURE p_shop_get_many_supplier_purchase_order (
|
|||||||
IN a_ids_product VARCHAR(4000),
|
IN a_ids_product VARCHAR(4000),
|
||||||
IN a_get_inactive_permutation BIT,
|
IN a_get_inactive_permutation BIT,
|
||||||
IN a_ids_permutation VARCHAR(4000),
|
IN a_ids_permutation VARCHAR(4000),
|
||||||
IN a_date_from DATETIME,
|
IN a_date_from TIMESTAMP,
|
||||||
IN a_date_to DATETIME
|
IN a_date_to TIMESTAMP
|
||||||
)
|
)
|
||||||
BEGIN
|
BEGIN
|
||||||
-- Argument redeclaration
|
-- Argument redeclaration
|
||||||
@@ -36,14 +36,14 @@ BEGIN
|
|||||||
DECLARE v_has_filter_permutation BIT;
|
DECLARE v_has_filter_permutation BIT;
|
||||||
DECLARE v_has_filter_date_from BIT;
|
DECLARE v_has_filter_date_from BIT;
|
||||||
DECLARE v_has_filter_date_to BIT;
|
DECLARE v_has_filter_date_to BIT;
|
||||||
DECLARE v_guid VARCHAR(36);
|
DECLARE v_guid BINARY(36);
|
||||||
# DECLARE v_id_user VARCHAR(100);
|
# DECLARE v_id_user VARCHAR(100);
|
||||||
# DECLARE v_ids_permutation_unavailable VARCHAR(4000);
|
# DECLARE v_ids_permutation_unavailable VARCHAR(4000);
|
||||||
DECLARE v_ids_permission_supplier_purchase_order VARCHAR(4000);
|
DECLARE v_ids_permission_supplier_purchase_order VARCHAR(4000);
|
||||||
DECLARE v_ids_product_permission VARCHAR(4000);
|
DECLARE v_ids_product_permission VARCHAR(4000);
|
||||||
# DECLARE v_ids_permutation_permission VARCHAR(4000);
|
# DECLARE v_ids_permutation_permission VARCHAR(4000);
|
||||||
DECLARE v_id_access_level_view INT;
|
DECLARE v_id_access_level_view INT;
|
||||||
-- DECLARE v_now DATETIME;
|
-- DECLARE v_now TIMESTAMP;
|
||||||
-- DECLARE v_id_minimum INT;
|
-- DECLARE v_id_minimum INT;
|
||||||
DECLARE v_code_error_data VARCHAR(50);
|
DECLARE v_code_error_data VARCHAR(50);
|
||||||
DECLARE v_id_type_error_data INT;
|
DECLARE v_id_type_error_data INT;
|
||||||
@@ -216,7 +216,7 @@ BEGIN
|
|||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS tmp_Msg_Error (
|
CREATE 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 VARCHAR(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
|
||||||
FOREIGN KEY (id_type)
|
FOREIGN KEY (id_type)
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ DROP TABLE IF EXISTS tmp_Msg_Error;
|
|||||||
DELIMITER //
|
DELIMITER //
|
||||||
CREATE PROCEDURE p_shop_save_manufacturing_purchase_order (
|
CREATE PROCEDURE p_shop_save_manufacturing_purchase_order (
|
||||||
IN a_guid VARCHAR(500),
|
IN a_guid VARCHAR(500),
|
||||||
IN a_id_user VARCHAR(200),
|
IN a_id_user INT,
|
||||||
IN a_id_order INT,
|
IN a_id_order INT,
|
||||||
-- IN a_id_supplier_ordered INT,
|
-- IN a_id_supplier_ordered INT,
|
||||||
IN a_id_currency_cost INT,
|
IN a_id_currency_cost INT,
|
||||||
@@ -23,7 +23,7 @@ BEGIN
|
|||||||
DECLARE v_code_error_type_bad_data VARCHAR(50);
|
DECLARE v_code_error_type_bad_data VARCHAR(50);
|
||||||
DECLARE v_id_error_type_no_permission INT;
|
DECLARE v_id_error_type_no_permission INT;
|
||||||
DECLARE v_code_error_type_no_permission VARCHAR(50);
|
DECLARE v_code_error_type_no_permission VARCHAR(50);
|
||||||
DECLARE v_guid_permission VARCHAR(36);
|
DECLARE v_guid_permission BINARY(36);
|
||||||
-- DECLARE v_id_user VARCHAR(100);
|
-- DECLARE v_id_user VARCHAR(100);
|
||||||
DECLARE v_id_permission_manufacturing_purchase_order INT;
|
DECLARE v_id_permission_manufacturing_purchase_order INT;
|
||||||
DECLARE v_id_access_level_EDIT INT;
|
DECLARE v_id_access_level_EDIT INT;
|
||||||
@@ -94,7 +94,7 @@ BEGIN
|
|||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS tmp_Msg_Error (
|
CREATE 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 VARCHAR(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
|
||||||
FOREIGN KEY (id_type)
|
FOREIGN KEY (id_type)
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ DROP PROCEDURE IF EXISTS p_shop_get_many_manufacturing_purchase_order;
|
|||||||
|
|
||||||
DELIMITER //
|
DELIMITER //
|
||||||
CREATE PROCEDURE p_shop_get_many_manufacturing_purchase_order (
|
CREATE PROCEDURE p_shop_get_many_manufacturing_purchase_order (
|
||||||
IN a_id_user VARCHAR(200),
|
IN a_id_user INT,
|
||||||
IN a_get_all_order BIT,
|
IN a_get_all_order BIT,
|
||||||
-- IN a_get_inactive_order BIT,
|
-- IN a_get_inactive_order BIT,
|
||||||
IN a_get_first_order_only BIT,
|
IN a_get_first_order_only BIT,
|
||||||
@@ -19,8 +19,8 @@ CREATE PROCEDURE p_shop_get_many_manufacturing_purchase_order (
|
|||||||
IN a_ids_product VARCHAR(4000),
|
IN a_ids_product VARCHAR(4000),
|
||||||
IN a_get_inactive_permutation BIT,
|
IN a_get_inactive_permutation BIT,
|
||||||
IN a_ids_permutation VARCHAR(4000),
|
IN a_ids_permutation VARCHAR(4000),
|
||||||
IN a_date_from DATETIME,
|
IN a_date_from TIMESTAMP,
|
||||||
IN a_date_to DATETIME
|
IN a_date_to TIMESTAMP
|
||||||
)
|
)
|
||||||
BEGIN
|
BEGIN
|
||||||
-- Argument redeclaration
|
-- Argument redeclaration
|
||||||
@@ -31,14 +31,14 @@ BEGIN
|
|||||||
DECLARE v_has_filter_permutation BIT;
|
DECLARE v_has_filter_permutation BIT;
|
||||||
DECLARE v_has_filter_date_from BIT;
|
DECLARE v_has_filter_date_from BIT;
|
||||||
DECLARE v_has_filter_date_to BIT;
|
DECLARE v_has_filter_date_to BIT;
|
||||||
DECLARE v_guid VARCHAR(36);
|
DECLARE v_guid BINARY(36);
|
||||||
# DECLARE v_id_user VARCHAR(100);
|
# DECLARE v_id_user VARCHAR(100);
|
||||||
# DECLARE v_ids_permutation_unavailable VARCHAR(4000);
|
# DECLARE v_ids_permutation_unavailable VARCHAR(4000);
|
||||||
DECLARE v_ids_permission_manufacturing_purchase_order VARCHAR(4000);
|
DECLARE v_ids_permission_manufacturing_purchase_order VARCHAR(4000);
|
||||||
DECLARE v_ids_product_permission VARCHAR(4000);
|
DECLARE v_ids_product_permission VARCHAR(4000);
|
||||||
# DECLARE v_ids_permutation_permission VARCHAR(4000);
|
# DECLARE v_ids_permutation_permission VARCHAR(4000);
|
||||||
DECLARE v_id_access_level_view INT;
|
DECLARE v_id_access_level_view INT;
|
||||||
-- DECLARE v_now DATETIME;
|
-- DECLARE v_now TIMESTAMP;
|
||||||
-- DECLARE v_id_minimum INT;
|
-- DECLARE v_id_minimum INT;
|
||||||
DECLARE v_code_error_data VARCHAR(50);
|
DECLARE v_code_error_data VARCHAR(50);
|
||||||
DECLARE v_id_type_error_data INT;
|
DECLARE v_id_type_error_data INT;
|
||||||
@@ -189,7 +189,7 @@ BEGIN
|
|||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS tmp_Msg_Error (
|
CREATE 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 VARCHAR(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
|
||||||
FOREIGN KEY (id_type)
|
FOREIGN KEY (id_type)
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ DROP PROCEDURE IF EXISTS p_shop_save_customer;
|
|||||||
DELIMITER //
|
DELIMITER //
|
||||||
CREATE PROCEDURE p_shop_save_customer (
|
CREATE PROCEDURE p_shop_save_customer (
|
||||||
IN a_guid VARCHAR(500),
|
IN a_guid VARCHAR(500),
|
||||||
IN a_id_user VARCHAR(200),
|
IN a_id_user INT,
|
||||||
IN a_comment VARCHAR(500),
|
IN a_comment VARCHAR(500),
|
||||||
IN a_id_customer INT,
|
IN a_id_customer INT,
|
||||||
IN a_name_company VARCHAR(256),
|
IN a_name_company VARCHAR(256),
|
||||||
@@ -24,7 +24,7 @@ CREATE PROCEDURE p_shop_save_customer (
|
|||||||
BEGIN
|
BEGIN
|
||||||
DECLARE v_id_error_type_bad_data INT;
|
DECLARE v_id_error_type_bad_data INT;
|
||||||
DECLARE v_id_error_type_no_permission INT;
|
DECLARE v_id_error_type_no_permission INT;
|
||||||
DECLARE v_guid_permission VARCHAR(36);
|
DECLARE v_guid_permission BINARY(36);
|
||||||
DECLARE v_id_permission_customer INT;
|
DECLARE v_id_permission_customer INT;
|
||||||
DECLARE v_id_access_level_EDIT INT;
|
DECLARE v_id_access_level_EDIT INT;
|
||||||
DECLARE v_has_permission BIT;
|
DECLARE v_has_permission BIT;
|
||||||
@@ -70,7 +70,7 @@ BEGIN
|
|||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS tmp_Msg_Error (
|
CREATE 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 VARCHAR(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
|
||||||
FOREIGN KEY (id_type)
|
FOREIGN KEY (id_type)
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ DROP PROCEDURE IF EXISTS p_shop_get_many_customer;
|
|||||||
|
|
||||||
DELIMITER //
|
DELIMITER //
|
||||||
CREATE PROCEDURE p_shop_get_many_customer (
|
CREATE PROCEDURE p_shop_get_many_customer (
|
||||||
IN a_id_user VARCHAR(200),
|
IN a_id_user INT,
|
||||||
IN a_get_all_customer BIT,
|
IN a_get_all_customer BIT,
|
||||||
IN a_get_inactive_customer BIT,
|
IN a_get_inactive_customer BIT,
|
||||||
IN a_get_first_customer_only BIT,
|
IN a_get_first_customer_only BIT,
|
||||||
@@ -32,14 +32,14 @@ BEGIN
|
|||||||
DECLARE v_id_error_type_bad_data INT;
|
DECLARE v_id_error_type_bad_data INT;
|
||||||
DECLARE v_code_error_type_bad_data VARCHAR(50);
|
DECLARE v_code_error_type_bad_data VARCHAR(50);
|
||||||
DECLARE v_has_filter_customer BIT;
|
DECLARE v_has_filter_customer BIT;
|
||||||
DECLARE v_guid VARCHAR(36);
|
DECLARE v_guid BINARY(36);
|
||||||
# DECLARE v_id_user VARCHAR(100);
|
# DECLARE v_id_user VARCHAR(100);
|
||||||
# DECLARE v_ids_permutation_unavailable VARCHAR(4000);
|
# DECLARE v_ids_permutation_unavailable VARCHAR(4000);
|
||||||
DECLARE v_id_permission_customer INT;
|
DECLARE v_id_permission_customer INT;
|
||||||
# DECLARE v_ids_product_permission VARCHAR(4000);
|
# DECLARE v_ids_product_permission VARCHAR(4000);
|
||||||
# DECLARE v_ids_permutation_permission VARCHAR(4000);
|
# DECLARE v_ids_permutation_permission VARCHAR(4000);
|
||||||
DECLARE v_id_access_level_view INT;
|
DECLARE v_id_access_level_view INT;
|
||||||
DECLARE v_now DATETIME;
|
DECLARE v_now TIMESTAMP;
|
||||||
DECLARE v_id_minimum INT;
|
DECLARE v_id_minimum INT;
|
||||||
|
|
||||||
SET v_code_error_type_bad_data = 'BAD_DATA';
|
SET v_code_error_type_bad_data = 'BAD_DATA';
|
||||||
@@ -90,7 +90,7 @@ BEGIN
|
|||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS tmp_Msg_Error (
|
CREATE 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 VARCHAR(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
|
||||||
FOREIGN KEY (id_type)
|
FOREIGN KEY (id_type)
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ DROP TABLE IF EXISTS tmp_Msg_Error;
|
|||||||
DELIMITER //
|
DELIMITER //
|
||||||
CREATE PROCEDURE p_shop_save_customer_sales_order (
|
CREATE PROCEDURE p_shop_save_customer_sales_order (
|
||||||
IN a_guid VARCHAR(500),
|
IN a_guid VARCHAR(500),
|
||||||
IN a_id_user VARCHAR(200),
|
IN a_id_user INT,
|
||||||
IN a_comment VARCHAR(500),
|
IN a_comment VARCHAR(500),
|
||||||
IN a_id_order INT,
|
IN a_id_order INT,
|
||||||
IN a_id_customer INT,
|
IN a_id_customer INT,
|
||||||
@@ -23,7 +23,7 @@ BEGIN
|
|||||||
DECLARE v_code_error_type_bad_data VARCHAR(50);
|
DECLARE v_code_error_type_bad_data VARCHAR(50);
|
||||||
DECLARE v_id_error_type_no_permission INT;
|
DECLARE v_id_error_type_no_permission INT;
|
||||||
DECLARE v_code_error_type_no_permission VARCHAR(50);
|
DECLARE v_code_error_type_no_permission VARCHAR(50);
|
||||||
DECLARE v_guid_permission VARCHAR(36);
|
DECLARE v_guid_permission BINARY(36);
|
||||||
-- DECLARE v_id_user VARCHAR(100);
|
-- DECLARE v_id_user VARCHAR(100);
|
||||||
DECLARE v_id_permission_Customer_Sales_order INT;
|
DECLARE v_id_permission_Customer_Sales_order INT;
|
||||||
DECLARE v_id_access_level_EDIT INT;
|
DECLARE v_id_access_level_EDIT INT;
|
||||||
@@ -93,7 +93,7 @@ BEGIN
|
|||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS tmp_Msg_Error (
|
CREATE 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 VARCHAR(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
|
||||||
FOREIGN KEY (id_type)
|
FOREIGN KEY (id_type)
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ DROP PROCEDURE IF EXISTS p_shop_get_many_customer_sales_order;
|
|||||||
|
|
||||||
DELIMITER //
|
DELIMITER //
|
||||||
CREATE PROCEDURE p_shop_get_many_customer_sales_order (
|
CREATE PROCEDURE p_shop_get_many_customer_sales_order (
|
||||||
IN a_id_user VARCHAR(200),
|
IN a_id_user INT,
|
||||||
IN a_get_all_customer BIT,
|
IN a_get_all_customer BIT,
|
||||||
IN a_get_inactive_customer BIT,
|
IN a_get_inactive_customer BIT,
|
||||||
IN a_get_first_customer_only BIT,
|
IN a_get_first_customer_only BIT,
|
||||||
@@ -23,8 +23,8 @@ CREATE PROCEDURE p_shop_get_many_customer_sales_order (
|
|||||||
IN a_ids_product VARCHAR(4000),
|
IN a_ids_product VARCHAR(4000),
|
||||||
IN a_get_inactive_permutation BIT,
|
IN a_get_inactive_permutation BIT,
|
||||||
IN a_ids_permutation VARCHAR(4000),
|
IN a_ids_permutation VARCHAR(4000),
|
||||||
IN a_date_from DATETIME,
|
IN a_date_from TIMESTAMP,
|
||||||
IN a_date_to DATETIME
|
IN a_date_to TIMESTAMP
|
||||||
)
|
)
|
||||||
BEGIN
|
BEGIN
|
||||||
-- Argument redeclaration
|
-- Argument redeclaration
|
||||||
@@ -36,14 +36,14 @@ BEGIN
|
|||||||
DECLARE v_has_filter_permutation BIT;
|
DECLARE v_has_filter_permutation BIT;
|
||||||
DECLARE v_has_filter_date_from BIT;
|
DECLARE v_has_filter_date_from BIT;
|
||||||
DECLARE v_has_filter_date_to BIT;
|
DECLARE v_has_filter_date_to BIT;
|
||||||
DECLARE v_guid VARCHAR(36);
|
DECLARE v_guid BINARY(36);
|
||||||
# DECLARE v_id_user VARCHAR(100);
|
# DECLARE v_id_user VARCHAR(100);
|
||||||
# DECLARE v_ids_permutation_unavailable VARCHAR(4000);
|
# DECLARE v_ids_permutation_unavailable VARCHAR(4000);
|
||||||
DECLARE v_ids_permission_customer_purchase_order VARCHAR(4000);
|
DECLARE v_ids_permission_customer_purchase_order VARCHAR(4000);
|
||||||
DECLARE v_ids_product_permission VARCHAR(4000);
|
DECLARE v_ids_product_permission VARCHAR(4000);
|
||||||
# DECLARE v_ids_permutation_permission VARCHAR(4000);
|
# DECLARE v_ids_permutation_permission VARCHAR(4000);
|
||||||
DECLARE v_id_access_level_view INT;
|
DECLARE v_id_access_level_view INT;
|
||||||
-- DECLARE v_now DATETIME;
|
-- DECLARE v_now TIMESTAMP;
|
||||||
-- DECLARE v_id_minimum INT;
|
-- DECLARE v_id_minimum INT;
|
||||||
DECLARE v_code_error_data VARCHAR(50);
|
DECLARE v_code_error_data VARCHAR(50);
|
||||||
DECLARE v_id_type_error_data INT;
|
DECLARE v_id_type_error_data INT;
|
||||||
@@ -224,7 +224,7 @@ BEGIN
|
|||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS tmp_Msg_Error (
|
CREATE 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 VARCHAR(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
|
||||||
FOREIGN KEY (id_type)
|
FOREIGN KEY (id_type)
|
||||||
|
|||||||
@@ -545,6 +545,7 @@ VALUES
|
|||||||
(1, 'HOME', 'Home Page', 2, 1),
|
(1, 'HOME', 'Home Page', 2, 1),
|
||||||
(2, 'STORE_PRODUCT', 'Store Product Page', 3, 1),
|
(2, 'STORE_PRODUCT', 'Store Product Page', 3, 1),
|
||||||
(3, 'STORE_USER', 'Store User Account Page', 4, 2),
|
(3, 'STORE_USER', 'Store User Account Page', 4, 2),
|
||||||
|
(10, 'STORE_USER_ADMIN', 'Store User Admin Page', 4, 3),
|
||||||
(4, 'STORE_ADMIN', 'Store Admin Page', 1, 3),
|
(4, 'STORE_ADMIN', 'Store Admin Page', 1, 3),
|
||||||
(5, 'STORE_SUPPLIER', 'Store Supplier Page', 4, 2),
|
(5, 'STORE_SUPPLIER', 'Store Supplier Page', 4, 2),
|
||||||
(6, 'STORE_SUPPLIER_PURCHASE_ORDER', 'Store Supplier Purchase Order Page', 4, 2),
|
(6, 'STORE_SUPPLIER_PURCHASE_ORDER', 'Store Supplier Purchase Order Page', 4, 2),
|
||||||
@@ -584,15 +585,16 @@ VALUES
|
|||||||
|
|
||||||
# Users
|
# Users
|
||||||
INSERT INTO Shop_User (
|
INSERT INTO Shop_User (
|
||||||
id_user,
|
id_user_auth0
|
||||||
name,
|
, firstname
|
||||||
email,
|
, surname
|
||||||
# email_verified,
|
, email
|
||||||
is_super_user
|
# email_verified
|
||||||
|
, is_super_user
|
||||||
)
|
)
|
||||||
VALUES
|
VALUES
|
||||||
('auth0|6582b95c895d09a70ba10fef', 'Teddy', 'edward.middletonsmith@gmail.com', 1),
|
('auth0|6582b95c895d09a70ba10fef', 'Teddy', 'Middleton-Smith', 'edward.middletonsmith@gmail.com', 1),
|
||||||
('parts_guest', 'Guest', '', 0)
|
('parts_guest', 'Guest', '', '', 0)
|
||||||
;
|
;
|
||||||
|
|
||||||
# User Role link
|
# User Role link
|
||||||
@@ -600,14 +602,14 @@ INSERT INTO Shop_User_Role_Link (
|
|||||||
id_user, id_role
|
id_user, id_role
|
||||||
)
|
)
|
||||||
VALUES
|
VALUES
|
||||||
('auth0|6582b95c895d09a70ba10fef', 1)
|
(1, 1)
|
||||||
;
|
;
|
||||||
|
|
||||||
# Addresses
|
# Addresses
|
||||||
INSERT INTO Shop_Address (
|
INSERT INTO Shop_Address (
|
||||||
id_user, id_region, name_full, phone_number, postcode, address_line_1, address_line_2, city, county
|
id_user, id_region, name_full, phone_number, postcode, address_line_1, address_line_2, city, county
|
||||||
)
|
)
|
||||||
SELECT U.id_user, 1, U.name, '07375 571430', 'CV22 6DN', '53 Alfred Green Close', '', 'Rugby', 'Warwickshire'
|
SELECT U.id_user, 1, CONCAT(U.firstname, ' ', U.surname), '07375 571430', 'CV22 6DN', '53 Alfred Green Close', '', 'Rugby', 'Warwickshire'
|
||||||
FROM Shop_User U
|
FROM Shop_User U
|
||||||
;
|
;
|
||||||
|
|
||||||
@@ -619,7 +621,7 @@ INSERT INTO Shop_User_Basket (
|
|||||||
quantity
|
quantity
|
||||||
)
|
)
|
||||||
VALUES
|
VALUES
|
||||||
('auth0|6582b95c895d09a70ba10fef', 1, 1, 69)
|
(1, 1, 1, 69)
|
||||||
;
|
;
|
||||||
|
|
||||||
# User Order Status
|
# User Order Status
|
||||||
@@ -637,8 +639,8 @@ INSERT INTO Shop_User_Order (
|
|||||||
id_user, value_total, id_order_status, id_checkout_session, id_currency
|
id_user, value_total, id_order_status, id_checkout_session, id_currency
|
||||||
)
|
)
|
||||||
VALUES
|
VALUES
|
||||||
('auth0|6582b95c895d09a70ba10fef', 25, 1, 'noods', 1),
|
(1, 25, 1, 'noods', 1),
|
||||||
('auth0|6582b95c895d09a70ba10fef', 25, 1, 'noods', 1)
|
(1, 25, 1, 'noods', 1)
|
||||||
;
|
;
|
||||||
|
|
||||||
# User Order Product Link
|
# User Order Product Link
|
||||||
|
|||||||
@@ -23,4 +23,5 @@ FROM
|
|||||||
INFORMATION_SCHEMA.TABLES
|
INFORMATION_SCHEMA.TABLES
|
||||||
WHERE
|
WHERE
|
||||||
TABLE_SCHEMA = 'PARTS'
|
TABLE_SCHEMA = 'PARTS'
|
||||||
-- AND TABLE_NAME = 'your_table_name';
|
-- AND TABLE_NAME = 'your_table_name'
|
||||||
|
;
|
||||||
@@ -38,7 +38,7 @@ DROP TABLE IF EXISTS Shop_User_Change_Set;
|
|||||||
CREATE TABLE Shop_User_Change_Set (
|
CREATE TABLE Shop_User_Change_Set (
|
||||||
id_change_set INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
id_change_set INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||||
comment VARCHAR(500),
|
comment VARCHAR(500),
|
||||||
updated_last_on DATETIME,
|
updated_last_on TIMESTAMP,
|
||||||
updated_last_by VARCHAR(100)
|
updated_last_by VARCHAR(100)
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -68,7 +68,7 @@ CREATE TABLE Shop_Access_Level (
|
|||||||
priority INT NOT NULL,
|
priority INT NOT NULL,
|
||||||
active BIT NOT NULL DEFAULT 1,
|
active BIT NOT NULL DEFAULT 1,
|
||||||
display_order INT NOT NULL,
|
display_order INT NOT NULL,
|
||||||
created_on DATETIME,
|
created_on TIMESTAMP,
|
||||||
created_by VARCHAR(100),
|
created_by VARCHAR(100),
|
||||||
id_change_set INT,
|
id_change_set INT,
|
||||||
CONSTRAINT FK_Shop_Access_Level_id_change_set
|
CONSTRAINT FK_Shop_Access_Level_id_change_set
|
||||||
@@ -158,7 +158,7 @@ CREATE TABLE Shop_Permission_Group (
|
|||||||
name VARCHAR(255),
|
name VARCHAR(255),
|
||||||
active BIT NOT NULL DEFAULT 1,
|
active BIT NOT NULL DEFAULT 1,
|
||||||
display_order INT NOT NULL,
|
display_order INT NOT NULL,
|
||||||
created_on DATETIME,
|
created_on TIMESTAMP,
|
||||||
created_by VARCHAR(100),
|
created_by VARCHAR(100),
|
||||||
id_change_set INT,
|
id_change_set INT,
|
||||||
CONSTRAINT FK_Shop_Permission_Group_id_change_set
|
CONSTRAINT FK_Shop_Permission_Group_id_change_set
|
||||||
@@ -253,7 +253,7 @@ CREATE TABLE Shop_Permission (
|
|||||||
REFERENCES Shop_Access_Level(id_access_level),
|
REFERENCES Shop_Access_Level(id_access_level),
|
||||||
active BIT NOT NULL DEFAULT 1,
|
active BIT NOT NULL DEFAULT 1,
|
||||||
display_order INT NOT NULL,
|
display_order INT NOT NULL,
|
||||||
created_on DATETIME,
|
created_on TIMESTAMP,
|
||||||
created_by VARCHAR(100),
|
created_by VARCHAR(100),
|
||||||
id_change_set INT,
|
id_change_set INT,
|
||||||
CONSTRAINT FK_Shop_Permission_id_change_set
|
CONSTRAINT FK_Shop_Permission_id_change_set
|
||||||
@@ -348,7 +348,7 @@ CREATE TABLE Shop_Role (
|
|||||||
name VARCHAR(255),
|
name VARCHAR(255),
|
||||||
active BIT NOT NULL DEFAULT 1,
|
active BIT NOT NULL DEFAULT 1,
|
||||||
display_order INT NOT NULL,
|
display_order INT NOT NULL,
|
||||||
created_on DATETIME,
|
created_on TIMESTAMP,
|
||||||
created_by VARCHAR(100),
|
created_by VARCHAR(100),
|
||||||
id_change_set INT,
|
id_change_set INT,
|
||||||
CONSTRAINT FK_Shop_Role_id_change_set
|
CONSTRAINT FK_Shop_Role_id_change_set
|
||||||
@@ -448,7 +448,7 @@ CREATE TABLE Shop_Role_Permission_Link (
|
|||||||
REFERENCES Shop_Access_Level(id_access_level)
|
REFERENCES Shop_Access_Level(id_access_level)
|
||||||
ON UPDATE RESTRICT,
|
ON UPDATE RESTRICT,
|
||||||
active BIT NOT NULL DEFAULT 1,
|
active BIT NOT NULL DEFAULT 1,
|
||||||
created_on DATETIME,
|
created_on TIMESTAMP,
|
||||||
created_by VARCHAR(100),
|
created_by VARCHAR(100),
|
||||||
id_change_set INT,
|
id_change_set INT,
|
||||||
CONSTRAINT FK_Shop_Role_Permission_Link_id_change_set
|
CONSTRAINT FK_Shop_Role_Permission_Link_id_change_set
|
||||||
@@ -541,7 +541,7 @@ CREATE TABLE Shop_User (
|
|||||||
name VARCHAR(255),
|
name VARCHAR(255),
|
||||||
is_super_user BIT NOT NULL DEFAULT 0,
|
is_super_user BIT NOT NULL DEFAULT 0,
|
||||||
active BIT NOT NULL DEFAULT 1,
|
active BIT NOT NULL DEFAULT 1,
|
||||||
created_on DATETIME,
|
created_on TIMESTAMP,
|
||||||
created_by VARCHAR(100),
|
created_by VARCHAR(100),
|
||||||
id_change_set INT,
|
id_change_set INT,
|
||||||
CONSTRAINT FK_Shop_User_id_change_set
|
CONSTRAINT FK_Shop_User_id_change_set
|
||||||
@@ -635,7 +635,7 @@ CREATE TABLE Shop_User_Role_Link (
|
|||||||
REFERENCES Shop_Role(id_role)
|
REFERENCES Shop_Role(id_role)
|
||||||
ON UPDATE RESTRICT,
|
ON UPDATE RESTRICT,
|
||||||
active BIT NOT NULL DEFAULT 1,
|
active BIT NOT NULL DEFAULT 1,
|
||||||
created_on DATETIME,
|
created_on TIMESTAMP,
|
||||||
created_by VARCHAR(100),
|
created_by VARCHAR(100),
|
||||||
id_change_set INT,
|
id_change_set INT,
|
||||||
CONSTRAINT FK_Shop_User_Role_Link_id_change_set
|
CONSTRAINT FK_Shop_User_Role_Link_id_change_set
|
||||||
@@ -722,7 +722,7 @@ CREATE TABLE Shop_Address (
|
|||||||
city VARCHAR(50) NOT NULL,
|
city VARCHAR(50) NOT NULL,
|
||||||
county VARCHAR(100) NOT NULL,
|
county VARCHAR(100) NOT NULL,
|
||||||
active BIT NOT NULL DEFAULT 1,
|
active BIT NOT NULL DEFAULT 1,
|
||||||
created_on DATETIME,
|
created_on TIMESTAMP,
|
||||||
created_by VARCHAR(100),
|
created_by VARCHAR(100),
|
||||||
id_change_set INT,
|
id_change_set INT,
|
||||||
CONSTRAINT FK_Shop_Address_id_change_set
|
CONSTRAINT FK_Shop_Address_id_change_set
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ DROP TABLE IF EXISTS Shop_Product_Change_Set;
|
|||||||
CREATE TABLE Shop_Product_Change_Set (
|
CREATE TABLE Shop_Product_Change_Set (
|
||||||
id_change_set INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
id_change_set INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||||
comment VARCHAR(500),
|
comment VARCHAR(500),
|
||||||
updated_last_on DATETIME,
|
updated_last_on TIMESTAMP,
|
||||||
updated_last_by VARCHAR(100)
|
updated_last_by VARCHAR(100)
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -84,9 +84,9 @@ CREATE TABLE File_Type (
|
|||||||
code VARCHAR(50),
|
code VARCHAR(50),
|
||||||
name VARCHAR(100),
|
name VARCHAR(100),
|
||||||
extension VARCHAR(50),
|
extension VARCHAR(50),
|
||||||
created_on DATETIME,
|
created_on TIMESTAMP,
|
||||||
created_by VARCHAR(100),
|
created_by VARCHAR(100),
|
||||||
updated_last_on DATETIME,
|
updated_last_on TIMESTAMP,
|
||||||
updated_last_by VARCHAR(100)
|
updated_last_by VARCHAR(100)
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -110,9 +110,9 @@ CREATE TABLE File_Type_Audit (
|
|||||||
name_field VARCHAR(50),
|
name_field VARCHAR(50),
|
||||||
value_prev VARCHAR(500),
|
value_prev VARCHAR(500),
|
||||||
value_new VARCHAR(500),
|
value_new VARCHAR(500),
|
||||||
created_on DATETIME,
|
created_on TIMESTAMP,
|
||||||
created_by VARCHAR(100),
|
created_by VARCHAR(100),
|
||||||
updated_last_on DATETIME,
|
updated_last_on TIMESTAMP,
|
||||||
updated_last_by VARCHAR(100)
|
updated_last_by VARCHAR(100)
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -181,7 +181,7 @@ SELECT * FROM File_Type_Audit;
|
|||||||
CREATE TABLE Shop_General (
|
CREATE TABLE Shop_General (
|
||||||
id_general INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
id_general INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||||
quantity_max FLOAT,
|
quantity_max FLOAT,
|
||||||
created_on DATETIME,
|
created_on TIMESTAMP,
|
||||||
created_by VARCHAR(100),
|
created_by VARCHAR(100),
|
||||||
id_change_set INT,
|
id_change_set INT,
|
||||||
CONSTRAINT FK_Shop_General_id_change_set
|
CONSTRAINT FK_Shop_General_id_change_set
|
||||||
@@ -254,7 +254,7 @@ CREATE TABLE Shop_Category (
|
|||||||
description VARCHAR(4000),
|
description VARCHAR(4000),
|
||||||
active BIT NOT NULL DEFAULT 1,
|
active BIT NOT NULL DEFAULT 1,
|
||||||
display_order INT NOT NULL,
|
display_order INT NOT NULL,
|
||||||
created_on DATETIME,
|
created_on TIMESTAMP,
|
||||||
created_by VARCHAR(100),
|
created_by VARCHAR(100),
|
||||||
id_change_set INT,
|
id_change_set INT,
|
||||||
CONSTRAINT FK_Shop_Category_id_change_set
|
CONSTRAINT FK_Shop_Category_id_change_set
|
||||||
@@ -347,7 +347,7 @@ CREATE TABLE Shop_Recurrence_Interval (
|
|||||||
code VARCHAR(50),
|
code VARCHAR(50),
|
||||||
name VARCHAR(255),
|
name VARCHAR(255),
|
||||||
name_plural VARCHAR(256),
|
name_plural VARCHAR(256),
|
||||||
created_on DATETIME,
|
created_on TIMESTAMP,
|
||||||
created_by VARCHAR(100),
|
created_by VARCHAR(100),
|
||||||
id_change_set INT,
|
id_change_set INT,
|
||||||
CONSTRAINT FK_Shop_Recurrence_Interval_id_change_set
|
CONSTRAINT FK_Shop_Recurrence_Interval_id_change_set
|
||||||
@@ -448,7 +448,7 @@ CREATE TABLE Shop_Product (
|
|||||||
id_stripe_price VARCHAR(100),
|
id_stripe_price VARCHAR(100),
|
||||||
active BIT NOT NULL DEFAULT 1,
|
active BIT NOT NULL DEFAULT 1,
|
||||||
display_order INT NOT NULL,
|
display_order INT NOT NULL,
|
||||||
created_on DATETIME,
|
created_on TIMESTAMP,
|
||||||
created_by VARCHAR(100),
|
created_by VARCHAR(100),
|
||||||
id_change_set INT,
|
id_change_set INT,
|
||||||
CONSTRAINT FK_Shop_Product_id_change_set
|
CONSTRAINT FK_Shop_Product_id_change_set
|
||||||
@@ -597,7 +597,7 @@ CREATE TABLE Shop_Variation_Type (
|
|||||||
name_plural VARCHAR(256),
|
name_plural VARCHAR(256),
|
||||||
active BIT NOT NULL DEFAULT 1,
|
active BIT NOT NULL DEFAULT 1,
|
||||||
display_order INT NOT NULL,
|
display_order INT NOT NULL,
|
||||||
created_on DATETIME,
|
created_on TIMESTAMP,
|
||||||
created_by VARCHAR(100),
|
created_by VARCHAR(100),
|
||||||
id_change_set INT,
|
id_change_set INT,
|
||||||
CONSTRAINT FK_Shop_Variation_Type_id_change_set
|
CONSTRAINT FK_Shop_Variation_Type_id_change_set
|
||||||
@@ -690,7 +690,7 @@ CREATE TABLE Shop_Variation (
|
|||||||
name VARCHAR(255),
|
name VARCHAR(255),
|
||||||
active BIT NOT NULL DEFAULT 1,
|
active BIT NOT NULL DEFAULT 1,
|
||||||
display_order INT NOT NULL,
|
display_order INT NOT NULL,
|
||||||
created_on DATETIME,
|
created_on TIMESTAMP,
|
||||||
created_by VARCHAR(100),
|
created_by VARCHAR(100),
|
||||||
id_change_set INT,
|
id_change_set INT,
|
||||||
CONSTRAINT FK_Shop_Variation_id_change_set
|
CONSTRAINT FK_Shop_Variation_id_change_set
|
||||||
@@ -782,7 +782,7 @@ CREATE TABLE Shop_Product_Variation_Link (
|
|||||||
ON UPDATE RESTRICT,
|
ON UPDATE RESTRICT,
|
||||||
active BIT NOT NULL DEFAULT 1,
|
active BIT NOT NULL DEFAULT 1,
|
||||||
display_order INT NOT NULL,
|
display_order INT NOT NULL,
|
||||||
created_on DATETIME,
|
created_on TIMESTAMP,
|
||||||
created_by VARCHAR(100),
|
created_by VARCHAR(100),
|
||||||
id_change_set INT,
|
id_change_set INT,
|
||||||
CONSTRAINT FK_Shop_Product_Variation_Link_id_change_set
|
CONSTRAINT FK_Shop_Product_Variation_Link_id_change_set
|
||||||
@@ -872,7 +872,7 @@ CREATE TABLE Shop_Image_Type (
|
|||||||
name_plural VARCHAR(256),
|
name_plural VARCHAR(256),
|
||||||
active BIT NOT NULL DEFAULT 1,
|
active BIT NOT NULL DEFAULT 1,
|
||||||
display_order INT NOT NULL,
|
display_order INT NOT NULL,
|
||||||
created_on DATETIME,
|
created_on TIMESTAMP,
|
||||||
created_by VARCHAR(100),
|
created_by VARCHAR(100),
|
||||||
id_change_set INT,
|
id_change_set INT,
|
||||||
CONSTRAINT FK_Shop_Image_Type_id_change_set
|
CONSTRAINT FK_Shop_Image_Type_id_change_set
|
||||||
@@ -969,7 +969,7 @@ CREATE TABLE Shop_Image (
|
|||||||
url VARCHAR(255),
|
url VARCHAR(255),
|
||||||
active BIT NOT NULL DEFAULT 1,
|
active BIT NOT NULL DEFAULT 1,
|
||||||
display_order INT NOT NULL,
|
display_order INT NOT NULL,
|
||||||
created_on DATETIME,
|
created_on TIMESTAMP,
|
||||||
created_by VARCHAR(100),
|
created_by VARCHAR(100),
|
||||||
id_change_set INT,
|
id_change_set INT,
|
||||||
CONSTRAINT FK_Shop_Image_id_change_set
|
CONSTRAINT FK_Shop_Image_id_change_set
|
||||||
@@ -1063,7 +1063,7 @@ CREATE TABLE Shop_Product_Image_Link (
|
|||||||
REFERENCES Shop_Image(id_image)
|
REFERENCES Shop_Image(id_image)
|
||||||
ON UPDATE RESTRICT,
|
ON UPDATE RESTRICT,
|
||||||
active BIT NOT NULL DEFAULT 1,
|
active BIT NOT NULL DEFAULT 1,
|
||||||
created_on DATETIME,
|
created_on TIMESTAMP,
|
||||||
created_by VARCHAR(100),
|
created_by VARCHAR(100),
|
||||||
id_change_set INT,
|
id_change_set INT,
|
||||||
CONSTRAINT FK_Shop_Product_Image_Link_id_change_set
|
CONSTRAINT FK_Shop_Product_Image_Link_id_change_set
|
||||||
@@ -1154,7 +1154,7 @@ CREATE TABLE Shop_Delivery_Option_Type (
|
|||||||
quantity_max INT NOT NULL,
|
quantity_max INT NOT NULL,
|
||||||
active BIT NOT NULL DEFAULT 1,
|
active BIT NOT NULL DEFAULT 1,
|
||||||
display_order INT NOT NULL,
|
display_order INT NOT NULL,
|
||||||
created_on DATETIME,
|
created_on TIMESTAMP,
|
||||||
created_by VARCHAR(100),
|
created_by VARCHAR(100),
|
||||||
id_change_set INT,
|
id_change_set INT,
|
||||||
CONSTRAINT FK_Shop_Delivery_Option_Type_id_change_set
|
CONSTRAINT FK_Shop_Delivery_Option_Type_id_change_set
|
||||||
@@ -1263,7 +1263,7 @@ CREATE TABLE Shop_Delivery_Option (
|
|||||||
ON UPDATE RESTRICT,
|
ON UPDATE RESTRICT,
|
||||||
price_GBP FLOAT NOT NULL,
|
price_GBP FLOAT NOT NULL,
|
||||||
active BIT NOT NULL DEFAULT 1,
|
active BIT NOT NULL DEFAULT 1,
|
||||||
created_on DATETIME,
|
created_on TIMESTAMP,
|
||||||
created_by VARCHAR(100),
|
created_by VARCHAR(100),
|
||||||
id_change_set INT,
|
id_change_set INT,
|
||||||
CONSTRAINT FK_Shop_Delivery_Option_id_change_set
|
CONSTRAINT FK_Shop_Delivery_Option_id_change_set
|
||||||
@@ -1352,7 +1352,7 @@ CREATE TABLE Shop_Delivery_Region (
|
|||||||
name VARCHAR(200) NOT NULL,
|
name VARCHAR(200) NOT NULL,
|
||||||
active BIT NOT NULL DEFAULT 1,
|
active BIT NOT NULL DEFAULT 1,
|
||||||
display_order INT NOT NULL,
|
display_order INT NOT NULL,
|
||||||
created_on DATETIME,
|
created_on TIMESTAMP,
|
||||||
created_by VARCHAR(100),
|
created_by VARCHAR(100),
|
||||||
id_change_set INT,
|
id_change_set INT,
|
||||||
CONSTRAINT FK_Shop_Delivery_Region_id_change_set
|
CONSTRAINT FK_Shop_Delivery_Region_id_change_set
|
||||||
@@ -1443,7 +1443,7 @@ CREATE TABLE Shop_Product_Delivery_Region_Link (
|
|||||||
REFERENCES Shop_Delivery_Region(id_region)
|
REFERENCES Shop_Delivery_Region(id_region)
|
||||||
ON UPDATE RESTRICT,
|
ON UPDATE RESTRICT,
|
||||||
active BIT NOT NULL DEFAULT 1,
|
active BIT NOT NULL DEFAULT 1,
|
||||||
created_on DATETIME,
|
created_on TIMESTAMP,
|
||||||
created_by VARCHAR(100),
|
created_by VARCHAR(100),
|
||||||
id_change_set INT,
|
id_change_set INT,
|
||||||
CONSTRAINT FK_Shop_Product_Delivery_Region_Link_id_change_set
|
CONSTRAINT FK_Shop_Product_Delivery_Region_Link_id_change_set
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ CREATE TABLE IF NOT EXISTS Shop_Recurrence_Interval (
|
|||||||
name VARCHAR(255),
|
name VARCHAR(255),
|
||||||
name_plural VARCHAR(256),
|
name_plural VARCHAR(256),
|
||||||
active BIT NOT NULL DEFAULT 1,
|
active BIT NOT NULL DEFAULT 1,
|
||||||
created_on DATETIME,
|
created_on TIMESTAMP,
|
||||||
created_by VARCHAR(100),
|
created_by VARCHAR(100),
|
||||||
id_change_set INT,
|
id_change_set INT,
|
||||||
CONSTRAINT FK_Shop_Recurrence_Interval_id_change_set
|
CONSTRAINT FK_Shop_Recurrence_Interval_id_change_set
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user