From 51d991ba42349a519025f25ba3352608ea2ea3cc Mon Sep 17 00:00:00 2001 From: teddy Date: Fri, 15 Nov 2024 08:58:37 +0000 Subject: [PATCH] Fix: 1. Save proc architecture update for records saved with subrecords / linked records, such as Order has Items. \n 2. Style improvements for Product Category, Product, Product Permutation pages. --- .../store/__pycache__/product.cpython-312.pyc | Bin 29296 -> 29559 bytes .../product_category.cpython-312.pyc | Bin 30916 -> 31261 bytes .../product_permutation.cpython-312.pyc | Bin 40857 -> 41762 bytes business_objects/store/product.py | 6 +- business_objects/store/product_category.py | 7 +- business_objects/store/product_permutation.py | 17 +- ..._store_product_permutation.cpython-312.pyc | Bin 3251 -> 3370 bytes .../datastore_store_product_permutation.py | 3 +- .../{0000_combine.sql => 0000_combined.sql} | 1229 +++++++++++++++-- static/MySQL/0001_destroy.sql | 5 + .../1202_tbl_Shop_Product_Category_Temp.sql | 3 +- static/MySQL/1205_tbl_Shop_Product_Temp.sql | 3 +- .../1206_tbl_Shop_Product_Permutation.sql | 1 + ...1208_tbl_Shop_Product_Permutation_Temp.sql | 4 +- ...roduct_Permutation_Variation_Link_Temp.sql | 16 + .../3206_tri_Shop_Product_Permutation.sql | 6 +- ...6_fn_shop_get_product_permutation_name.sql | 51 +- ...et_product_variations_from_id_csv_list.sql | 102 ++ ...get_product_permutation_variations_csv.sql | 49 + .../7206_p_shop_save_product_permutation.sql | 251 +++- ...6_p_shop_save_product_permutation_test.sql | 54 +- ...03_p_shop_save_supplier_purchase_order.sql | 4 +- ...shop_save_supplier_purchase_order_test.sql | 7 +- ...save_Manufacturing_purchase_order_test.sql | 1 + ...shop_save_manufacturing_purchase_order.sql | 20 +- ..._get_many_manufacturing_purchase_order.sql | 2 +- static/MySQL/9000_populate.sql | 12 +- static/MySQL/{temp.txt => file_list.txt} | 2 + static/batch/sql_combine.bat | 52 +- static/batch/sql_combine.ps1 | 43 + static/css/layouts/header.css | 29 +- .../css/pages/store/product_permutations.css | 7 +- static/css/pages/store/products.css | 5 +- static/dist/css/main.bundle.css | 29 +- .../css/store_product_permutations.bundle.css | 7 +- static/dist/js/main.bundle.js | 85 +- static/js/pages/base_table.js | 2 +- static/js/pages/store/product_permutations.js | 80 +- .../store/_row_product_permutation.html | 24 +- templates/js/sections/store.js | 20 +- templates/layouts/layout.html | 106 +- 41 files changed, 1931 insertions(+), 413 deletions(-) rename static/MySQL/{0000_combine.sql => 0000_combined.sql} (96%) create mode 100644 static/MySQL/1217_tbl_Shop_Product_Permutation_Variation_Link_Temp.sql create mode 100644 static/MySQL/6211_fn_shop_get_product_variations_from_id_csv_list.sql create mode 100644 static/MySQL/6212_fn_shop_get_product_permutation_variations_csv.sql rename static/MySQL/{temp.txt => file_list.txt} (98%) create mode 100644 static/batch/sql_combine.ps1 diff --git a/business_objects/store/__pycache__/product.cpython-312.pyc b/business_objects/store/__pycache__/product.cpython-312.pyc index 1cc13db5b628eef52537180285ae94e7f94f46a2..af8e70191f0dc9cc0f6698bf25c6765e879879ca 100644 GIT binary patch delta 4528 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 diff --git a/business_objects/store/__pycache__/product_category.cpython-312.pyc b/business_objects/store/__pycache__/product_category.cpython-312.pyc index aeefa5fa3c75ee3fc2987ce08912245b0e275d95..58d7e346b58e0ed34dc1760e667e4c9342ccbe17 100644 GIT binary patch delta 1842 zcmZXUe@s(X6vy9v{fW?0=r3tIS|~VC#&kinMrDeEMv)0RV^wO$d$QK@!`I@38SR2Z zjFHvdFmPsrEo@3KMsvGOx9Mi~BTTnUz%5NR+0670k{L0u#Yi@H&wF$ua+7|}dFOub zxu^Hs_r7_E-km_&>l)20hK@FKQLV~O|S3FX?3&a+1lEH(8WP zj-~b>vdT5 zhwW1^eVJc_dDZbflGa)9WR{gwW}k)d6K4cWB)3(rbHWZw0LuY(;+$t>ksZ78|50bs zNFGaL#m{Yr1*Zzy6tvu|!q>o@bWOU?`|uOl{`XGGPHUEQS)8tX?D@)u>W>I6tD%b4d4Q}0bfw$DTG|`s{ohD z2kT1M1`-8W6zBuO1PCalSXkh(Xi@3FHA^FeJd$5-tI*0KUQ% z#YLNb0Jjxz127CY2KWUa?sN{kcL47Jeh2gd;()n;X8}Y6-s!t*2e*d){u_!ZZ~Pj| zFh_8;f1Q$(os|#B@PL0F{&J69mCPscvp6Nb<>NddzOGSvOD$9(ECN^oMF1OK*l123&7po= zUfbm3@ZM_Ep#}7@6Lm2mYNc@$9bk^r6HnBE7>+r>c<9MXqnQ!J>m?JiXh6Cb_rZhA zL6AAZQcK~=v}C>{G;mEdAy0`n#Md?m&7RG)%mRKu50t)eGp~Z(DfD7da;&q$=PrRMy!Mi{ag!}TMRQD(Z0lz|R1r(3kn3!Qf zxIAW_dnV_GaY1-vOmB<4(B(Se>aOf@pLCz!JZQM7-xw}yuNskWjF}w~p{w~sb8q@- z%lnp*By)aveMCPZ&&QKZcD%Q#KX*dODr{p)Mw#}I)hhJkGU|BC!fA}MAWZ9To26f4%(abF@fxwa_#<6?uquR(z`Z?#G z^F8O@ymMbaoQLbPU>&zumg)F&?VYtvvB(!zFu@4gOpn2jR&y`-*pT^EJruG>Y41wl zVW-ju0K9Bf#(e;V*&Ka(qr$6IFT3C>m4qL6<3g32$=M5Frd&KH7z*LtA}3RF$Ej*M z?=qR8<=4o(p?m{cT@F6-=CVBn=PA74>mk!q)Fs;rX@`x3GJ?WEffuypl*CJ&GJ zB_6AIp`Hr**PJx)<9dtR$($*j*FTl?mQ@23;)C)^@Zp+@e(>)MErxM$M0N zv;c>qK2K{OM~4pw59Z?J=6`{)i7oTM&CPAY()uq+QBM%Hd&#RKloA4juQ>b$wTS#0 z!WjEx`(`QiYx0W;3}<#^!Wc8|JPY2WFy(?Ae!W)RK!Gv#UDfaK+%vL+B$G8+h-6Kg z_ICBHB`u?*U2GW)&4n37P1jum`Vo0Zgz+LoH}>y~^0F;1Gzr!C!4R-zIL}wsX_V2liCg)@bwY z)%NagyaXQH66!G0-s%*)9&+h{;hm;C$}bdgQL)?{X=xSLNxecrF~X}@U9n;JIIX(~ z-xDSXrwBh2#4Z=e`+)Ef;T~a-Fhy8F5ZCo0c^7eit&$EKqTA*3 z@~DKLM^_ppUDyzH;p|#RwsDj$KYtQ7kQTOtmxWSrA?gL8L62-tv5KfUDLTxf=^~oS zqj@+L^`zLsW?q{{Yng9RfNuvKI1@Fc*uxH-RiddNq;MGxv4D@ zYLswO(8>DW+^UDa+1;ZzB-1oc`YmcPzH&4RZ?^hi8vkl7ksbs3+K%gY`LprUw&GOr z0n;b0eujUvl?16u6|UIy_I5wipm~_UBS;=Z}%;~u|BfRBSLz;FO w9x`l?gPra`+)#Bm6mAxKs#Ew@EDL1piyg^a4QYKZ4OE_~9E|>>;|o#wKiMFbX8-^I diff --git a/business_objects/store/__pycache__/product_permutation.cpython-312.pyc b/business_objects/store/__pycache__/product_permutation.cpython-312.pyc index 3960e1459f8e80e8df8313562fb5fcb86bc5c45c..ab59f4ea968b8f52b2543b4f9d704d2d3aab8daa 100644 GIT binary patch delta 5540 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 delta 4994 zcmZ`-32+A& z-~ayi_U*piPkHzSaqd|$>o1v^X#zXeKVQG~2PdA)`iTls!eP~k45Miw+lp zZ-L^EQ!Ppm-$=D!QAZx0*65%KpVKwqTJ5#irz^mZw2SaJ+5$0HjgAgICEz7(0h21R zLFdI^=oaB#mL{j!@mXD>+?NZ?la`2WOz@Krw>t6A%TKtdSjF()`z&@3P1OncO9bk zx!x&!+-ugX+|bz_+JSd?i}59|nXS>g-mw&%Y0zVDLxC7-#UD0wYhGvFCtt$%8*a&Y zWHRRIi?Y9pYY(TN)0Sgjqd9!AF)hV>!QC2j_e9-2FG-R98)E(AQTFGbIP2aXeyZgz z9Xy1~y2{xA!LBW!`5mjsivR7JC6+oy=k;CP?bifWtn6NW!^(9V1HFCMt?u=Q7Nc#I z2|U=as!j7eOWRY3f9TU|rzQfUlN00G@Z72g)!@TMe~J&Ml^mO?YWIe4gK zl&X&rj1%y=(E@}P6U4_j67Wq2*gPk*)q*f1d?~tfay}Cn$O7oCGO_d4qL{TdYORe} z>SPs3B6tfpd%M7T%06e0nB20OgcPVSD@-F4+GFO5sJS9iP${R9sDUc8!n8@^w2o9Q zR5@kN(uCsjn6oMBY>E^$%jqPhL5ovi8A)O$i5bvhkvYo}*i? zh2joQ2s>teZ-#1g3YDXc8% zddf*GW7pFpbLtYBTVqY5(WcSJ(pzLVsV*3UUQl?2&tsFu1MQ%xta%I540+@MrdQpA8Vb8woXNs?~pyD*T7D2DYRB_ zSI1mkQCC-_{2IBA)LK{t4uyJ!qSBbd7j^g|_6B*eJEuHH_ClkFXpUT;bhnrA5WCy0 z@)9@7TlD-<^Rb~iL2htk?vTETQX1g^Yyf#F@g`v-Y@%!22wUkIsgVU?18fuJW}d*< z8ekj)Lk?cB1-ivmATM*{y+aPZ9Lr&qSSPnqdK(B{U#xCJv~EMBcB9-5N)QIX8b9fP z#O>sFvy*3Z0C;A?rp8a8;otnh9S4CdoE&fa*eNABTjH-OU~=Y9|zB{6$_ z)LtL4Es=Y{?O|j30ety%!g${m{jZHjz?peb;es2#k=}(?d@H!x^cQ-$A%jU31BWC2 z{{0%;h8M%B@YL`(0I%ToZB0;%XSOw(-$=X+=QW$RZx4=3ZdIs_Vy~cWtQZ|5Rq)er z&&a3qne8LXB8?+&en=kT@AX;9(qlP_C%xpc~HSm+=s%ae_praIwe zd}!)dP=_0KOt4jbX~*OI{jRgX3v>b3iS$NrjfEa#yW`iobT3z^=O3>uWB4eN4 zgtmi~>Kb*1Jc#~-{VKgiz@Hu5nDUtVjEL$x$MDkK>S_xc|EfdMChSk59mo!-4!43G|8Tf8Ud_RK8dy)u|GfZXV&aK* zpom|9iN;G*Pjv=uYz_r9uhe2*)y#Pb=Y>hRr99WdVtmxK-?wbm#Au0jpp1`dYheo< zEGIL+@KeCWO}%?}k=u!Zdj@ht=Of8oH=U4Nke|77@!Tnk9~mAem(E@YJZ-J zrQ+vDi^EO#y$D!5yB-R0?`)}cisgoO5;QZIPiMP&Xh$d%93R>pYQ!f`tI1z`5gPIsc@={zdQ}!TWgbc$e`5q8}1`&R~z&lBC#1#;&xDBq+9# z*j2WXhsYSF64NF*xM>}aku&7%D%(gRvyFB+omfWF7bcU3z-N~^%SsZnNz4KtvyH^A zvW+~X*hZpP*+w2>wlP!AWAvh4$SR6u`lFftNJg)mPpY2To^{MND!d=oLu}o2blo&_ z2kW3+j0=nvD%6l<;f&PHK>p5Xq;Iq-Ni87NL^6NwhJ4=aM;fDAsB^?yZVQc5rXSsWZu26_e^DYsFbflC>%&v4mSIPRp(`b>*a& zF{f20bLzU%1x?Ftl3mOM_A}i`1r)sX8J-;25{3!V^bBSR1?rXnpcgC zPbqJq8jA59cl>!kh#vGbCE-5Mfm!- zm2p=%Y$gkH`7&BhPUJFHkOLaXa_z1Z>L6yvir&aVibYA1poroM8E(5 delta 157 zcmZ1_wONwyG%qg~0}xE}R7*d`w~=ol3!}#74J>~dC)=_qPUd01!6-EODf>PqP43D2 zI3ie!xq)gYt8&IO{brcl#(7teljk~z!bJ{+3yMw`T*9t!gir3^@@2G`e2vRkP6nv< zM+?IjCPr524{Qu^Ez2FJff$pL~YLN63Yd(e{Ft-B$(>qevR4 F4*)3fEIj}K diff --git a/datastores/datastore_store_product_permutation.py b/datastores/datastore_store_product_permutation.py index 8adbe138..2d9dc6b7 100644 --- a/datastores/datastore_store_product_permutation.py +++ b/datastores/datastore_store_product_permutation.py @@ -101,5 +101,6 @@ class DataStore_Store_Product_Permutation(DataStore_Store_Base): 'a_id_user': user.id_user, 'a_debug': 0, } - cls.db_procedure_execute('p_shop_save_product_permutation', argument_dict_list) + results = cls.db_procedure_execute('p_shop_save_product_permutation', argument_dict_list) + DataStore_Store_Base.db_cursor_clear(results.cursor) Helper_App.console_log('saved product permutations') diff --git a/static/MySQL/0000_combine.sql b/static/MySQL/0000_combined.sql similarity index 96% rename from static/MySQL/0000_combine.sql rename to static/MySQL/0000_combined.sql index a1af69ec..af6c2662 100644 --- a/static/MySQL/0000_combine.sql +++ b/static/MySQL/0000_combined.sql @@ -1,3 +1,4 @@ +-- File: 0001_destroy.sql /* Clear Store DataBase */ @@ -18,6 +19,7 @@ DROP TABLE IF EXISTS tmp_Shop_Order; DROP TABLE IF EXISTS tmp_Shop_Product; DROP TABLE IF EXISTS tmp_Product; DROP TABLE IF EXISTS tmp_Product_Permutation; +DROP TABLE IF EXISTS tmp_Permutation_Variation_Link; DROP TABLE IF EXISTS tmp_Permutation; DROP TABLE IF EXISTS tmp_Shop_Product_p_shop_calc_user; DROP TABLE IF EXISTS tmp_Shop_Product_p_Shop_Calc_User; @@ -51,6 +53,7 @@ DROP TABLE IF EXISTS tmp_Manufacturing_Purchase_Order; DROP TABLE IF EXISTS tmp_Shop_Customer; DROP TABLE IF EXISTS tmp_Shop_Customer_Sale_Order_Product_Link; DROP TABLE IF EXISTS tmp_Shop_Customer_Sale_Order; +DROP TABLE IF EXISTS tmp_Get_Variation_From_Csv_Variations; # Delete old tables @@ -165,6 +168,7 @@ DROP TABLE IF EXISTS Shop_Product_Currency_Link; DROP TABLE IF EXISTS Shop_Product_Variation_Link_Audit; DROP TABLE IF EXISTS Shop_Product_Variation_Link; +DROP TABLE IF EXISTS Shop_Product_Permutation_Variation_Link_Temp; DROP TABLE IF EXISTS Shop_Product_Permutation_Variation_Link_Audit; DROP TABLE IF EXISTS Shop_Product_Permutation_Variation_Link; @@ -304,6 +308,8 @@ DROP PROCEDURE IF EXISTS p_shop_save_product_variation; DROP PROCEDURE IF EXISTS p_shop_save_product_variation_test; DROP PROCEDURE IF EXISTS p_shop_get_many_product_variation; DROP FUNCTION IF EXISTS fn_shop_get_id_product_permutation_from_variation_csv_list; +DROP FUNCTION IF EXISTS fn_shop_get_product_variations_from_id_csv_list; +DROP FUNCTION IF EXISTS fn_shop_get_product_permutation_variations_csv; DROP PROCEDURE IF EXISTS p_shop_save_stock_item; DROP PROCEDURE IF EXISTS p_shop_save_stock_item_test; DROP PROCEDURE IF EXISTS p_shop_get_many_stock_item; @@ -330,6 +336,9 @@ DROP PROCEDURE IF EXISTS p_shop_get_many_customer; DROP PROCEDURE IF EXISTS p_shop_save_customer_sales_order; DROP PROCEDURE IF EXISTS p_shop_get_many_customer_sales_order; + +-- File: 1000_tbl_Shop_Product_Change_Set.sql + # Product Change Sets @@ -342,6 +351,9 @@ CREATE TABLE Shop_Product_Change_Set ( updated_last_on DATETIME, updated_last_by VARCHAR(100) ); + +-- File: 1000_tbl_Split_Temp.sql + # Split Staging -- USE partsltd_prod; -- DROP TABLE IF EXISTS Split_Temp; @@ -354,6 +366,9 @@ CREATE TABLE Split_Temp ( , substring VARCHAR(4000) NOT NULL ); + +-- File: 1001_tbl_Shop_User_Change_Set.sql + # User Change Sets @@ -366,6 +381,9 @@ CREATE TABLE IF NOT EXISTS Shop_User_Change_Set ( updated_last_on DATETIME, updated_last_by VARCHAR(100) ); + +-- File: 1001_tbl_Split_Key_Value_Pair_Csv_Temp.sql + # Split Key Value Pair CSV Staging -- USE partsltd_prod; -- DROP TABLE IF EXISTS Split_Temp; @@ -379,6 +397,9 @@ CREATE TABLE Split_Key_Value_Pair_Csv_Temp ( , value_column VARCHAR(4000) NULL ); + +-- File: 1002_tbl_Shop_Sales_And_Purchasing_Change_Set.sql + # Sales And Purchasing Change Sets @@ -391,6 +412,9 @@ CREATE TABLE Shop_Sales_And_Purchasing_Change_Set ( updated_last_on DATETIME, updated_last_by VARCHAR(100) ); + +-- File: 1003_tbl_Shop_Access_Level.sql + # Access Levels @@ -414,6 +438,9 @@ CREATE TABLE IF NOT EXISTS Shop_Access_Level ( + +-- File: 1004_tbl_Shop_Access_Level_Audit.sql + # Access Level Audits @@ -435,6 +462,9 @@ CREATE TABLE IF NOT EXISTS Shop_Access_Level_Audit ( FOREIGN KEY (id_change_set) REFERENCES Shop_User_Change_Set(id_change_set) ); + +-- File: 1005_tbl_Msg_Error_Type.sql + # Error Message Type @@ -448,6 +478,9 @@ CREATE TABLE IF NOT EXISTS Shop_Msg_Error_Type ( description VARCHAR(1000) ); + +-- File: 1010_tbl_File_Type.sql + # File Types @@ -465,6 +498,9 @@ CREATE TABLE IF NOT EXISTS File_Type ( updated_last_by VARCHAR(100) ); + +-- File: 1011_tbl_File_Type_Audit.sql + # File Type Audit @@ -486,6 +522,9 @@ CREATE TABLE IF NOT EXISTS File_Type_Audit ( updated_last_on DATETIME, updated_last_by VARCHAR(100) ); + +-- File: 1012_tbl_Shop_General.sql + # Generic / shared properties @@ -502,6 +541,9 @@ CREATE TABLE IF NOT EXISTS Shop_General ( FOREIGN KEY (id_change_set) REFERENCES Shop_Product_Change_Set(id_change_set) ); + +-- File: 1013_tbl_Shop_General_Audit.sql + # Shop General Audits @@ -523,6 +565,9 @@ CREATE TABLE IF NOT EXISTS Shop_General_Audit ( FOREIGN KEY (id_change_set) REFERENCES Shop_Product_Change_Set(id_change_set) ); + +-- File: 1014_tbl_Shop_Image_Type.sql + # Image Types @@ -550,6 +595,9 @@ CREATE TABLE IF NOT EXISTS Shop_Image_Type ( REFERENCES Shop_Product_Change_Set(id_change_set) ); + +-- File: 1015_tbl_Shop_Image_Type_Audit.sql + # Image Type Audits @@ -571,6 +619,9 @@ CREATE TABLE IF NOT EXISTS Shop_Image_Type_Audit ( FOREIGN KEY (id_change_set) REFERENCES Shop_Product_Change_Set(id_change_set) ); + +-- File: 1100_tbl_Shop_Region.sql + # Regions SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_Region'; @@ -588,6 +639,9 @@ CREATE TABLE IF NOT EXISTS Shop_Region ( FOREIGN KEY (id_change_set) REFERENCES Shop_Product_Change_Set(id_change_set) ); + +-- File: 1101_tbl_Shop_Region_Audit.sql + # Region Audits @@ -609,6 +663,9 @@ CREATE TABLE IF NOT EXISTS Shop_Region_Audit ( FOREIGN KEY (id_change_set) REFERENCES Shop_Product_Change_Set(id_change_set) ); + +-- File: 1102_tbl_Shop_Region_Temp.sql + # Region Temp @@ -628,6 +685,9 @@ CREATE TABLE IF NOT EXISTS Shop_Region_Temp ( FOREIGN KEY (id_change_set) REFERENCES Shop_Product_Change_Set(id_change_set) ); + +-- File: 1103_tbl_Shop_Region_Branch.sql + # Region Branchs @@ -656,6 +716,9 @@ CREATE TABLE IF NOT EXISTS Shop_Region_Branch ( FOREIGN KEY (id_change_set) REFERENCES Shop_Product_Change_Set(id_change_set) ); + +-- File: 1104_tbl_Shop_Region_Branch_Audit.sql + # Region Audits @@ -677,6 +740,9 @@ CREATE TABLE IF NOT EXISTS Shop_Region_Branch_Audit ( FOREIGN KEY (id_change_set) REFERENCES Shop_Product_Change_Set(id_change_set) ); + +-- File: 1105_tbl_Shop_Region_Branch_Temp.sql + # Region Branch Temp @@ -691,6 +757,9 @@ CREATE TABLE IF NOT EXISTS Shop_Region_Branch_Temp ( active BIT NOT NULL DEFAULT 1, display_order INT NOT NULL ); + +-- File: 1106_tbl_Shop_Address.sql + # Addresses @@ -721,6 +790,9 @@ CREATE TABLE Shop_Address ( FOREIGN KEY (id_change_set) REFERENCES partsltd_prod.Shop_User_Change_Set(id_change_set) ); + +-- File: 1106_tbl_Shop_Plant.sql + # Plant SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_Plant'; @@ -743,6 +815,9 @@ CREATE TABLE IF NOT EXISTS Shop_Plant ( REFERENCES Shop_Product_Change_Set(id_change_set) ); + +-- File: 1107_tbl_Shop_Address_Audit.sql + # Address Audits SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_Address_Audit'; @@ -763,6 +838,9 @@ CREATE TABLE IF NOT EXISTS Shop_Address_Audit ( REFERENCES Shop_User_Change_Set(id_change_set) ON UPDATE RESTRICT ); + +-- File: 1107_tbl_Shop_Plant_Audit.sql + # Plant Audits @@ -785,6 +863,9 @@ CREATE TABLE IF NOT EXISTS Shop_Plant_Audit ( REFERENCES Shop_Product_Change_Set(id_change_set) ); + +-- File: 1108_tbl_Shop_Plant_Temp.sql + # Plant Temp @@ -801,6 +882,9 @@ CREATE TABLE IF NOT EXISTS Shop_Plant_Temp ( , guid BINARY(36) NOT NULL ); + +-- File: 1109_tbl_Shop_Storage_Location.sql + # Storage Location @@ -824,6 +908,9 @@ CREATE TABLE IF NOT EXISTS Shop_Storage_Location ( REFERENCES Shop_Product_Change_Set(id_change_set) ); + +-- File: 1110_tbl_Shop_Storage_Location_Audit.sql + # Storage Location Audits @@ -846,6 +933,9 @@ CREATE TABLE IF NOT EXISTS Shop_Storage_Location_Audit ( REFERENCES Shop_Product_Change_Set(id_change_set) ); + +-- File: 1111_tbl_Shop_Storage_Location_Temp.sql + # Storage Location Temp @@ -859,6 +949,9 @@ CREATE TABLE IF NOT EXISTS Shop_Storage_Location ( active BIT NOT NULL DEFAULT 1 ); + +-- File: 1112_tbl_Shop_Storage_Location_Branch.sql + # Storage Location Branch @@ -887,6 +980,9 @@ CREATE TABLE IF NOT EXISTS Shop_Storage_Location_Branch ( FOREIGN KEY (id_change_set) REFERENCES Shop_Product_Change_Set(id_change_set) ); + +-- File: 1113_tbl_Shop_Storage_Location_Branch_Audit.sql + # Storage Location Branch Audits @@ -909,6 +1005,9 @@ CREATE TABLE IF NOT EXISTS Shop_Storage_Location_Branch_Audit ( REFERENCES Shop_Product_Change_Set(id_change_set) ); + +-- File: 1114_tbl_Shop_Storage_Location_Branch_Temp.sql + # Storage Location Branch Temp @@ -923,6 +1022,9 @@ CREATE TABLE IF NOT EXISTS Shop_Storage_Location_Branch_Temp ( active BIT NOT NULL DEFAULT 1, display_order INT NOT NULL ); + +-- File: 1115_tbl_Shop_Currency.sql + # Currencies @@ -945,6 +1047,9 @@ CREATE TABLE IF NOT EXISTS Shop_Currency ( REFERENCES Shop_Product_Change_Set(id_change_set) ON UPDATE RESTRICT ); + +-- File: 1116_tbl_Shop_Currency_Audit.sql + # Currency Audits @@ -967,6 +1072,9 @@ CREATE TABLE IF NOT EXISTS Shop_Currency_Audit ( REFERENCES Shop_User_Change_Set(id_change_set) ON UPDATE RESTRICT ); + +-- File: 1117_tbl_Shop_Currency_Temp.sql + # Currency Temp @@ -982,6 +1090,9 @@ CREATE TABLE IF NOT EXISTS Shop_Currency_Temp ( active BIT NOT NULL DEFAULT 1, display_order INT NOT NULL ); + +-- File: 1118_tbl_Shop_Tax_Or_Surcharge.sql + # Taxes and Surcharges @@ -1020,6 +1131,9 @@ CREATE TABLE Shop_Tax_Or_Surcharge ( REFERENCES Shop_Product_Change_Set(id_change_set) ); + +-- File: 1119_tbl_Shop_Tax_Or_Surcharge_Audit.sql + # Tax Or Surcharge Audits @@ -1042,6 +1156,9 @@ CREATE TABLE IF NOT EXISTS Shop_Tax_Or_Surcharge_Audit ( REFERENCES Shop_Product_Change_Set(id_change_set) ON UPDATE RESTRICT ); + +-- File: 1120_tbl_Shop_Tax_Or_Surcharge_Temp.sql + # Taxes and Surcharges Temp @@ -1064,6 +1181,9 @@ CREATE TABLE Shop_Tax_Or_Surcharge_Temp ( display_order INT NOT NULL ); + +-- File: 1121_tbl_Shop_Unit_Measurement.sql + # Unit of Measurement @@ -1090,6 +1210,9 @@ CREATE TABLE IF NOT EXISTS Shop_Unit_Measurement ( REFERENCES Shop_Product_Change_Set(id_change_set) ); + +-- File: 1122_tbl_Shop_Unit_Measurement_Audit.sql + # Unit of Measurement Audits @@ -1112,6 +1235,9 @@ CREATE TABLE IF NOT EXISTS Shop_Unit_Measurement_Audit ( REFERENCES Shop_Product_Change_Set(id_change_set) ); + +-- File: 1124_tbl_Shop_Unit_Measurement_Conversion.sql + # Unit of Measurement Conversion @@ -1135,6 +1261,9 @@ CREATE TABLE IF NOT EXISTS Shop_Unit_Measurement_Conversion ( REFERENCES Shop_Product_Change_Set(id_change_set) ); + +-- File: 1125_tbl_Shop_Unit_Measurement_Conversion_Audit.sql + # Unit of Measurement Conversion Audits @@ -1157,6 +1286,9 @@ CREATE TABLE IF NOT EXISTS Shop_Unit_Measurement_Conversion_Audit ( REFERENCES Shop_Product_Change_Set(id_change_set) ); + +-- File: 1200_tbl_Shop_Product_Category.sql + # Categories @@ -1181,6 +1313,9 @@ CREATE TABLE IF NOT EXISTS Shop_Product_Category ( REFERENCES Shop_Product_Change_Set(id_change_set) ); + +-- File: 1201_tbl_Shop_Product_Category_Audit.sql + # Category Audits @@ -1203,6 +1338,9 @@ CREATE TABLE IF NOT EXISTS Shop_Product_Category_Audit ( REFERENCES Shop_Product_Change_Set(id_change_set) ); + +-- File: 1202_tbl_Shop_Product_Category_Temp.sql + # Categories Temp -- DROP TABLE Shop_Product_Category_Temp; @@ -1210,7 +1348,8 @@ CREATE TABLE IF NOT EXISTS Shop_Product_Category_Audit ( SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_Product_Category_Temp'; CREATE TABLE IF NOT EXISTS Shop_Product_Category_Temp ( - id_category INT NOT NULL + id_temp INT NOT NULL PRIMARY KEY AUTO_INCREMENT + , id_category INT NOT NULL , code VARCHAR(50) NOT NULL , name VARCHAR(255) NOT NULL , description VARCHAR(4000) NULL @@ -1223,6 +1362,9 @@ CREATE TABLE IF NOT EXISTS Shop_Product_Category_Temp ( , guid BINARY(36) NOT NULL ); + +-- File: 1203_tbl_Shop_Product.sql + # Products @@ -1271,6 +1413,9 @@ CREATE TABLE IF NOT EXISTS Shop_Product ( REFERENCES Shop_Product_Change_Set(id_change_set) ); + +-- File: 1204_tbl_Shop_Product_Audit.sql + # Products @@ -1292,6 +1437,9 @@ CREATE TABLE IF NOT EXISTS Shop_Product_Audit ( FOREIGN KEY (id_change_set) REFERENCES Shop_Product_Change_Set(id_change_set) ); + +-- File: 1205_tbl_Shop_Product_Temp.sql + # Products Temp -- DROP TABLE IF EXISTS Shop_Product_Temp; @@ -1299,7 +1447,8 @@ CREATE TABLE IF NOT EXISTS Shop_Product_Audit ( SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_Product_Temp'; CREATE TABLE IF NOT EXISTS Shop_Product_Temp ( - id_product INT NOT NULL + id_temp INT NOT NULL PRIMARY KEY AUTO_INCREMENT + , id_product INT NOT NULL , name VARCHAR(255) NOT NULL , id_category INT NOT NULL , has_variations BIT NOT NULL @@ -1312,6 +1461,9 @@ CREATE TABLE IF NOT EXISTS Shop_Product_Temp ( , guid BINARY(36) NOT NULL ); + +-- File: 1206_tbl_Shop_Product_Permutation.sql + # Product Permutation -- DROP TABLE partsltd_prod.Shop_Product_Permutation; @@ -1320,6 +1472,7 @@ SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning CREATE TABLE IF NOT EXISTS Shop_Product_Permutation ( id_permutation INT NOT NULL AUTO_INCREMENT PRIMARY KEY, + id_permutation_temp INT NOT NULL, id_product INT NOT NULL, CONSTRAINT FK_Shop_Product_Permutation_id_product FOREIGN KEY (id_product) @@ -1372,6 +1525,9 @@ CREATE TABLE IF NOT EXISTS Shop_Product_Permutation ( REFERENCES Shop_Product_Change_Set(id_change_set) ); + +-- File: 1207_tbl_Shop_Product_Permutation_Audit.sql + # Product Permutation Audits @@ -1395,6 +1551,9 @@ CREATE TABLE IF NOT EXISTS Shop_Product_Permutation_Audit ( ON UPDATE RESTRICT ); + +-- File: 1208_tbl_Shop_Product_Permutation_Temp.sql + # Product Permutation Temp -- DROP TABLE IF EXISTS Shop_Product_Permutation_Temp; @@ -1402,8 +1561,10 @@ CREATE TABLE IF NOT EXISTS Shop_Product_Permutation_Audit ( SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_Product_Permutation_Temp'; CREATE TABLE IF NOT EXISTS Shop_Product_Permutation_Temp ( - id_permutation INT NOT NULL + id_temp INT NOT NULL PRIMARY KEY AUTO_INCREMENT + , id_permutation INT NOT NULL , id_product INT NOT NULL + , csv_id_pairs_variation VARCHAR(4000) NULL , description VARCHAR(4000) NOT NULL , cost_local_VAT_excl FLOAT NULL , cost_local_VAT_incl FLOAT NULL @@ -1430,6 +1591,9 @@ CREATE TABLE IF NOT EXISTS Shop_Product_Permutation_Temp ( , can_admin BIT NULL DEFAULT NULL ); + +-- File: 1209_tbl_Shop_Variation_Type.sql + # Variation Types @@ -1451,6 +1615,9 @@ CREATE TABLE IF NOT EXISTS Shop_Variation_Type ( FOREIGN KEY (id_change_set) REFERENCES Shop_Product_Change_Set(id_change_set) ); + +-- File: 1210_tbl_Shop_Variation_Type_Audit.sql + # Variation Type Audits @@ -1473,6 +1640,9 @@ CREATE TABLE IF NOT EXISTS Shop_Variation_Type_Audit ( REFERENCES Shop_Product_Change_Set(id_change_set) ); + +-- File: 1211_tbl_Shop_Variation_Type_Temp.sql + # Variation Types Temp -- DROP TABLE partsltd_prod.Shop_Variation_Type_Temp; @@ -1492,6 +1662,9 @@ CREATE TABLE IF NOT EXISTS Shop_Variation_Type_Temp ( , created_by INT , guid BINARY(36) NOT NULL ); + +-- File: 1212_tbl_Shop_Variation.sql + # Variations @@ -1522,6 +1695,9 @@ CREATE TABLE Shop_Variation ( REFERENCES partsltd_prod.Shop_Product_Change_Set(id_change_set) ); + +-- File: 1213_tbl_Shop_Variation_Audit.sql + # Variation Audits @@ -1544,6 +1720,9 @@ CREATE TABLE IF NOT EXISTS Shop_Variation_Audit ( REFERENCES Shop_Product_Change_Set(id_change_set) ); + +-- File: 1214_tbl_Shop_Variation_Temp.sql + # Variations Temp -- DROP TABLE partsltd_prod.Shop_Variation_Temp; @@ -1565,6 +1744,9 @@ CREATE TABLE Shop_Variation_Temp ( , guid BINARY(36) ); + +-- File: 1215_tbl_Shop_Product_Permutation_Variation_Link.sql + # Product Permutation Variation Link @@ -1593,6 +1775,9 @@ CREATE TABLE IF NOT EXISTS Shop_Product_Permutation_Variation_Link ( REFERENCES Shop_Product_Change_Set(id_change_set) ); + +-- File: 1216_tbl_Shop_Product_Permutation_Variation_Link_Audit.sql + # Product Permutation Variation Link Audits @@ -1615,6 +1800,28 @@ CREATE TABLE IF NOT EXISTS Shop_Product_Permutation_Variation_Link_Audit ( REFERENCES Shop_Product_Change_Set(id_change_set) ON UPDATE RESTRICT ); + +-- File: 1217_tbl_Shop_Product_Permutation_Variation_Link_Temp.sql + +# Product Permutation Variation Link + +-- DROP TABLE IF EXISTS Shop_Product_Permutation_Variation_Link_Temp; + +SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_Product_Permutation_Variation_Link_Temp'; + +CREATE TABLE IF NOT EXISTS Shop_Product_Permutation_Variation_Link_Temp ( + id_temp INT NOT NULL AUTO_INCREMENT PRIMARY KEY + , id_link INT NOT NULL + , id_permutation INT NOT NULL + , id_variation INT NOT NULL + , active BIT NOT NULL + , display_order INT NOT NULL + , GUID BINARY(36) NOT NULL +); + + +-- File: 1218_tbl_Shop_Stock_Item.sql + # Stock Stock Item -- DROP TABLE IF EXISTS Shop_Stock_Item; @@ -1653,6 +1860,9 @@ CREATE TABLE IF NOT EXISTS Shop_Stock_Item ( REFERENCES Shop_Product_Change_Set(id_change_set) ); + +-- File: 1219_tbl_Shop_Stock_Item_Audit.sql + # Stock Item Audits @@ -1676,6 +1886,9 @@ CREATE TABLE IF NOT EXISTS Shop_Stock_Item_Audit ( ON UPDATE RESTRICT ); + +-- File: 1220_tbl_Shop_Stock_Item_Temp.sql + # Stock Stock Item Temp DROP TABLE IF EXISTS Shop_Stock_Item_Temp; @@ -1703,6 +1916,9 @@ CREATE TABLE IF NOT EXISTS Shop_Stock_Item_Temp ( , guid BINARY(36) NOT NULL ); + +-- File: 1221_tbl_Shop_Product_Price.sql + # Product Price @@ -1734,6 +1950,9 @@ CREATE TABLE IF NOT EXISTS Shop_Product_Price ( FOREIGN KEY (id_change_set) REFERENCES Shop_Product_Change_Set(id_change_set) ); + +-- File: 1222_tbl_Shop_Product_Price_Audit.sql + # Product Price Audits @@ -1756,6 +1975,9 @@ CREATE TABLE IF NOT EXISTS Shop_Product_Price_Audit ( REFERENCES Shop_Product_Change_Set(id_change_set) ); + +-- File: 1223_tbl_Shop_Product_Price_Temp.sql + # Product Price Temp @@ -1772,6 +1994,9 @@ CREATE TABLE IF NOT EXISTS Shop_Product_Price_Temp ( id_stripe_price VARCHAR(200), active BIT NOT NULL DEFAULT 1 ); + +-- File: 1224_tbl_Shop_Product_Image.sql + # Product Permutation Images @@ -1798,6 +2023,9 @@ CREATE TABLE IF NOT EXISTS Shop_Product_Image ( FOREIGN KEY (id_change_set) REFERENCES Shop_Product_Change_Set(id_change_set) ); + +-- File: 1225_tbl_Shop_Product_Image_Audit.sql + # Product Image Audits @@ -1818,6 +2046,9 @@ CREATE TABLE IF NOT EXISTS Shop_Product_Image_Audit ( FOREIGN KEY (id_change_set) REFERENCES Shop_Product_Change_Set(id_change_set) ); + +-- File: 1227_tbl_Shop_Delivery_Option.sql + # Delivery Options @@ -1845,6 +2076,9 @@ CREATE TABLE IF NOT EXISTS Shop_Delivery_Option ( REFERENCES Shop_Product_Change_Set(id_change_set) ); + +-- File: 1228_tbl_Shop_Delivery_Option_Audit.sql + # Delivery Option Audits @@ -1866,6 +2100,9 @@ CREATE TABLE IF NOT EXISTS Shop_Delivery_Option_Audit ( FOREIGN KEY (id_change_set) REFERENCES Shop_Product_Change_Set(id_change_set) ); + +-- File: 1230_tbl_Shop_Product_Permutation_Delivery_Option_Link.sql + # Delivery Option @@ -1911,6 +2148,9 @@ CREATE TABLE IF NOT EXISTS Shop_Product_Permutation_Delivery_Option_Link ( FOREIGN KEY (id_change_set) REFERENCES Shop_Product_Change_Set(id_change_set) ); + +-- File: 1231_tbl_Shop_Product_Permutation_Delivery_Option_Link_Audit.sql + # Delivery Option Audits @@ -1932,6 +2172,9 @@ CREATE TABLE IF NOT EXISTS Shop_Product_Permutation_Delivery_Option_Link_Audit ( FOREIGN KEY (id_change_set) REFERENCES Shop_Product_Change_Set(id_change_set) ); + +-- File: 1233_tbl_Shop_Discount.sql + # Discounts @@ -1980,6 +2223,9 @@ CREATE TABLE Shop_Discount ( REFERENCES Shop_Product_Change_Set(id_change_set) ); + +-- File: 1234_tbl_Shop_Discount_Audit.sql + # Discount Audits @@ -2002,6 +2248,9 @@ CREATE TABLE IF NOT EXISTS Shop_Discount_Audit ( REFERENCES Shop_Product_Change_Set(id_change_set) ON UPDATE RESTRICT ); + +-- File: 1236_tbl_Shop_Discount_Region_Currency_Link.sql + # Discount Region Currency Link @@ -2033,6 +2282,9 @@ CREATE TABLE IF NOT EXISTS Shop_Discount_Region_Currency_Link ( FOREIGN KEY (id_change_set) REFERENCES Shop_Product_Change_Set(id_change_set) ); + +-- File: 1237_tbl_Shop_Discount_Region_Currency_Link_Audit.sql + # Discount Region Currency Link Audits @@ -2055,6 +2307,9 @@ CREATE TABLE IF NOT EXISTS Shop_Discount_Region_Currency_Link_Audit ( REFERENCES Shop_Product_Change_Set(id_change_set) ON UPDATE RESTRICT ); + +-- File: 1300_tbl_Shop_Permission_Group.sql + # Permission Groups @@ -2075,6 +2330,9 @@ CREATE TABLE IF NOT EXISTS Shop_Permission_Group ( REFERENCES Shop_User_Change_Set(id_change_set) ON UPDATE RESTRICT ); + +-- File: 1301_tbl_Shop_Permission_Group_Audit.sql + # Permission Group Audits @@ -2097,6 +2355,9 @@ CREATE TABLE IF NOT EXISTS Shop_Permission_Group_Audit ( REFERENCES Shop_User_Change_Set(id_change_set) ON UPDATE RESTRICT ); + +-- File: 1303_tbl_Shop_Permission.sql + # Permissions @@ -2125,6 +2386,9 @@ CREATE TABLE IF NOT EXISTS Shop_Permission ( FOREIGN KEY (id_change_set) REFERENCES Shop_User_Change_Set(id_change_set) ); + +-- File: 1304_tbl_Shop_Permission_Audit.sql + # Permission Audits @@ -2147,6 +2411,9 @@ CREATE TABLE IF NOT EXISTS Shop_Permission_Audit ( REFERENCES Shop_User_Change_Set(id_change_set) ON UPDATE RESTRICT ); + +-- File: 1306_tbl_Shop_Role.sql + # Roles @@ -2166,6 +2433,9 @@ CREATE TABLE IF NOT EXISTS Shop_Role ( FOREIGN KEY (id_change_set) REFERENCES Shop_User_Change_Set(id_change_set) ); + +-- File: 1307_tbl_Shop_Role_Audit.sql + # Role Audits @@ -2188,6 +2458,9 @@ CREATE TABLE Shop_Role_Audit ( REFERENCES Shop_User_Change_Set(id_change_set) ON UPDATE RESTRICT ); + +-- File: 1309_tbl_Shop_Role_Permission_Link.sql + # Role Permission link @@ -2218,6 +2491,9 @@ CREATE TABLE IF NOT EXISTS Shop_Role_Permission_Link ( FOREIGN KEY (id_change_set) REFERENCES Shop_User_Change_Set(id_change_set) ); + +-- File: 1310_tbl_Shop_Role_Permission_Link_Audit.sql + # Role Permission link Audits @@ -2239,6 +2515,9 @@ CREATE TABLE IF NOT EXISTS Shop_Role_Permission_Link_Audit ( FOREIGN KEY (id_change_set) REFERENCES Shop_User_Change_Set(id_change_set) ); + +-- File: 1312_tbl_Shop_User.sql + # Users @@ -2265,6 +2544,9 @@ CREATE TABLE IF NOT EXISTS Shop_User ( REFERENCES Shop_User_Change_Set(id_change_set) ); + +-- File: 1313_tbl_Shop_User_Audit.sql + # User Audits @@ -2287,6 +2569,9 @@ CREATE TABLE IF NOT EXISTS Shop_User_Audit ( REFERENCES Shop_User_Change_Set(id_change_set) ON UPDATE RESTRICT ); + +-- File: 1315_tbl_Shop_User_Role_Link.sql + # User Role link @@ -2312,6 +2597,9 @@ CREATE TABLE IF NOT EXISTS Shop_User_Role_Link ( FOREIGN KEY (id_change_set) REFERENCES Shop_User_Change_Set(id_change_set) ); + +-- File: 1316_tbl_Shop_User_Role_Link_Audit.sql + # User Role Link Audits @@ -2334,6 +2622,9 @@ CREATE TABLE IF NOT EXISTS Shop_User_Role_Link_Audit ( REFERENCES Shop_User_Change_Set(id_change_set) ); + +-- File: 1318_tbl_Shop_User_Address.sql + # User Addresses SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_User_Address'; @@ -2362,6 +2653,9 @@ CREATE TABLE Shop_User_Address ( FOREIGN KEY (id_change_set) REFERENCES Shop_User_Change_Set(id_change_set) ); + +-- File: 1319_tbl_Shop_User_Address_Audit.sql + # Address Audits SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_User_Address_Audit'; @@ -2382,6 +2676,9 @@ CREATE TABLE IF NOT EXISTS Shop_User_Address_Audit ( REFERENCES Shop_User_Change_Set(id_change_set) ON UPDATE RESTRICT ); + +-- File: 1321_tbl_Shop_User_Basket.sql + # User Basket (Product Link) @@ -2421,6 +2718,9 @@ CREATE TABLE IF NOT EXISTS Shop_User_Basket ( */ ); + +-- File: 1322_tbl_Shop_User_Basket_Audit.sql + # Product Basket Audits @@ -2448,6 +2748,9 @@ CREATE TABLE IF NOT EXISTS Shop_User_Basket_Audit ( */ ); + +-- File: 1397_tbl_Shop_Order_Status.sql + # User Order Types @@ -2469,6 +2772,9 @@ CREATE TABLE IF NOT EXISTS Shop_User_Order_Status ( REFERENCES Shop_User_Change_Set(id_change_set) ); + +-- File: 1398_tbl_Shop_Order_Status_Audit.sql + # Order Type Audits @@ -2490,6 +2796,9 @@ CREATE TABLE IF NOT EXISTS Shop_User_Order_Status_Audit ( FOREIGN KEY (id_change_set) REFERENCES Shop_Product_Change_Set(id_change_set) ); + +-- File: 1400_tbl_Shop_Supplier.sql + # Supplier SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_Supplier'; @@ -2523,6 +2832,9 @@ CREATE TABLE IF NOT EXISTS Shop_Supplier ( , id_supplier_temp INT NOT NULL ); + +-- File: 1401_tbl_Shop_Supplier_Audit.sql + # Supplier Audits @@ -2545,6 +2857,9 @@ CREATE TABLE IF NOT EXISTS Shop_Supplier_Audit ( REFERENCES Shop_User_Change_Set(id_change_set) ); + +-- File: 1402_tbl_Shop_Supplier_Temp.sql + # Supplier Staging SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_Supplier_Temp'; @@ -2565,6 +2880,9 @@ CREATE TABLE IF NOT EXISTS Shop_Supplier_Temp ( GUID BINARY(36) NOT NULL ); + +-- File: 1403_tbl_Shop_Supplier_Address.sql + # Supplier Addresses SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_Supplier_Address'; @@ -2593,6 +2911,9 @@ CREATE TABLE Shop_Supplier_Address ( FOREIGN KEY (id_change_set) REFERENCES partsltd_prod.Shop_User_Change_Set(id_change_set) ); + +-- File: 1404_tbl_Shop_Supplier_Address_Audit.sql + # Supplier Address Audits SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_Supplier_Address_Audit'; @@ -2613,6 +2934,9 @@ CREATE TABLE IF NOT EXISTS Shop_Supplier_Address_Audit ( REFERENCES Shop_User_Change_Set(id_change_set) ON UPDATE RESTRICT ); + +-- File: 1405_tbl_Shop_Supplier_Address_Temp.sql + # Supplier Addresses Staging SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_Supplier_Address_Temp'; @@ -2629,6 +2953,9 @@ CREATE TABLE Shop_Supplier_Address_Temp ( , active BIT NOT NULL DEFAULT 1 , GUID BINARY(36) NOT NULL ); + +-- File: 1409_tbl_Shop_Supplier_Purchase_Order.sql + # Supplier Purchase Order @@ -2672,6 +2999,9 @@ CREATE TABLE IF NOT EXISTS Shop_Supplier_Purchase_Order ( REFERENCES Shop_Sales_And_Purchasing_Change_Set(id_change_set) ); + +-- File: 1410_tbl_Shop_Supplier_Purchase_Order_Audit.sql + # Supplier Purchase Order Audits @@ -2694,6 +3024,9 @@ CREATE TABLE IF NOT EXISTS Shop_Supplier_Purchase_Order_Audit ( REFERENCES Shop_Sales_And_Purchasing_Change_Set(id_change_set) ); + +-- File: 1411_tbl_Shop_Supplier_Purchase_Order_Temp.sql + # Supplier Purchase Order Staging DROP TABLE IF EXISTS Shop_Supplier_Purchase_Order_Temp; @@ -2709,6 +3042,9 @@ CREATE TABLE IF NOT EXISTS Shop_Supplier_Purchase_Order_Temp ( , GUID BINARY(36) NOT NULL ); + +-- File: 1412_tbl_Shop_Supplier_Purchase_Order_Product_Link.sql + # Supplier Purchase Order Product Link @@ -2749,6 +3085,9 @@ CREATE TABLE IF NOT EXISTS Shop_Supplier_Purchase_Order_Product_Link ( REFERENCES Shop_Sales_And_Purchasing_Change_Set(id_change_set) ); + +-- File: 1413_tbl_Shop_Supplier_Purchase_Order_Product_Link_Audit.sql + # Supplier Purchase Order Product Link Audits @@ -2771,6 +3110,9 @@ CREATE TABLE IF NOT EXISTS Shop_Supplier_Purchase_Order_Product_Link_Audit ( REFERENCES Shop_Sales_And_Purchasing_Change_Set(id_change_set) ); + +-- File: 1414_tbl_Shop_Supplier_Purchase_Order_Product_Link_Temp.sql + # Supplier Purchase Order Product Link Temp @@ -2797,6 +3139,9 @@ CREATE TABLE IF NOT EXISTS Shop_Supplier_Purchase_Order_Product_Link_Temp ( , GUID BINARY(36) NOT NULL ); + +-- File: 1415_tbl_Shop_Manufacturing_Purchase_Order.sql + # Manufacturing Purchase Order SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_Manufacturing_Purchase_Order'; @@ -2837,6 +3182,9 @@ CREATE TABLE IF NOT EXISTS Shop_Manufacturing_Purchase_Order ( REFERENCES Shop_Sales_And_Purchasing_Change_Set(id_change_set) ); + +-- File: 1416_tbl_Shop_Manufacturing_Purchase_Order_Audit.sql + # Manufacturing Purchase Order Audits @@ -2859,6 +3207,9 @@ CREATE TABLE IF NOT EXISTS Shop_Manufacturing_Purchase_Order_Audit ( REFERENCES Shop_Sales_And_Purchasing_Change_Set(id_change_set) ); + +-- File: 1417_tbl_Shop_Manufacturing_Purchase_Order_Temp.sql + # Manufacturing Purchase Order Temp -- DROP TABLE Shop_Manufacturing_Purchase_Order_Temp @@ -2890,6 +3241,9 @@ CREATE TABLE IF NOT EXISTS Shop_Manufacturing_Purchase_Order_Temp ( GUID BINARY(36) NOT NULL ); + +-- File: 1418_tbl_Shop_Manufacturing_Purchase_Order_Product_Link.sql + # Manufacturing Purchase Order Product Link -- DROP TABLE partsltd_prod.Shop_Manufacturing_Purchase_Order_Product_Link_Audit @@ -2934,6 +3288,9 @@ CREATE TABLE IF NOT EXISTS Shop_Manufacturing_Purchase_Order_Product_Link ( REFERENCES partsltd_prod.Shop_Sales_And_Purchasing_Change_Set(id_change_set) ); + +-- File: 1419_tbl_Shop_Manufacturing_Purchase_Order_Product_Link_Audit.sql + # Manufacturing Purchase Order Product Link Audits @@ -2956,6 +3313,9 @@ CREATE TABLE IF NOT EXISTS Shop_Manufacturing_Purchase_Order_Product_Link_Audit REFERENCES Shop_Sales_And_Purchasing_Change_Set(id_change_set) ); + +-- File: 1420_tbl_Shop_Manufacturing_Purchase_Order_Product_Link_Temp.sql + # Manufacturing Purchase Order Product Link Temp -- DROP TABLE Shop_Manufacturing_Purchase_Order_Product_Link_Temp; @@ -2983,6 +3343,9 @@ CREATE TABLE IF NOT EXISTS Shop_Manufacturing_Purchase_Order_Product_Link_Temp ( price_unit_local_VAT_incl FLOAT NULL, GUID BINARY(36) NOT NULL ); + + +-- File: 1421_tbl_Shop_Customer.sql # Customer @@ -3013,6 +3376,9 @@ CREATE TABLE IF NOT EXISTS Shop_Customer ( REFERENCES Shop_Sales_And_Purchasing_Change_Set(id_change_set) ); + +-- File: 1422_tbl_Shop_Customer_Audit.sql + # Customer Audits @@ -3035,6 +3401,9 @@ CREATE TABLE IF NOT EXISTS Shop_Customer_Audit ( REFERENCES Shop_Sales_And_Purchasing_Change_Set(id_change_set) ); + +-- File: 1424_tbl_Shop_Customer_Sales_Order.sql + # Customer Sales Purchase Order @@ -3070,6 +3439,9 @@ CREATE TABLE IF NOT EXISTS Shop_Customer_Sales_Order ( REFERENCES Shop_Sales_And_Purchasing_Change_Set(id_change_set) ); + +-- File: 1425_tbl_Shop_Customer_Sales_Order_Audit.sql + # Customer Sales Order Audits @@ -3092,6 +3464,9 @@ CREATE TABLE IF NOT EXISTS Shop_Customer_Sales_Order_Audit ( REFERENCES Shop_Sales_And_Purchasing_Change_Set(id_change_set) ); + +-- File: 1427_tbl_Shop_Customer_Sales_Order_Product_Link.sql + # Customer Sales Order Product Link @@ -3130,6 +3505,9 @@ CREATE TABLE IF NOT EXISTS Shop_Customer_Sales_Order_Product_Link ( REFERENCES Shop_Sales_And_Purchasing_Change_Set(id_change_set) ); + +-- File: 1428_tbl_Shop_Customer_Sales_Order_Product_Link_Audit.sql + # Customer Sales Order Product Link Audits @@ -3152,6 +3530,9 @@ CREATE TABLE IF NOT EXISTS Shop_Customer_Sales_Order_Product_Link_Audit ( REFERENCES Shop_Sales_And_Purchasing_Change_Set(id_change_set) ); + +-- File: 1429_tbl_Shop_Customer_Sales_Order_Product_Link_Temp.sql + # Customer Sales Order Product Link Temp @@ -3186,6 +3567,9 @@ CREATE TABLE IF NOT EXISTS Shop_Customer_Sales_Order_Product_Link_Temp ( active BIT NOT NULL ); + +-- File: 1500_tbl_Shop_Calc_User_Temp.sql + # Calc User Staging -- USE partsltd_prod; -- DROP TABLE IF EXISTS Shop_Calc_User_Temp; @@ -3211,6 +3595,9 @@ CREATE TABLE Shop_Calc_User_Temp ( can_edit BIT, can_admin BIT ); + +-- File: 3000_tri_Shop_Access_Level.sql + # Shop Access Level @@ -3270,6 +3657,9 @@ BEGIN END // DELIMITER ;; + +-- File: 3000_tri_Shop_Product_Change_Set.sql + # Product Change Set @@ -3290,6 +3680,9 @@ BEGIN END // DELIMITER ;; + +-- File: 3001_tri_Shop_User_Change_Set.sql + # Shop User Change Set @@ -3310,6 +3703,9 @@ BEGIN END IF; END // DELIMITER ;; + +-- File: 3002_tri_Shop_Sales_And_Purchasing_Change_Set.sql + # Product Change Set @@ -3330,6 +3726,9 @@ BEGIN END // DELIMITER ;; + +-- File: 3010_tri_File_Type.sql + # File Type @@ -3373,6 +3772,9 @@ BEGIN END // DELIMITER ;; + +-- File: 3011_tri_File_Type_Audit.sql + # File Type Audits @@ -3400,6 +3802,9 @@ BEGIN SET NEW.updated_last_by = CURRENT_USER(); END // DELIMITER ;; + +-- File: 3012_tri_Shop_General.sql + # Shop General @@ -3440,6 +3845,9 @@ BEGIN ; END // DELIMITER ;; + +-- File: 3014_tri_Shop_Image_Type.sql + # Shop Image Type @@ -3504,6 +3912,9 @@ BEGIN ; END // DELIMITER ;; + +-- File: 3100_tri_Shop_Region.sql + # Shop Delivery Region @@ -3559,6 +3970,9 @@ BEGIN END // DELIMITER ;; + +-- File: 3103_tri_Shop_Region_Branch.sql + # Shop Region Branch @@ -3612,6 +4026,9 @@ BEGIN END // DELIMITER ;; + +-- File: 3106_tri_Shop_Address.sql + # Shop Address @@ -3678,6 +4095,9 @@ BEGIN ; END // DELIMITER ;; + +-- File: 3109_tri_Shop_Storage_Location.sql + # Shop Storage Location @@ -3733,6 +4153,9 @@ BEGIN END // DELIMITER ;; + +-- File: 3115_tri_Shop_Currency.sql + # Shop Currency @@ -3795,6 +4218,9 @@ BEGIN ; END // DELIMITER ;; + +-- File: 3118_tri_Shop_Tax_Or_Surcharge.sql + # Shop Tax_Or_Surcharge @@ -3870,6 +4296,9 @@ END // DELIMITER ;; + +-- File: 3200_tri_Shop_Category.sql + # Shop Category @@ -3931,6 +4360,9 @@ BEGIN END // DELIMITER ;; + +-- File: 3203_tri_Shop_Product.sql + # Shop Product @@ -4101,6 +4533,9 @@ BEGIN END // DELIMITER ;; + +-- File: 3206_tri_Shop_Product_Permutation.sql + # Shop Product Permutation @@ -4264,6 +4699,9 @@ BEGIN END // DELIMITER ;; + +-- File: 3209_tri_Shop_Variation_Type.sql + # Shop Variation Type @@ -4324,6 +4762,9 @@ BEGIN END // DELIMITER ;; + +-- File: 3212_tri_Shop_Variation.sql + # Shop Variation @@ -4387,6 +4828,9 @@ BEGIN END // DELIMITER ;; + +-- File: 3215_tri_Shop_Product_Permutation_Variation_Link.sql + # Shop Product Permutation Variation Link @@ -4443,6 +4887,9 @@ BEGIN ; END // DELIMITER ;; + +-- File: 3218_tri_Shop_Stock_Item.sql + # Shop Product Permutation @@ -4534,6 +4981,9 @@ BEGIN END // DELIMITER ;; + +-- File: 3221_tri_Shop_Product_Price.sql + # Shop Product Currency Link @@ -4621,6 +5071,9 @@ BEGIN END // DELIMITER ;; + +-- File: 3224_tri_Shop_Product_Image.sql + # Shop Image @@ -4693,6 +5146,9 @@ BEGIN ; END // DELIMITER ;; + +-- File: 3227_tri_Shop_Delivery_Option.sql + # Shop Delivery Option Type @@ -4765,6 +5221,9 @@ BEGIN ; END // DELIMITER ;; + +-- File: 3230_tri_Shop_Product_Permutation_Delivery_Option_Link.sql + # Shop Product Delivery Option Link @@ -4843,6 +5302,9 @@ BEGIN ; END // DELIMITER ;; + +-- File: 3233_tri_Shop_Discount.sql + # Shop Discount @@ -4926,6 +5388,9 @@ END // DELIMITER ;; + +-- File: 3236_tri_Shop_Discount_Region_Currency_Link.sql + # Shop Discount Region Currency Link @@ -4978,6 +5443,9 @@ BEGIN ; END // DELIMITER ;; + +-- File: 3300_tri_Shop_Permission_Group.sql + # Shop Permission Group @@ -5032,6 +5500,9 @@ BEGIN ; END // DELIMITER ;; + +-- File: 3303_tri_Shop_Permission.sql + # Shop Permission @@ -5094,6 +5565,9 @@ BEGIN ; END // DELIMITER ;; + +-- File: 3306_tri_Shop_Role.sql + # Shop Role @@ -5149,6 +5623,9 @@ BEGIN END // DELIMITER ;; + +-- File: 3309_tri_Shop_Role_Permission_Link.sql + # Shop Role Permission Link @@ -5206,6 +5683,9 @@ BEGIN END // DELIMITER ;; + +-- File: 3312_tri_Shop_User.sql + # Shop User @@ -5284,6 +5764,9 @@ BEGIN ; END // DELIMITER ;; + +-- File: 3315_tri_Shop_User_Role_Link.sql + # Shop User Role Link @@ -5326,6 +5809,9 @@ BEGIN ; END // DELIMITER ;; + +-- File: 3318_tri_Shop_User_Address.sql + # Shop Address @@ -5400,6 +5886,9 @@ BEGIN ; END // DELIMITER ;; + +-- File: 3321_tri_Shop_User_Basket.sql + # Shop Product Variation Link @@ -5454,6 +5943,9 @@ BEGIN ; END // DELIMITER ;; + +-- File: 3324_tri_Shop_User_Order_Status.sql + # Shop User Order Type @@ -5512,6 +6004,9 @@ BEGIN ; END // DELIMITER ;; + +-- File: 3400_tri_Shop_Supplier.sql + # Shop Supplier @@ -5593,6 +6088,9 @@ BEGIN END // DELIMITER ;; + +-- File: 3403_tri_Shop_Supplier_Address.sql + # Shop Supplier Address DROP TRIGGER IF EXISTS before_insert_Shop_Supplier_Address; @@ -5657,6 +6155,9 @@ BEGIN ; END // DELIMITER ;; + +-- File: 3403_tri_Shop_Unit_Measurement.sql + # Shop Unit of Measurement @@ -5733,6 +6234,9 @@ END // DELIMITER ;; + +-- File: 3406_tri_Shop_Unit_Of_Measurement_Conversion.sql + # Shop Unit of Measurement Conversion @@ -5797,6 +6301,9 @@ END // DELIMITER ;; + +-- File: 3409_tri_Shop_Supplier_Purchase_Order.sql + # Shop Supplier Purchase Order @@ -5875,6 +6382,9 @@ END // DELIMITER ;; + +-- File: 3412_tri_Shop_Supplier_Purchase_Order_Product_Link.sql + # Shop Supplier Purchase Order Product Link @@ -5968,6 +6478,9 @@ BEGIN END // DELIMITER ;; + +-- File: 3415_tri_Shop_Manufacturing_Purchase_Order.sql + # Shop Manufacturing Purchase Order @@ -6039,6 +6552,9 @@ BEGIN END // DELIMITER ;; + +-- File: 3418_tri_Shop_Manufacturing_Purchase_Order_Product_Link.sql + # Shop Manufacturing Purchase Order Product Link @@ -6131,6 +6647,9 @@ END // DELIMITER ;; + +-- File: 3421_tri_Shop_Customer.sql + # Shop Customer @@ -6203,6 +6722,9 @@ END // DELIMITER ;; + +-- File: 3424_tri_Shop_Customer_Sales_Order.sql + # Shop Customer Sales Order @@ -6258,6 +6780,9 @@ BEGIN END // DELIMITER ;; + +-- File: 3427_tri_Shop_Customer_Sales_Order_Product_Link.sql + # Shop Customer Sales Order Product Link @@ -6336,6 +6861,9 @@ BEGIN ; END // DELIMITER ;; + + +-- File: 6000_p_debug_timing_reporting.sql -- USE partsltd_prod; -- Clear previous proc @@ -6380,6 +6908,9 @@ CALL partsltd_prod.p_debug_timing_reporting ( ); */ +-- File: 6000_p_split.sql + + DROP PROCEDURE IF EXISTS p_split; DELIMITER // @@ -6483,6 +7014,9 @@ WHERE GUID = 'nips'; CALL p_clear_split_temp( 'nips' ); */ + +-- File: 6001_p_clear_split_temp.sql + -- Clear previous proc DROP PROCEDURE IF EXISTS p_clear_split_temp; @@ -6513,6 +7047,9 @@ CALL p_clear_split_temp ( 'nips' ); */ +-- File: 6001_p_validate_guid.sql + + DROP PROCEDURE IF EXISTS p_validate_guid; DROP PROCEDURE IF EXISTS p_validate_guid_test; @@ -6571,6 +7108,9 @@ DELIMITER ;; CALL p_validate_guid_test(); +-- File: 6003_p_split_key_value_pair_csv.sql + + DROP PROCEDURE IF EXISTS p_split_key_value_pair_csv; DELIMITER // @@ -6678,6 +7218,9 @@ WHERE GUID = 'nipsnipsnipsnipsnipsnipsnipsnipsnips'; CALL p_clear_split_key_value_pair_csv_temp( 'nipsnipsnipsnipsnipsnipsnipsnipsnips' ); */ + +-- File: 6004_p_clear_split_key_value_pair_csv_temp.sql + -- Clear previous proc DROP PROCEDURE IF EXISTS p_clear_split_key_value_pair_csv_temp; @@ -6707,6 +7250,9 @@ CALL p_clear_split_key_value_pair_csv_temp ( 'nipsnipsnipsnipsnipsnipsnipsnipsni */ + +-- File: 6206_fn_shop_get_product_permutation_name.sql + DROP FUNCTION IF EXISTS fn_shop_get_product_permutation_name; DELIMITER // @@ -6750,6 +7296,9 @@ SELECT ) ; */ + +-- File: 6210_fn_shop_get_id_product_permutation_from_variation_csv_list.sql + DROP FUNCTION IF EXISTS fn_shop_get_id_product_permutation_from_variation_csv_list; DELIMITER // @@ -6971,6 +7520,165 @@ WHERE GUID = 'nipsnipsnipsnipsnipsnipsnipsnipsnips'; CALL p_clear_split_key_value_pair_csv_temp( 'nipsnipsnipsnipsnipsnipsnipsnipsnips' ); */ + +-- File: 6211_fn_shop_get_product_variations_from_id_csv_list.sql + +DROP FUNCTION IF EXISTS fn_shop_get_product_variations_from_id_csv_list; + +DELIMITER // + +CREATE FUNCTION fn_shop_get_product_variations_from_id_csv_list ( + a_id_permutation INT + , a_variation_csv TEXT + , a_guid BINARY(36) +) +RETURNS INT +DETERMINISTIC +READS SQL DATA +BEGIN + DECLARE v_csv_pairs VARCHAR(4000); + DECLARE v_current_pair VARCHAR(50); + DECLARE v_id_variation_type INT; + DECLARE v_id_variation INT; + DECLARE v_rank_counter INT; + + CALL p_validate_guid( a_guid ); + + SET v_csv_pairs := a_variation_csv; + SET v_rank_counter := 1; + + DROP TEMPORARY TABLE IF EXISTS tmp_Get_Variation_From_Csv_Variations; + CREATE TEMPORARY TABLE tmp_Get_Variation_From_Csv_Variations ( + id_variation_type INT NULL + , id_variation INT NOT NULL + ); + + WHILE LENGTH(v_csv_pairs) > 0 DO + IF LOCATE(',', v_csv_pairs) > 0 THEN + SET v_current_pair := SUBSTRING_INDEX(v_csv_pairs, ',', 1); + SET v_csv_pairs := SUBSTRING(v_csv_pairs, LOCATE(',', v_csv_pairs) + 1); + ELSE + SET v_current_pair := v_csv_pairs; + SET v_csv_pairs := ''; + END IF; + + SET v_id_variation_type := SUBSTRING_INDEX(v_current_pair, ':', 1); + SET v_id_variation := SUBSTRING_INDEX(v_current_pair, ':', -1); + + IF NOT ISNULL(v_id_variation) THEN + INSERT INTO tmp_Get_Variation_From_Csv_Variations ( + id_variation_type + , id_variation + ) + SELECT + v_id_variation_type AS id_variation_type + , v_id_variation AS id_variation + ; + + SET v_rank_counter := v_rank_counter + 1; + END IF; + END WHILE; + + INSERT INTO partsltd_prod.Shop_Product_Permutation_Variation_Link_Temp ( + id_link + , id_permutation + , id_variation + , display_order + , active + , GUID + ) + SELECT + IFNULL(PPVL.id_link, -v_rank_counter) AS id_link + , a_id_permutation + , t_V.id_variation + , v_rank_counter AS display_order + , 1 AS active + , a_guid + FROM tmp_Get_Variation_From_Csv_Variations t_V + LEFT JOIN partsltd_prod.Shop_Product_Permutation_Variation_Link PPVL ON t_V.id_variation = PPVL.id_variation + ; + + DROP TEMPORARY TABLE tmp_Get_Variation_From_Csv_Variations; + + RETURN v_rank_counter; +END // + +DELIMITER ; + + +/* + +SELECT + partsltd_prod.fn_shop_get_product_variations_from_id_csv_list( + 1 -- a_id_permutation + , '1:1' -- a_variation_csv + , 'NIPPLENIPPLENIPPLENIPPLENIPPLENIPPLE' -- a_guid + ) +; +SELECT * +FROM partsltd_prod.Shop_Product_Permutation_Variation_Link_Temp +WHERE GUID = 'NIPPLENIPPLENIPPLENIPPLENIPPLENIPPLE' +; +DELETE +FROM partsltd_prod.Shop_Product_Permutation_Variation_Link_Temp +WHERE GUID = 'NIPPLENIPPLENIPPLENIPPLENIPPLENIPPLE' +; +*/ + + +-- File: 6212_fn_shop_get_product_permutation_variations_csv.sql + +DROP FUNCTION IF EXISTS fn_shop_get_product_permutation_variations_csv; + +DELIMITER // + +CREATE FUNCTION fn_shop_get_product_permutation_variations_csv(id_product_permutation INT) +RETURNS VARCHAR(4000) +DETERMINISTIC +BEGIN + DECLARE csv VARCHAR(4000); + + SET csv := ( + SELECT + CASE WHEN P.has_variations = 0 THEN + '' + ELSE + GROUP_CONCAT( + CONCAT( + PV.id_type + , ':' + , PV.id_variation + ) + SEPARATOR ',' + ) + END + FROM partsltd_prod.Shop_Product_Permutation PP + LEFT JOIN partsltd_prod.Shop_Product P ON PP.id_product = P.id_product + LEFT JOIN partsltd_prod.Shop_Product_Permutation_Variation_Link PPVL ON PP.id_permutation = PPVL.id_permutation + LEFT JOIN partsltd_prod.Shop_Variation PV ON PPVL.id_variation = PV.id_variation + LEFT JOIN partsltd_prod.Shop_Variation_Type PVT ON PV.id_type = PVT.id_type + WHERE PP.id_permutation = id_product_permutation + GROUP BY P.id_product, P.has_variations, PVT.display_order, PVT.name, PV.display_order, PV.name + LIMIT 1 + ); + + RETURN csv; +END // + +DELIMITER ; +SELECT + fn_shop_get_product_permutation_variations_csv( + 3 -- id_product_permutation + ) + , fn_shop_get_product_permutation_variations_csv( + 1 -- id_product_permutation + ) +; +/* +*/ + +-- File: 6500_p_shop_calc_user.sql + -- Clear previous proc DROP PROCEDURE IF EXISTS p_shop_user_eval; DROP PROCEDURE IF EXISTS p_shop_calc_user; @@ -7527,6 +8235,9 @@ SELECT * FROM partsltd_prod.shop_user_role_link; SELECT * FROM partsltd_prod.shop_role_permission_link; */ + +-- File: 6501_p_shop_clear_calc_user.sql + -- Clear previous proc DROP PROCEDURE IF EXISTS p_shop_clear_Shop_Calc_User_Temp; DROP PROCEDURE IF EXISTS p_clear_Shop_Calc_User_Temp; @@ -7573,6 +8284,9 @@ WHERE GUID = 'noods, cheese ' */ +-- File: 7003_p_shop_get_many_access_level.sql + + /* @@ -7618,6 +8332,9 @@ CALL p_shop_get_many_access_level ( */ +-- File: 7101_p_shop_get_many_region.sql + + /* @@ -7663,6 +8380,9 @@ CALL p_shop_get_many_region ( */ +-- File: 7106_p_shop_get_many_plant.sql + + -- Clear previous proc DROP PROCEDURE IF EXISTS p_shop_get_many_plant; @@ -7699,6 +8419,9 @@ CALL p_shop_get_many_plant ( */ +-- File: 7109_p_shop_get_many_storage_location.sql + + -- Clear previous proc DROP PROCEDURE IF EXISTS p_shop_get_many_storage_location; @@ -7736,6 +8459,9 @@ CALL p_shop_get_many_storage_location ( */ +-- File: 7116_p_shop_get_many_currency.sql + + /* @@ -7782,6 +8508,9 @@ CALL p_shop_get_many_currency ( ); */ + +-- File: 7122_p_shop_get_many_unit_measurement.sql + -- Clear previous proc DROP PROCEDURE IF EXISTS p_shop_get_many_unit_measurement; @@ -7824,6 +8553,9 @@ from shop_unit_measurement */ +-- File: 7200_p_shop_save_product_category.sql + + -- Clear previous proc DROP PROCEDURE IF EXISTS p_save_category; DROP PROCEDURE IF EXISTS p_shop_save_category; @@ -8095,6 +8827,9 @@ END // DELIMITER ;; + +-- File: 7200_p_shop_save_product_category_test.sql + -- Clear previous proc DROP PROCEDURE IF EXISTS partsltd_prod.p_shop_save_product_category_test; @@ -8170,6 +8905,9 @@ DELETE FROM partsltd_prod.Shop_Product_Category_Temp; DROP TABLE IF EXISTS tmp_Msg_Error; */ + +-- File: 7202_p_shop_clear_calc_product_permutation.sql + -- Clear previous proc DROP PROCEDURE IF EXISTS p_shop_clear_calc_product_permutation; @@ -8223,6 +8961,9 @@ WHERE GUID = a_guid */ +-- File: 7203_p_shop_save_product.sql + + -- Clear previous proc @@ -8535,6 +9276,9 @@ DELIMITER ;; +-- File: 7203_p_shop_save_product_test.sql + + -- Clear previous proc DROP PROCEDURE IF EXISTS partsltd_prod.p_shop_save_product_test; @@ -8625,7 +9369,10 @@ CALL partsltd_prod.p_shop_save_product_test (); DELETE FROM partsltd_prod.Shop_Product_Temp; DROP TABLE IF EXISTS tmp_Msg_Error; -*/-- USE partsltd_prod; +*/ + +-- File: 7204_p_shop_calc_product_permutation.sql +-- USE partsltd_prod; -- Clear previous proc DROP PROCEDURE IF EXISTS p_shop_calc_product_permutation; @@ -9339,7 +10086,10 @@ CALL partsltd_prod.p_shop_calc_product_permutation ( WHERE GUID = 'NIPS ' ; -*/-- +*/ + +-- File: 7204_p_shop_get_many_product.sql +-- USE partsltd_prod; -- Clear previous proc @@ -9863,6 +10613,9 @@ FROM partsltd_prod.Shop_Calc_User_Temp; */ +-- File: 7205_p_shop_get_many_stripe_product_new.sql + + /* @@ -10170,6 +10923,9 @@ CALL p_shop_calc_user ( */ +-- File: 7206_p_shop_save_product_permutation.sql + + -- Clear previous proc DROP PROCEDURE IF EXISTS p_shop_save_permutation; DROP PROCEDURE IF EXISTS p_shop_save_product_permutation; @@ -10237,11 +10993,14 @@ BEGIN CALL p_validate_guid ( a_guid ); - DROP TABLE IF EXISTS tmp_Permutation; + DROP TEMPORARY TABLE IF EXISTS tmp_Permutation_Variation_Link; + DROP TEMPORARY TABLE IF EXISTS tmp_Permutation; CREATE TEMPORARY TABLE tmp_Permutation ( id_permutation INT NOT NULL + , id_permutation_temp INT NOT NULL , id_product INT NOT NULL + , csv_id_pairs_variation VARCHAR(4000) NULL , description VARCHAR(4000) NOT NULL , cost_local_VAT_excl FLOAT NULL , cost_local_VAT_incl FLOAT NULL @@ -10267,6 +11026,15 @@ BEGIN , name_error VARCHAR(255) NOT NULL , is_new BIT NOT NULL ); + + CREATE TEMPORARY TABLE tmp_Permutation_Variation_Link ( + id_link INT NOT NULL + , id_permutation INT NOT NULL + , id_variation INT NOT NULL + , active BIT NOT NULL + , display_order INT NOT NULL + , is_new BIT NOT NULL + ); CREATE TEMPORARY TABLE IF NOT EXISTS tmp_Msg_Error ( display_order INT NOT NULL PRIMARY KEY AUTO_INCREMENT @@ -10279,7 +11047,9 @@ BEGIN -- Get data from Temp table INSERT INTO tmp_Permutation ( id_permutation + , id_permutation_temp , id_product + , csv_id_pairs_variation , description , cost_local_VAT_excl , cost_local_VAT_incl @@ -10304,7 +11074,9 @@ BEGIN ) SELECT PP_T.id_permutation + , PP_T.id_permutation , IFNULL(PP_T.id_product, PP.id_product) AS id_product + , PP_T.csv_id_pairs_variation , IFNULL(PP_T.description, PP.description) AS description , IFNULL(PP_T.cost_local_VAT_excl, PP.cost_local_VAT_excl) AS cost_local_VAT_excl , IFNULL(PP_T.cost_local_VAT_incl, PP.cost_local_VAT_incl) AS cost_local_VAT_incl @@ -10331,6 +11103,42 @@ BEGIN WHERE PP_T.guid = a_guid ; + select 'nips'; + + SELECT + partsltd_prod.fn_shop_get_product_variations_from_id_csv_list( + t_PP.id_permutation -- a_id_permutation + , t_PP.csv_id_pairs_variation -- a_variation_csv + , a_guid -- a_guid + ) + FROM tmp_Permutation t_PP + WHERE NOT ISNULL(t_PP.csv_id_pairs_variation) + ; + + SELECT 'CHIPS'; + + INSERT INTO tmp_Permutation_Variation_Link ( + id_link + , id_permutation + , id_variation + , display_order + , active + , is_new + ) + SELECT + PPVL_T.id_link + , PPVL_T.id_permutation + , PPVL_T.id_variation + , PPVL_T.display_order + , ISNULL(PPVL_T.id_link) AS active + , IFNULL(PPVL_T.id_link, 0) < 1 AS is_new + FROM partsltd_prod.Shop_Product_Permutation_Variation_Link_Temp PPVL_T + RIGHT JOIN partsltd_prod.Shop_Product_Permutation_Variation_Link PPVL ON PPVL_T.id_link = PPVL.id_variation + INNER JOIN tmp_Permutation t_PP ON PPVL_T.id_permutation = t_PP.id_permutation + ; + + select 'lips'; + -- Validation -- Missing mandatory fields -- id_product @@ -10546,6 +11354,17 @@ BEGIN , t_P.can_admin = UE_T.can_admin ; + IF a_debug = 1 THEN + SELECT * + FROM partsltd_prod.Shop_Calc_User_Temp + WHERE GUID = a_guid + ; + SELECT * + FROM tmp_Permutation t_PP + LEFT JOIN Shop_Product P ON t_PP.id_product = P.id_product + ; + END IF; + CALL p_shop_clear_calc_user( a_guid , 0 -- a_debug @@ -10562,20 +11381,73 @@ BEGIN , v_code_type_error_bad_data , CONCAT('The following product permutation(s) do not have product edit permission: ', GROUP_CONCAT(t_P.name_error SEPARATOR ', ')) AS msg FROM tmp_Permutation t_P - WHERE ISNULL(t_P.can_edit) + WHERE + ISNULL(t_P.can_edit) ; END IF; IF NOT EXISTS (SELECT * FROM tmp_Msg_Error LIMIT 1) THEN START TRANSACTION; - IF NOT ISNULL(v_ids_product_permission) THEN INSERT INTO Shop_Product_Change_Set ( comment ) VALUES ( a_comment ) ; SET v_id_change_set := LAST_INSERT_ID(); + INSERT INTO Shop_Product_Permutation ( + id_product + , description + , cost_local_VAT_excl + , cost_local_VAT_incl + , id_currency_cost + , profit_local_min + , latency_manufacture + , id_unit_measurement_quantity + , count_unit_measurement_per_quantity_step + , quantity_min + , quantity_max + , quantity_stock + , is_subscription + , id_unit_measurement_interval_recurrence + , count_interval_recurrence + , id_stripe_product + , does_expire_faster_once_unsealed + , id_unit_measurement_interval_expiration_unsealed + , count_interval_expiration_unsealed + , active + , created_by + , created_on + ) + SELECT + t_P.id_product AS id_product + , t_P.description AS description + , t_P.cost_local_VAT_excl AS cost_local_VAT_excl + , t_P.cost_local_VAT_incl AS cost_local_VAT_incl + , t_P.id_currency_cost AS id_currency_cost + , t_P.profit_local_min AS profit_local_min + , t_P.latency_manufacture AS latency_manufacture + , t_P.id_unit_measurement_quantity AS id_unit_measurement_quantity + , t_P.count_unit_measurement_per_quantity_step AS count_unit_measurement_per_quantity_step + , t_P.quantity_min AS quantity_min + , t_P.quantity_max AS quantity_max + , t_P.quantity_stock AS quantity_stock + , t_P.is_subscription AS is_subscription + , t_P.id_unit_measurement_interval_recurrence AS id_unit_measurement_interval_recurrence + , t_P.count_interval_recurrence AS count_interval_recurrence + , t_P.id_stripe_product AS id_stripe_product + , t_P.does_expire_faster_once_unsealed AS does_expire_faster_once_unsealed + , t_P.id_unit_measurement_interval_expiration_unsealed AS id_unit_measurement_interval_expiration_unsealed + , t_P.count_interval_expiration_unsealed AS count_interval_expiration_unsealed + , t_P.active AS active + , a_id_user AS created_by + , v_time_start AS created_on + FROM tmp_Permutation t_P + WHERE + is_new = 1 + AND active = 1 + ; + UPDATE Shop_Product_Permutation PP INNER JOIN tmp_Permutation t_P ON PP.id_permutation = t_P.id_permutation SET @@ -10601,66 +11473,57 @@ BEGIN , PP.active = t_P.active , PP.id_change_set = v_id_change_set ; + + UPDATE tmp_Permutation t_PP + INNER JOIN partsltd_prod.Shop_Product_Permutation PP ON t_PP.id_permutation = PP.id_permutation_temp + SET + t_PP.id_permutation = PP.id_permutation + ; + UPDATE tmp_Permutation_Variation_Link t_PPVL + INNER JOIN tmp_Permutation t_PP ON t_PPVL.id_permutation = t_PP.id_permutation_temp + SET + t_PPVL.id_permutation = t_PP.id_permutation + ; + + INSERT INTO partsltd_prod.Shop_Product_Permutation_Variation_Link ( + id_permutation + , id_variation + , display_order + , active + ) + SELECT + t_PPVL.id_permutation + , t_PPVL.id_variation + , t_PPVL.display_order + , t_PPVL.active + FROM tmp_Permutation_Variation_Link t_PPVL + WHERE + t_PPVL.is_new = 1 + AND t_PPVL.active = 1 + ; + + UPDATE partsltd_prod.Shop_Product_Permutation_Variation_Link PPVL + INNER JOIN tmp_Permutation_Variation_Link t_PPVL + ON PPVL.id_link = t_PPVL.id_link + AND t_PPVL.is_new = 1 + SET + PPVL.id_permutation = t_PPVL.id_permutation + , PPVL.id_variation = t_PPVL.id_variation + , PPVL.display_order = t_PPVL.display_order + , PPVL.active = t_PPVL.active + , PPVL.id_change_set = v_id_change_set + ; END IF; - INSERT INTO Shop_Product_Permutation ( - id_product - , description - , cost_local_VAT_excl - , cost_local_VAT_incl - , id_currency_cost - , profit_local_min - , latency_manufacture - , id_unit_measurement_quantity - , count_unit_measurement_per_quantity_step - , quantity_min - , quantity_max - , quantity_stock - , is_subscription - , id_unit_measurement_interval_recurrence - , count_interval_recurrence - , id_stripe_product - , does_expire_faster_once_unsealed - , id_unit_measurement_interval_expiration_unsealed - , count_interval_expiration_unsealed - , active - , created_by - , created_on - ) - SELECT - t_P.id_product AS id_product - , t_P.description AS description - , t_P.cost_local_VAT_excl AS cost_local_VAT_excl - , t_P.cost_local_VAT_incl AS cost_local_VAT_incl - , t_P.id_currency_cost AS id_currency_cost - , t_P.profit_local_min AS profit_local_min - , t_P.latency_manufacture AS latency_manufacture - , t_P.id_unit_measurement_quantity AS id_unit_measurement_quantity - , t_P.count_unit_measurement_per_quantity_step AS count_unit_measurement_per_quantity_step - , t_P.quantity_min AS quantity_min - , t_P.quantity_max AS quantity_max - , t_P.quantity_stock AS quantity_stock - , t_P.is_subscription AS is_subscription - , t_P.id_unit_measurement_interval_recurrence AS id_unit_measurement_interval_recurrence - , t_P.count_interval_recurrence AS count_interval_recurrence - , t_P.id_stripe_product AS id_stripe_product - , t_P.does_expire_faster_once_unsealed AS does_expire_faster_once_unsealed - , t_P.id_unit_measurement_interval_expiration_unsealed AS id_unit_measurement_interval_expiration_unsealed - , t_P.count_interval_expiration_unsealed AS count_interval_expiration_unsealed - , t_P.active AS active - , a_id_user AS created_by - , v_time_start AS created_on - FROM tmp_Permutation t_P - WHERE - is_new = 1 - AND active = 1 - ; DELETE FROM Shop_Product_Permutation_Temp - WHERE GUID = a_guid; - - COMMIT; - END IF; + WHERE GUID = a_guid + ; + DELETE FROM Shop_Product_Permutation_Variation_Link_Temp + WHERE GUID = a_guid + ; + + COMMIT; # Errors SELECT * @@ -10669,9 +11532,11 @@ BEGIN ; IF a_debug = 1 THEN - SELECT * from tmp_Permutation; + SELECT * FROM tmp_Permutation; + SELECT * FROM tmp_Permutation_Variation_Link; END IF; + DROP TEMPORARY TABLE tmp_Permutation_Variation_Link; DROP TEMPORARY TABLE tmp_Permutation; DROP TEMPORARY TABLE tmp_Msg_Error; @@ -10764,6 +11629,9 @@ WHERE id_permutation = 1; +-- File: 7206_p_shop_save_product_permutation_test.sql + + -- Clear previous proc DROP PROCEDURE IF EXISTS partsltd_prod.p_shop_save_product_permutation_test; @@ -10790,6 +11658,7 @@ BEGIN INSERT INTO partsltd_prod.Shop_Product_Permutation_Temp ( id_permutation , id_product + , csv_id_pairs_variation , description , cost_local_VAT_excl , cost_local_VAT_incl @@ -10812,10 +11681,11 @@ BEGIN , guid ) VALUES - /* Test 1 - Insert */ + /* Test 1 - Insert ( -1 -- id_permutation , 5 -- id_product + , '' -- csv_id_pairs_variation , 'Hair clip' -- description , NULL -- cost_local_VAT_excl , NULL -- cost_local_VAT_incl @@ -10837,6 +11707,7 @@ BEGIN , 1 -- active , v_guid ) + */ /* Test 2 - Update ( 4 -- id_product @@ -10849,6 +11720,32 @@ BEGIN , v_guid ) */ + /* Test 3 - Insert with Variations */ + ( + -1 -- id_permutation + , 8 -- id_product + , '1:1' -- csv_id_pairs_variation + , 'Test with variations' -- description + , NULL -- cost_local_VAT_excl + , NULL -- cost_local_VAT_incl + , 1 -- id_currency_cost + , NULL -- profit_local_min + , 1 -- latency_manufacture + , 3 -- id_unit_measurement_quantity + , 1 -- count_unit_measurement_per_quantity_step + , 0 -- quantity_min + , 0 -- quantity_max + , 2 -- quantity_stock + , FALSE -- is_subscription + , NULL -- id_unit_measurement_interval_recurrence + , NULL -- count_interval_recurrence + , NULL -- id_stripe_product + , FALSE -- does_expire_faster_once_unsealed + , NULL -- id_unit_measurement_interval_expiration_unsealed + , NULL -- count_interval_expiration_unsealed + , 1 -- active + , v_guid + ) ; COMMIT; @@ -10876,6 +11773,7 @@ BEGIN END // DELIMITER ;; +/* CALL partsltd_prod.p_shop_save_product_permutation_test (); DELETE FROM partsltd_prod.Shop_Product_Permutation_Temp; @@ -10883,10 +11781,12 @@ DELETE FROM partsltd_prod.Shop_Product_Permutation_Temp; DROP TABLE IF EXISTS tmp_Msg_Error; -/* SELECT * FROM partsltd_prod.Shop_Product Cannot add or update a child row: a foreign key constraint fails (`partsltd_prod`.`shop_product_permutation`, CONSTRAINT `FK_Shop_Product_Permutation_id_product` FOREIGN KEY (`id_product`) REFERENCES `shop_product` (`id_product`) ON UPDATE RESTRICT) */ + +-- File: 7210_p_shop_get_many_product_variation.sql + DROP PROCEDURE IF EXISTS p_shop_get_many_product_variation; DELIMITER // @@ -11304,6 +12204,9 @@ insert into shop_product_change_set (comment) END IF; */ +-- File: 7212_p_shop_save_product_variation.sql + + -- Clear previous proc DROP PROCEDURE IF EXISTS p_shop_save_product_variation; @@ -11851,6 +12754,9 @@ DELIMITER ;; +-- File: 7212_p_shop_save_product_variation_test.sql + + -- Clear previous proc DROP PROCEDURE IF EXISTS partsltd_prod.p_shop_save_product_variation_test; @@ -12036,6 +12942,9 @@ Cannot add or update a child row: a foreign key constraint fails (`partsltd_prod */ +-- File: 7219_p_shop_get_many_stock_item.sql + + -- Clear previous proc DROP PROCEDURE IF EXISTS p_shop_get_many_stock_item; @@ -12811,6 +13720,9 @@ insert into shop_product_change_set (comment) */ +-- File: 7220_p_shop_save_stock_item.sql + + -- Clear previous proc DROP PROCEDURE IF EXISTS p_shop_save_stock_item; @@ -13509,6 +14421,9 @@ WHERE id_permutation = 1; +-- File: 7220_p_shop_save_stock_item_test.sql + + -- Clear previous proc DROP PROCEDURE IF EXISTS partsltd_prod.p_shop_save_stock_item_test; @@ -13607,7 +14522,10 @@ DELETE FROM partsltd_prod.Shop_Stock_Item_Temp; /* update shop_product p set p.has_variations = 0 where id_product = 4 DROP TABLE IF EXISTS tmp_Msg_Error; -*/-- USE partsltd_prod; +*/ + +-- File: 7221_p_get_many_shop_product_price_and_discount_and_delivery_option.sql +-- USE partsltd_prod; -- Clear previous proc DROP PROCEDURE IF EXISTS p_shop_get_many_product_price_and_discount_and_delivery_option; @@ -14615,6 +15533,9 @@ FROM Shop_Calc_User_Temp; */ +-- File: 7223_p_shop_get_many_stripe_price_new.sql + + /* @@ -14858,6 +15779,9 @@ CALL p_shop_get_many_stripe_price_new ( */ +-- File: 7312_p_shop_save_user.sql + + /* @@ -15038,6 +15962,9 @@ CALL p_shop_edit_user ( */ +-- File: 7313_p_get_many_user.sql + + -- Clear previous proc DROP PROCEDURE IF EXISTS p_get_many_user; @@ -15548,6 +16475,9 @@ CALL p_get_many_user( */ +-- File: 7321_p_shop_save_user_basket.sql + + /* @@ -16378,6 +17308,9 @@ CALL p_shop_edit_user_basket ( */ +-- File: 7400_p_shop_save_supplier.sql + + -- Clear previous proc @@ -16966,6 +17899,9 @@ delete from shop_supplier where id_supplier = 9; delete from shop_supplier_address_audit where id_address = -4; delete from shop_supplier_address where id_address = -4; +-- File: 7400_p_shop_save_supplier_temp.sql + + -- Clear previous proc DROP PROCEDURE IF EXISTS partsltd_prod.p_shop_save_supplier_test; @@ -17132,6 +18068,9 @@ Cannot add or update a child row: a foreign key constraint fails (`partsltd_prod */ +-- File: 7401_p_shop_get_many_supplier.sql + + DROP PROCEDURE IF EXISTS p_shop_get_many_supplier; DELIMITER // @@ -17394,6 +18333,9 @@ CALL p_shop_get_many_supplier ( */ +-- File: 7403_p_shop_save_supplier_purchase_order.sql + + -- Clear previous proc @@ -17797,8 +18739,8 @@ BEGIN id_type, code, msg ) SELECT - v_id_error_type_bad_data, - v_code_error_type_bad_data, + v_id_type_error_bad_data, + v_code_type_error_bad_data, CONCAT( 'A valid quantity ordered is required for the following Supplier Purchase Order Item(s): ' , GROUP_CONCAT(t_SPOPL.name_error SEPARATOR ', ') @@ -17819,8 +18761,8 @@ BEGIN id_type, code, msg ) SELECT - v_id_error_type_bad_data, - v_code_error_type_bad_data, + v_id_type_error_bad_data, + v_code_type_error_bad_data, CONCAT( 'A valid quantity received is required for the following Supplier Purchase Order Item(s): ' , GROUP_CONCAT(t_SPOPL.name_error, ' - ', t_SPOPL.quantity_received SEPARATOR ', ') @@ -17839,8 +18781,8 @@ BEGIN id_type, code, msg ) SELECT - v_id_error_type_bad_data, - v_code_error_type_bad_data, + v_id_type_error_bad_data, + v_code_type_error_bad_data, CONCAT( 'A valid delivery latency is required for the following Supplier Purchase Order Item(s): ' , GROUP_CONCAT(t_SPOPL.name_error, ' - ', t_SPOPL.latency_delivery_days SEPARATOR ', ') @@ -17864,8 +18806,8 @@ BEGIN id_type, code, msg ) SELECT - v_id_error_type_bad_data, - v_code_error_type_bad_data, + v_id_type_error_bad_data, + v_code_type_error_bad_data, CONCAT('Duplicate records: ', GROUP_CONCAT(t_SPOPLC.name_error SEPARATOR ', ')) FROM ( SELECT @@ -17884,8 +18826,8 @@ BEGIN id_type, code, msg ) SELECT - v_id_error_type_bad_data, - v_code_error_type_bad_data, + v_id_type_error_bad_data, + v_code_type_error_bad_data, CONCAT( 'There are no items in the following Supplier Purchase Order(s): ' , GROUP_CONCAT(t_SPO.name_error SEPARATOR ', ') @@ -17907,8 +18849,8 @@ BEGIN id_type, code, msg ) SELECT - v_id_error_type_bad_data, - v_code_error_type_bad_data, + v_id_type_error_bad_data, + v_code_type_error_bad_data, CONCAT( 'There is no order for the following Supplier Purchase Order Item(s): ' , GROUP_CONCAT(t_SPOPL.name_error SEPARATOR ', ') @@ -18244,6 +19186,9 @@ DELETE FROM Shop_Supplier_Purchase_Order; +-- File: 7403_p_shop_save_supplier_purchase_order_test.sql + + -- Clear previous proc DROP PROCEDURE IF EXISTS partsltd_prod.p_shop_save_supplier_purchase_order_test; @@ -18302,7 +19247,6 @@ BEGIN WHERE id_order = 6 */ ; - INSERT INTO partsltd_prod.Shop_Supplier_Purchase_Order_Product_Link_Temp ( id_link , id_order @@ -18395,11 +19339,13 @@ DELETE FROM partsltd_prod.Shop_Supplier_Purchase_Order_Product_Link_Temp; DROP TABLE IF EXISTS tmp_Msg_Error; -/* Cannot add or update a child row: a foreign key constraint fails (`partsltd_prod`.`shop_supplier_address`, CONSTRAINT `FK_Shop_Supplier_Address_id_supplier` FOREIGN KEY (`id_supplier`) REFERENCES `shop_supplier` (`id_supplier`) ON UPDATE RESTRICT) */ +-- File: 7404_p_shop_get_many_supplier_purchase_order.sql + + DROP PROCEDURE IF EXISTS p_shop_get_many_supplier_purchase_order; DELIMITER // @@ -18841,6 +19787,7 @@ BEGIN , P.id_product , SPOPL.id_permutation , fn_shop_get_product_permutation_name(SPOPL.id_permutation) AS name_permutation + , fn_shop_get_product_permutation_variations_csv(SPOPL.id_permutation) AS csv_id_pairs_variation -- , SPOPL.id_currency_cost , SPOPL.id_unit_quantity , SPOPL.quantity_ordered @@ -18903,6 +19850,9 @@ CALL p_shop_get_many_supplier_purchase_order ( */ +-- File: 7415_p_shop_save_manufacturing_purchase_order.sql + + -- Clear previous proc @@ -19000,7 +19950,6 @@ BEGIN , id_order INT NOT NULL , id_product INT NULL , id_permutation INT NULL - , id_currency INT NOT NULL , id_unit_quantity INT NOT NULL , quantity_used FLOAT NOT NULL , quantity_produced FLOAT NULL @@ -19018,7 +19967,7 @@ BEGIN , price_total_local_VAT_incl FLOAT NULL , has_order BIT NULL , is_new BIT NOT NULL - , name_error VARCHAR(1000) NOT NULL + , name_error VARCHAR(1000) NULL ); CREATE TEMPORARY TABLE IF NOT EXISTS tmp_Msg_Error ( @@ -19485,13 +20434,14 @@ BEGIN END IF; -- Duplicates + /* IF EXISTS ( SELECT - id_permutation - , name_error + t_MPOPL.id_permutation + , t_MPOPL.name_error , COUNT(*) FROM tmp_Manufacturing_Purchase_Order_Product_Link t_MPOPL - GROUP BY id_permutation + GROUP BY t_MPOPL.id_permutation, t_MPOPL.name_error HAVING COUNT(*) > 1 ) THEN INSERT INTO tmp_Msg_Error ( @@ -19503,15 +20453,16 @@ BEGIN CONCAT('Duplicate records: ', GROUP_CONCAT(t_MPOPLC.name_error SEPARATOR ', ')) FROM ( SELECT - id_permutation - , name_error - , COUNT(*) + t_MPOPL.id_permutation + , t_MPOPL.name_error + , COUNT(*) FROM tmp_Manufacturing_Purchase_Order_Product_Link t_MPOPL - GROUP BY id_permutation + GROUP BY t_MPOPL.id_permutation, t_MPOPL.name_error HAVING COUNT(*) > 1 ) t_MPOPLC ; END IF; + */ -- Empty Manufacturing Purchase Order IF EXISTS ( SELECT * FROM tmp_Manufacturing_Purchase_Order t_MPO LEFT JOIN tmp_Manufacturing_Purchase_Order_Product_Link t_MPOPL ON t_MPO.id_order = t_MPOPL.id_order WHERE ISNULL(t_MPOPL.id_order) ) THEN INSERT INTO tmp_Msg_Error ( @@ -19916,6 +20867,9 @@ DELETE FROM Shop_Manufacturing_Purchase_Order; +-- File: 7415_p_shop_save_Manufacturing_purchase_order_test.sql + + -- Clear previous proc DROP PROCEDURE IF EXISTS partsltd_prod.p_shop_save_Manufacturing_purchase_order_test; @@ -20062,8 +21016,12 @@ DELETE FROM partsltd_prod.Shop_Manufacturing_Purchase_Order_Product_Link_Temp; DROP TABLE IF EXISTS tmp_Msg_Error; select * from partsltd_prod.Shop_User; +Expression #2 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'partsltd_prod.t_MPOPL.name_error' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by */ +-- File: 7416_p_shop_get_many_manufacturing_purchase_order.sql + + DROP PROCEDURE IF EXISTS p_shop_get_many_manufacturing_purchase_order; DELIMITER // @@ -20346,13 +21304,13 @@ BEGIN VALUES ( v_id_type_error_no_permission , v_code_type_error_no_permission - , CONCAT('You do not have view permissions for ', (SELECT name FROM partsltd_prod.Shop_Permission WHERE id_permission = v_id_permission_manufacturing LIMIT 1)) + , CONCAT('You do not have view permissions for ', IFNULL((SELECT IFNULL(name, '(No Permission Name)') FROM partsltd_prod.Shop_Permission WHERE FIND_IN_SET(id_permission, v_ids_permission_manufacturing_purchase_order) > 0 LIMIT 1), '(No Permissions Found)')) ) ; END IF; IF EXISTS ( SELECT * FROM tmp_Msg_Error LIMIT 1 ) THEN - DELETE FROM tmp_Manufacturing_Purchase_Order_Product_Link; + -- DELETE FROM tmp_Manufacturing_Purchase_Order_Product_Link; DELETE FROM tmp_Manufacturing_Purchase_Order; END IF; @@ -20403,8 +21361,11 @@ BEGIN SELECT MPOPL.id_link , MPOPL.id_order + , P.id_category + , P.id_product , MPOPL.id_permutation , fn_shop_get_product_permutation_name(MPOPL.id_permutation) AS name_permutation + , fn_shop_get_product_permutation_variations_csv(MPOPL.id_permutation) AS csv_id_pairs_variation , MPOPL.id_unit_quantity , MPOPL.quantity_used , MPOPL.quantity_produced @@ -20417,7 +21378,9 @@ BEGIN , MPOPL.price_unit_local_VAT_incl , MPOPL.active FROM tmp_Manufacturing_Purchase_Order t_MPO - INNER JOIN partsltd_prod.Shop_Manufacturing_Purchase_Order_Product_Link MPOPL ON t_MPO.id_order = MPOPL.id_order + INNER JOIN partsltd_prod.Shop_Manufacturing_Purchase_Order_Product_Link MPOPL ON t_MPO.id_order = MPOPL.id_order + LEFT JOIN partsltd_prod.Shop_Product_Permutation PP ON MPOPL.id_permutation = PP.id_permutation + LEFT JOIN partsltd_prod.Shop_Product P ON PP.id_product = P.id_product ; # Errors @@ -20444,11 +21407,12 @@ END // DELIMITER ;; +/* CALL p_shop_get_many_manufacturing_purchase_order ( - 1 # a_id_user + 0 # a_id_user , 1 # a_get_all_order - , 0 # a_get_inactive_order + , 1 # a_get_inactive_order , '' # a_ids_order , '' # a_ids_permutation , NULL # a_date_from @@ -20456,10 +21420,19 @@ CALL p_shop_get_many_manufacturing_purchase_order ( , 0 # a_debug ); -/* + +select * +from partsltd_prod.shop_manufacturing_purchase_order +; +select * +from partsltd_prod.shop_manufacturing_purchase_order_product_link +; */ +-- File: 7421_p_shop_save_customer.sql + + -- Clear previous proc @@ -20760,6 +21733,9 @@ DELETE FROM Shop_Customer */ +-- File: 7422_p_shop_get_many_customer.sql + + /* @@ -21031,6 +22007,9 @@ FROM Shop_Customer; */ +-- File: 7424_p_shop_save_customer_sales_order.sql + + -- Clear previous proc @@ -21588,6 +22567,9 @@ DELETE FROM Shop_Customer_Sales_Order; +-- File: 7425_p_shop_get_many_customer_sales_order.sql + + -- Clear previous proc @@ -22364,6 +23346,9 @@ insert into shop_product_change_set (comment) */ +-- File: 9000_populate.sql + + /* @@ -22727,6 +23712,7 @@ VALUES # Product Permutations INSERT INTO Shop_Product_Permutation ( -- display_order, + id_permutation_temp, id_product, description, cost_local_VAT_excl, @@ -22751,7 +23737,8 @@ INSERT INTO Shop_Product_Permutation ( ) VALUES ( - -- 1, + -- 1, + -1, 1, 'Good Red', 5, @@ -22776,6 +23763,7 @@ VALUES ), ( -- 2, + -2, 1, 'Good Blue', 6, @@ -22800,6 +23788,7 @@ VALUES ), ( -- 3, + -3, 2, 'Test product describes good', 10, @@ -22824,6 +23813,7 @@ VALUES ), ( -- 4, + -4, 3, 'Phone describes good', 10, @@ -22848,6 +23838,7 @@ VALUES ), ( -- 5, + -5, 4, 'Laptop describes good', 10, @@ -22872,6 +23863,7 @@ VALUES ), ( -- 6, + -6, 5, 'Smart watch describes good', 10, @@ -22912,6 +23904,9 @@ INSERT INTO Shop_Variation ( VALUES (1, 1, 'RED', 'Red', NULL, NULL) , (2, 1, 'BLUE', 'Blue', NULL, NULL) + , (3, 1, 'GREEN', 'Green', NULL, NULL) + , (4, 1, 'White', 'White', NULL, NULL) + , (5, 1, 'BLACK', 'Black', NULL, NULL) , (1, 2, '400ml', '400 millilitres', 6, 400) , (2, 2, '400g', '400 grams', 4, 400) , (3, 2, '410g', '410 grams', 4, 410) @@ -23469,6 +24464,9 @@ CALL p_populate_database(); DROP PROCEDURE IF EXISTS p_populate_database; */ +-- File: 9001_view.sql + + # Product Change Sets SELECT * FROM Shop_Product_Change_Set; @@ -23674,3 +24672,38 @@ SELECT * FROM Shop_Customer_Sales_Order_Audit; SELECT * FROM Shop_Customer_Sales_Order_Product_Link; SELECT * FROM Shop_Customer_Sales_Order_Product_Link_Audit; + + +-- File: 9010_anal.sql + + +/* + +SELECT TABLE_NAME +FROM INFORMATION_SCHEMA.TABLES +WHERE TABLE_NAME LIKE '%SHOP%' + OR TABLE_NAME LIKE '%FILE_TYPE%'; + + +SELECT FOUND_ROWS(); + + + +SELECT + CONSTRAINT_NAME, + CONSTRAINT_TYPE, + TABLE_NAME, + COLUMN_NAME, + REFERENCED_TABLE_NAME, + REFERENCED_COLUMN_NAME +FROM + INFORMATION_SCHEMA.TABLES +WHERE + TABLE_SCHEMA = 'PARTS' + -- AND TABLE_NAME = 'your_table_name' +; + +*/ + + + diff --git a/static/MySQL/0001_destroy.sql b/static/MySQL/0001_destroy.sql index 6f137d65..b9a69b75 100644 --- a/static/MySQL/0001_destroy.sql +++ b/static/MySQL/0001_destroy.sql @@ -18,6 +18,7 @@ DROP TABLE IF EXISTS tmp_Shop_Order; DROP TABLE IF EXISTS tmp_Shop_Product; DROP TABLE IF EXISTS tmp_Product; DROP TABLE IF EXISTS tmp_Product_Permutation; +DROP TABLE IF EXISTS tmp_Permutation_Variation_Link; DROP TABLE IF EXISTS tmp_Permutation; DROP TABLE IF EXISTS tmp_Shop_Product_p_shop_calc_user; DROP TABLE IF EXISTS tmp_Shop_Product_p_Shop_Calc_User; @@ -51,6 +52,7 @@ DROP TABLE IF EXISTS tmp_Manufacturing_Purchase_Order; DROP TABLE IF EXISTS tmp_Shop_Customer; DROP TABLE IF EXISTS tmp_Shop_Customer_Sale_Order_Product_Link; DROP TABLE IF EXISTS tmp_Shop_Customer_Sale_Order; +DROP TABLE IF EXISTS tmp_Get_Variation_From_Csv_Variations; # Delete old tables @@ -165,6 +167,7 @@ DROP TABLE IF EXISTS Shop_Product_Currency_Link; DROP TABLE IF EXISTS Shop_Product_Variation_Link_Audit; DROP TABLE IF EXISTS Shop_Product_Variation_Link; +DROP TABLE IF EXISTS Shop_Product_Permutation_Variation_Link_Temp; DROP TABLE IF EXISTS Shop_Product_Permutation_Variation_Link_Audit; DROP TABLE IF EXISTS Shop_Product_Permutation_Variation_Link; @@ -304,6 +307,8 @@ DROP PROCEDURE IF EXISTS p_shop_save_product_variation; DROP PROCEDURE IF EXISTS p_shop_save_product_variation_test; DROP PROCEDURE IF EXISTS p_shop_get_many_product_variation; DROP FUNCTION IF EXISTS fn_shop_get_id_product_permutation_from_variation_csv_list; +DROP FUNCTION IF EXISTS fn_shop_get_product_variations_from_id_csv_list; +DROP FUNCTION IF EXISTS fn_shop_get_product_permutation_variations_csv; DROP PROCEDURE IF EXISTS p_shop_save_stock_item; DROP PROCEDURE IF EXISTS p_shop_save_stock_item_test; DROP PROCEDURE IF EXISTS p_shop_get_many_stock_item; diff --git a/static/MySQL/1202_tbl_Shop_Product_Category_Temp.sql b/static/MySQL/1202_tbl_Shop_Product_Category_Temp.sql index ff520588..70e104c2 100644 --- a/static/MySQL/1202_tbl_Shop_Product_Category_Temp.sql +++ b/static/MySQL/1202_tbl_Shop_Product_Category_Temp.sql @@ -6,7 +6,8 @@ SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_Product_Category_Temp'; CREATE TABLE IF NOT EXISTS Shop_Product_Category_Temp ( - id_category INT NOT NULL + id_temp INT NOT NULL PRIMARY KEY AUTO_INCREMENT + , id_category INT NOT NULL , code VARCHAR(50) NOT NULL , name VARCHAR(255) NOT NULL , description VARCHAR(4000) NULL diff --git a/static/MySQL/1205_tbl_Shop_Product_Temp.sql b/static/MySQL/1205_tbl_Shop_Product_Temp.sql index 4de8b151..d5f06994 100644 --- a/static/MySQL/1205_tbl_Shop_Product_Temp.sql +++ b/static/MySQL/1205_tbl_Shop_Product_Temp.sql @@ -6,7 +6,8 @@ SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_Product_Temp'; CREATE TABLE IF NOT EXISTS Shop_Product_Temp ( - id_product INT NOT NULL + id_temp INT NOT NULL PRIMARY KEY AUTO_INCREMENT + , id_product INT NOT NULL , name VARCHAR(255) NOT NULL , id_category INT NOT NULL , has_variations BIT NOT NULL diff --git a/static/MySQL/1206_tbl_Shop_Product_Permutation.sql b/static/MySQL/1206_tbl_Shop_Product_Permutation.sql index 3b0e2a9f..13dbcd4b 100644 --- a/static/MySQL/1206_tbl_Shop_Product_Permutation.sql +++ b/static/MySQL/1206_tbl_Shop_Product_Permutation.sql @@ -7,6 +7,7 @@ SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning CREATE TABLE IF NOT EXISTS Shop_Product_Permutation ( id_permutation INT NOT NULL AUTO_INCREMENT PRIMARY KEY, + id_permutation_temp INT NOT NULL, id_product INT NOT NULL, CONSTRAINT FK_Shop_Product_Permutation_id_product FOREIGN KEY (id_product) diff --git a/static/MySQL/1208_tbl_Shop_Product_Permutation_Temp.sql b/static/MySQL/1208_tbl_Shop_Product_Permutation_Temp.sql index cc2df0eb..6ec4e35a 100644 --- a/static/MySQL/1208_tbl_Shop_Product_Permutation_Temp.sql +++ b/static/MySQL/1208_tbl_Shop_Product_Permutation_Temp.sql @@ -6,8 +6,10 @@ SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_Product_Permutation_Temp'; CREATE TABLE IF NOT EXISTS Shop_Product_Permutation_Temp ( - id_permutation INT NOT NULL + id_temp INT NOT NULL PRIMARY KEY AUTO_INCREMENT + , id_permutation INT NOT NULL , id_product INT NOT NULL + , csv_id_pairs_variation VARCHAR(4000) NULL , description VARCHAR(4000) NOT NULL , cost_local_VAT_excl FLOAT NULL , cost_local_VAT_incl FLOAT NULL diff --git a/static/MySQL/1217_tbl_Shop_Product_Permutation_Variation_Link_Temp.sql b/static/MySQL/1217_tbl_Shop_Product_Permutation_Variation_Link_Temp.sql new file mode 100644 index 00000000..c27883de --- /dev/null +++ b/static/MySQL/1217_tbl_Shop_Product_Permutation_Variation_Link_Temp.sql @@ -0,0 +1,16 @@ + +# Product Permutation Variation Link + +-- DROP TABLE IF EXISTS Shop_Product_Permutation_Variation_Link_Temp; + +SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_Product_Permutation_Variation_Link_Temp'; + +CREATE TABLE IF NOT EXISTS Shop_Product_Permutation_Variation_Link_Temp ( + id_temp INT NOT NULL AUTO_INCREMENT PRIMARY KEY + , id_link INT NOT NULL + , id_permutation INT NOT NULL + , id_variation INT NOT NULL + , active BIT NOT NULL + , display_order INT NOT NULL + , GUID BINARY(36) NOT NULL +); diff --git a/static/MySQL/3206_tri_Shop_Product_Permutation.sql b/static/MySQL/3206_tri_Shop_Product_Permutation.sql index 3964319f..9754d86b 100644 --- a/static/MySQL/3206_tri_Shop_Product_Permutation.sql +++ b/static/MySQL/3206_tri_Shop_Product_Permutation.sql @@ -23,6 +23,8 @@ CREATE TRIGGER before_update_Shop_Product_Permutation BEFORE UPDATE ON Shop_Product_Permutation FOR EACH ROW BEGIN + DECLARE v_msg VARCHAR(4000); + IF OLD.id_change_set <=> NEW.id_change_set THEN SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = 'New change Set ID must be provided.'; @@ -40,8 +42,10 @@ BEGIN NEW.id_unit_measurement_interval_expiration_unsealed IS NULL OR NEW.id_unit_measurement_interval_expiration_unsealed NOT IN (SELECT id_unit_measurement FROM Shop_Unit_Measurement WHERE is_unit_of_time = 1) )) THEN + SET v_msg := CONCAT('Unsealed expiration interval ID must be a unit of time. Invalid value: ', CAST(NEW.id_unit_measurement_interval_expiration_unsealed AS CHAR)); SIGNAL SQLSTATE '45000' - SET MESSAGE_TEXT = 'Unsealed expiration interval ID must be a unit of time.'; + SET MESSAGE_TEXT = v_msg + ; END IF; INSERT INTO Shop_Product_Permutation_Audit ( diff --git a/static/MySQL/6206_fn_shop_get_product_permutation_name.sql b/static/MySQL/6206_fn_shop_get_product_permutation_name.sql index d1d34f5b..f02187a2 100644 --- a/static/MySQL/6206_fn_shop_get_product_permutation_name.sql +++ b/static/MySQL/6206_fn_shop_get_product_permutation_name.sql @@ -1,49 +1,44 @@ -DROP FUNCTION IF EXISTS fn_shop_get_product_permutation_variations_csv; +DROP FUNCTION IF EXISTS fn_shop_get_product_permutation_name; DELIMITER // -CREATE FUNCTION fn_shop_get_product_permutation_variations_csv(id_product_permutation INT) +CREATE FUNCTION fn_shop_get_product_permutation_name(id_product_permutation INT) RETURNS VARCHAR(4000) DETERMINISTIC BEGIN - DECLARE csv VARCHAR(4000); + DECLARE name VARCHAR(4000); - SET csv := ( + SET name := ( SELECT - CASE WHEN P.has_variations = 0 THEN - '' - ELSE - GROUP_CONCAT( - CONCAT( - PV.id_type - , ':' - , PV.id_variation - ) - SEPARATOR ',' - ) - END - FROM partsltd_prod.Shop_Product_Permutation PP - LEFT JOIN partsltd_prod.Shop_Product P ON PP.id_product = P.id_product - LEFT JOIN partsltd_prod.Shop_Product_Permutation_Variation_Link PPVL ON PP.id_permutation = PPVL.id_permutation - LEFT JOIN partsltd_prod.Shop_Variation PV ON PPVL.id_variation = PV.id_variation - LEFT JOIN partsltd_prod.Shop_Variation_Type PVT ON PV.id_type = PVT.id_type + CONCAT( + IFNULL(PC.name, '(No Category)') + , ' - ' + , IFNULL(P.name, '(No Product)') + , CASE WHEN P.has_variations = 1 THEN + CONCAT(' - ', GROUP_CONCAT(CONCAT(VT.name, ': ', V.name) SEPARATOR ', ')) + ELSE '' END + ) + FROM Shop_Product_Permutation PP + LEFT JOIN Shop_Product P ON PP.id_product = P.id_product + LEFT JOIN Shop_Product_Category PC ON P.id_category = PC.id_category + LEFT JOIN Shop_Product_Permutation_Variation_Link PPVL ON PP.id_permutation = PPVL.id_permutation + LEFT JOIN Shop_Variation V ON PPVL.id_variation = V.id_variation + LEFT JOIN Shop_Variation_Type VT ON V.id_type = VT.id_type WHERE PP.id_permutation = id_product_permutation - GROUP BY P.id_product, P.has_variations, PVT.display_order, PVT.name, PV.display_order, PV.name + GROUP BY PC.id_category, PC.name, P.id_product, P.name, P.has_variations, VT.display_order, VT.name, V.display_order, V.name LIMIT 1 ); - RETURN csv; + RETURN name; END // DELIMITER ; + +/* SELECT - fn_shop_get_product_permutation_variations_csv( + fn_shop_get_product_permutation_name( 3 -- id_product_permutation ) - , fn_shop_get_product_permutation_variations_csv( - 1 -- id_product_permutation - ) ; -/* */ \ No newline at end of file diff --git a/static/MySQL/6211_fn_shop_get_product_variations_from_id_csv_list.sql b/static/MySQL/6211_fn_shop_get_product_variations_from_id_csv_list.sql new file mode 100644 index 00000000..b3c7e1d5 --- /dev/null +++ b/static/MySQL/6211_fn_shop_get_product_variations_from_id_csv_list.sql @@ -0,0 +1,102 @@ + +DROP FUNCTION IF EXISTS fn_shop_get_product_variations_from_id_csv_list; + +DELIMITER // + +CREATE FUNCTION fn_shop_get_product_variations_from_id_csv_list ( + a_id_permutation INT + , a_variation_csv TEXT + , a_guid BINARY(36) +) +RETURNS INT +DETERMINISTIC +READS SQL DATA +BEGIN + DECLARE v_csv_pairs VARCHAR(4000); + DECLARE v_current_pair VARCHAR(50); + DECLARE v_id_variation_type INT; + DECLARE v_id_variation INT; + DECLARE v_rank_counter INT; + + CALL p_validate_guid( a_guid ); + + SET v_csv_pairs := a_variation_csv; + SET v_rank_counter := 1; + + DROP TEMPORARY TABLE IF EXISTS tmp_Get_Variation_From_Csv_Variations; + CREATE TEMPORARY TABLE tmp_Get_Variation_From_Csv_Variations ( + id_variation_type INT NULL + , id_variation INT NOT NULL + ); + + WHILE LENGTH(v_csv_pairs) > 0 DO + IF LOCATE(',', v_csv_pairs) > 0 THEN + SET v_current_pair := SUBSTRING_INDEX(v_csv_pairs, ',', 1); + SET v_csv_pairs := SUBSTRING(v_csv_pairs, LOCATE(',', v_csv_pairs) + 1); + ELSE + SET v_current_pair := v_csv_pairs; + SET v_csv_pairs := ''; + END IF; + + SET v_id_variation_type := SUBSTRING_INDEX(v_current_pair, ':', 1); + SET v_id_variation := SUBSTRING_INDEX(v_current_pair, ':', -1); + + IF NOT ISNULL(v_id_variation) THEN + INSERT INTO tmp_Get_Variation_From_Csv_Variations ( + id_variation_type + , id_variation + ) + SELECT + v_id_variation_type AS id_variation_type + , v_id_variation AS id_variation + ; + + SET v_rank_counter := v_rank_counter + 1; + END IF; + END WHILE; + + INSERT INTO partsltd_prod.Shop_Product_Permutation_Variation_Link_Temp ( + id_link + , id_permutation + , id_variation + , display_order + , active + , GUID + ) + SELECT + IFNULL(PPVL.id_link, -v_rank_counter) AS id_link + , a_id_permutation + , t_V.id_variation + , v_rank_counter AS display_order + , 1 AS active + , a_guid + FROM tmp_Get_Variation_From_Csv_Variations t_V + LEFT JOIN partsltd_prod.Shop_Product_Permutation_Variation_Link PPVL ON t_V.id_variation = PPVL.id_variation + ; + + DROP TEMPORARY TABLE tmp_Get_Variation_From_Csv_Variations; + + RETURN v_rank_counter; +END // + +DELIMITER ; + + +/* + +SELECT + partsltd_prod.fn_shop_get_product_variations_from_id_csv_list( + 1 -- a_id_permutation + , '1:1' -- a_variation_csv + , 'NIPPLENIPPLENIPPLENIPPLENIPPLENIPPLE' -- a_guid + ) +; +SELECT * +FROM partsltd_prod.Shop_Product_Permutation_Variation_Link_Temp +WHERE GUID = 'NIPPLENIPPLENIPPLENIPPLENIPPLENIPPLE' +; +DELETE +FROM partsltd_prod.Shop_Product_Permutation_Variation_Link_Temp +WHERE GUID = 'NIPPLENIPPLENIPPLENIPPLENIPPLENIPPLE' +; +*/ diff --git a/static/MySQL/6212_fn_shop_get_product_permutation_variations_csv.sql b/static/MySQL/6212_fn_shop_get_product_permutation_variations_csv.sql new file mode 100644 index 00000000..d1d34f5b --- /dev/null +++ b/static/MySQL/6212_fn_shop_get_product_permutation_variations_csv.sql @@ -0,0 +1,49 @@ + +DROP FUNCTION IF EXISTS fn_shop_get_product_permutation_variations_csv; + +DELIMITER // + +CREATE FUNCTION fn_shop_get_product_permutation_variations_csv(id_product_permutation INT) +RETURNS VARCHAR(4000) +DETERMINISTIC +BEGIN + DECLARE csv VARCHAR(4000); + + SET csv := ( + SELECT + CASE WHEN P.has_variations = 0 THEN + '' + ELSE + GROUP_CONCAT( + CONCAT( + PV.id_type + , ':' + , PV.id_variation + ) + SEPARATOR ',' + ) + END + FROM partsltd_prod.Shop_Product_Permutation PP + LEFT JOIN partsltd_prod.Shop_Product P ON PP.id_product = P.id_product + LEFT JOIN partsltd_prod.Shop_Product_Permutation_Variation_Link PPVL ON PP.id_permutation = PPVL.id_permutation + LEFT JOIN partsltd_prod.Shop_Variation PV ON PPVL.id_variation = PV.id_variation + LEFT JOIN partsltd_prod.Shop_Variation_Type PVT ON PV.id_type = PVT.id_type + WHERE PP.id_permutation = id_product_permutation + GROUP BY P.id_product, P.has_variations, PVT.display_order, PVT.name, PV.display_order, PV.name + LIMIT 1 + ); + + RETURN csv; +END // + +DELIMITER ; +SELECT + fn_shop_get_product_permutation_variations_csv( + 3 -- id_product_permutation + ) + , fn_shop_get_product_permutation_variations_csv( + 1 -- id_product_permutation + ) +; +/* +*/ \ No newline at end of file diff --git a/static/MySQL/7206_p_shop_save_product_permutation.sql b/static/MySQL/7206_p_shop_save_product_permutation.sql index 7d0d1a2c..37c58cb2 100644 --- a/static/MySQL/7206_p_shop_save_product_permutation.sql +++ b/static/MySQL/7206_p_shop_save_product_permutation.sql @@ -67,11 +67,14 @@ BEGIN CALL p_validate_guid ( a_guid ); - DROP TABLE IF EXISTS tmp_Permutation; + DROP TEMPORARY TABLE IF EXISTS tmp_Permutation_Variation_Link; + DROP TEMPORARY TABLE IF EXISTS tmp_Permutation; CREATE TEMPORARY TABLE tmp_Permutation ( id_permutation INT NOT NULL + , id_permutation_temp INT NOT NULL , id_product INT NOT NULL + , csv_id_pairs_variation VARCHAR(4000) NULL , description VARCHAR(4000) NOT NULL , cost_local_VAT_excl FLOAT NULL , cost_local_VAT_incl FLOAT NULL @@ -97,6 +100,15 @@ BEGIN , name_error VARCHAR(255) NOT NULL , is_new BIT NOT NULL ); + + CREATE TEMPORARY TABLE tmp_Permutation_Variation_Link ( + id_link INT NOT NULL + , id_permutation INT NOT NULL + , id_variation INT NOT NULL + , active BIT NOT NULL + , display_order INT NOT NULL + , is_new BIT NOT NULL + ); CREATE TEMPORARY TABLE IF NOT EXISTS tmp_Msg_Error ( display_order INT NOT NULL PRIMARY KEY AUTO_INCREMENT @@ -109,7 +121,9 @@ BEGIN -- Get data from Temp table INSERT INTO tmp_Permutation ( id_permutation + , id_permutation_temp , id_product + , csv_id_pairs_variation , description , cost_local_VAT_excl , cost_local_VAT_incl @@ -134,7 +148,9 @@ BEGIN ) SELECT PP_T.id_permutation + , PP_T.id_permutation , IFNULL(PP_T.id_product, PP.id_product) AS id_product + , PP_T.csv_id_pairs_variation , IFNULL(PP_T.description, PP.description) AS description , IFNULL(PP_T.cost_local_VAT_excl, PP.cost_local_VAT_excl) AS cost_local_VAT_excl , IFNULL(PP_T.cost_local_VAT_incl, PP.cost_local_VAT_incl) AS cost_local_VAT_incl @@ -161,6 +177,46 @@ BEGIN WHERE PP_T.guid = a_guid ; + SELECT + partsltd_prod.fn_shop_get_product_variations_from_id_csv_list( + t_PP.id_permutation -- a_id_permutation + , t_PP.csv_id_pairs_variation -- a_variation_csv + , a_guid -- a_guid + ) + FROM tmp_Permutation t_PP + WHERE NOT ISNULL(t_PP.csv_id_pairs_variation) + ; + + INSERT INTO tmp_Permutation_Variation_Link ( + id_link + , id_permutation + , id_variation + , display_order + , active + , is_new + ) + SELECT + PPVL_T.id_link + , PPVL_T.id_permutation + , PPVL_T.id_variation + , PPVL_T.display_order + , NOT ISNULL(PPVL_T.id_link) AS active + , IFNULL(PPVL_T.id_link, 0) < 1 AS is_new + FROM partsltd_prod.Shop_Product_Permutation_Variation_Link_Temp PPVL_T + LEFT JOIN partsltd_prod.Shop_Product_Permutation_Variation_Link PPVL ON PPVL_T.id_link = PPVL.id_variation + LEFT JOIN tmp_Permutation t_PP ON PPVL_T.id_permutation = t_PP.id_permutation + WHERE PPVL_T.GUID = a_guid + ; + + IF a_debug = 1 THEN + SELECT * + FROM tmp_Permutation + ; + SELECT * + FROM tmp_Permutation_Variation_Link + ; + END IF; + -- Validation -- Missing mandatory fields -- id_product @@ -224,8 +280,6 @@ BEGIN ; END IF; - SELECT 'NIPS'; - -- latency_manufacture IF EXISTS (SELECT * FROM tmp_Permutation t_P WHERE ISNULL(t_P.latency_manufacture) LIMIT 1) THEN INSERT INTO tmp_Msg_Error ( @@ -376,6 +430,17 @@ BEGIN , t_P.can_admin = UE_T.can_admin ; + IF a_debug = 1 THEN + SELECT * + FROM partsltd_prod.Shop_Calc_User_Temp + WHERE GUID = a_guid + ; + SELECT * + FROM tmp_Permutation t_PP + LEFT JOIN Shop_Product P ON t_PP.id_product = P.id_product + ; + END IF; + CALL p_shop_clear_calc_user( a_guid , 0 -- a_debug @@ -392,20 +457,84 @@ BEGIN , v_code_type_error_bad_data , CONCAT('The following product permutation(s) do not have product edit permission: ', GROUP_CONCAT(t_P.name_error SEPARATOR ', ')) AS msg FROM tmp_Permutation t_P - WHERE ISNULL(t_P.can_edit) + WHERE + ISNULL(t_P.can_edit) ; END IF; + + IF a_debug = 1 THEN + SELECT * + FROM partsltd_prod.Shop_Product_Permutation_Variation_Link_Temp + WHERE GUID = a_guid + ; + END IF; IF NOT EXISTS (SELECT * FROM tmp_Msg_Error LIMIT 1) THEN START TRANSACTION; - IF NOT ISNULL(v_ids_product_permission) THEN INSERT INTO Shop_Product_Change_Set ( comment ) VALUES ( a_comment ) ; SET v_id_change_set := LAST_INSERT_ID(); + INSERT INTO Shop_Product_Permutation ( + id_permutation_temp + , id_product + , description + , cost_local_VAT_excl + , cost_local_VAT_incl + , id_currency_cost + , profit_local_min + , latency_manufacture + , id_unit_measurement_quantity + , count_unit_measurement_per_quantity_step + , quantity_min + , quantity_max + , quantity_stock + , is_subscription + , id_unit_measurement_interval_recurrence + , count_interval_recurrence + , id_stripe_product + , does_expire_faster_once_unsealed + , id_unit_measurement_interval_expiration_unsealed + , count_interval_expiration_unsealed + , active + , created_by + , created_on + , id_change_set + ) + SELECT + t_P.id_permutation + , t_P.id_product AS id_product + , t_P.description AS description + , t_P.cost_local_VAT_excl AS cost_local_VAT_excl + , t_P.cost_local_VAT_incl AS cost_local_VAT_incl + , t_P.id_currency_cost AS id_currency_cost + , t_P.profit_local_min AS profit_local_min + , t_P.latency_manufacture AS latency_manufacture + , t_P.id_unit_measurement_quantity AS id_unit_measurement_quantity + , t_P.count_unit_measurement_per_quantity_step AS count_unit_measurement_per_quantity_step + , t_P.quantity_min AS quantity_min + , t_P.quantity_max AS quantity_max + , t_P.quantity_stock AS quantity_stock + , t_P.is_subscription AS is_subscription + , t_P.id_unit_measurement_interval_recurrence AS id_unit_measurement_interval_recurrence + , t_P.count_interval_recurrence AS count_interval_recurrence + , t_P.id_stripe_product AS id_stripe_product + , t_P.does_expire_faster_once_unsealed AS does_expire_faster_once_unsealed + , t_P.id_unit_measurement_interval_expiration_unsealed AS id_unit_measurement_interval_expiration_unsealed + , t_P.count_interval_expiration_unsealed AS count_interval_expiration_unsealed + , t_P.active AS active + , a_id_user AS created_by + , v_time_start AS created_on + , v_id_change_set AS id_change_set + FROM tmp_Permutation t_P + WHERE + is_new = 1 + AND active = 1 + ; + UPDATE Shop_Product_Permutation PP INNER JOIN tmp_Permutation t_P ON PP.id_permutation = t_P.id_permutation SET @@ -431,66 +560,60 @@ BEGIN , PP.active = t_P.active , PP.id_change_set = v_id_change_set ; + + UPDATE tmp_Permutation t_PP + INNER JOIN partsltd_prod.Shop_Product_Permutation PP + ON t_PP.id_permutation_temp = PP.id_permutation_temp + AND PP.id_change_set = v_id_change_set + SET + t_PP.id_permutation = PP.id_permutation + ; + UPDATE tmp_Permutation_Variation_Link t_PPVL + INNER JOIN tmp_Permutation t_PP ON t_PPVL.id_permutation = t_PP.id_permutation_temp + SET + t_PPVL.id_permutation = t_PP.id_permutation + ; + + INSERT INTO partsltd_prod.Shop_Product_Permutation_Variation_Link ( + id_permutation + , id_variation + , display_order + , active + ) + SELECT + t_PPVL.id_permutation + , t_PPVL.id_variation + , t_PPVL.display_order + , t_PPVL.active + FROM tmp_Permutation_Variation_Link t_PPVL + WHERE + t_PPVL.is_new = 1 + AND t_PPVL.active = 1 + ; + + UPDATE partsltd_prod.Shop_Product_Permutation_Variation_Link PPVL + INNER JOIN tmp_Permutation_Variation_Link t_PPVL + ON PPVL.id_link = t_PPVL.id_link + AND t_PPVL.is_new = 1 + SET + PPVL.id_permutation = t_PPVL.id_permutation + , PPVL.id_variation = t_PPVL.id_variation + , PPVL.display_order = t_PPVL.display_order + , PPVL.active = t_PPVL.active + , PPVL.id_change_set = v_id_change_set + ; END IF; - INSERT INTO Shop_Product_Permutation ( - id_product - , description - , cost_local_VAT_excl - , cost_local_VAT_incl - , id_currency_cost - , profit_local_min - , latency_manufacture - , id_unit_measurement_quantity - , count_unit_measurement_per_quantity_step - , quantity_min - , quantity_max - , quantity_stock - , is_subscription - , id_unit_measurement_interval_recurrence - , count_interval_recurrence - , id_stripe_product - , does_expire_faster_once_unsealed - , id_unit_measurement_interval_expiration_unsealed - , count_interval_expiration_unsealed - , active - , created_by - , created_on - ) - SELECT - t_P.id_product AS id_product - , t_P.description AS description - , t_P.cost_local_VAT_excl AS cost_local_VAT_excl - , t_P.cost_local_VAT_incl AS cost_local_VAT_incl - , t_P.id_currency_cost AS id_currency_cost - , t_P.profit_local_min AS profit_local_min - , t_P.latency_manufacture AS latency_manufacture - , t_P.id_unit_measurement_quantity AS id_unit_measurement_quantity - , t_P.count_unit_measurement_per_quantity_step AS count_unit_measurement_per_quantity_step - , t_P.quantity_min AS quantity_min - , t_P.quantity_max AS quantity_max - , t_P.quantity_stock AS quantity_stock - , t_P.is_subscription AS is_subscription - , t_P.id_unit_measurement_interval_recurrence AS id_unit_measurement_interval_recurrence - , t_P.count_interval_recurrence AS count_interval_recurrence - , t_P.id_stripe_product AS id_stripe_product - , t_P.does_expire_faster_once_unsealed AS does_expire_faster_once_unsealed - , t_P.id_unit_measurement_interval_expiration_unsealed AS id_unit_measurement_interval_expiration_unsealed - , t_P.count_interval_expiration_unsealed AS count_interval_expiration_unsealed - , t_P.active AS active - , a_id_user AS created_by - , v_time_start AS created_on - FROM tmp_Permutation t_P - WHERE - is_new = 1 - AND active = 1 - ; DELETE FROM Shop_Product_Permutation_Temp - WHERE GUID = a_guid; - - COMMIT; - END IF; + WHERE GUID = a_guid + ; + + DELETE FROM partsltd_prod.Shop_Product_Permutation_Variation_Link_Temp + WHERE GUID = a_guid + ; + + COMMIT; # Errors SELECT * @@ -499,9 +622,11 @@ BEGIN ; IF a_debug = 1 THEN - SELECT * from tmp_Permutation; + SELECT * FROM tmp_Permutation; + SELECT * FROM tmp_Permutation_Variation_Link; END IF; + DROP TEMPORARY TABLE tmp_Permutation_Variation_Link; DROP TEMPORARY TABLE tmp_Permutation; DROP TEMPORARY TABLE tmp_Msg_Error; @@ -590,5 +715,7 @@ DELETE FROM Shop_Product_Permutation_Temp WHERE id_permutation = 1; +select * from shop_unit_measurement; + */ diff --git a/static/MySQL/7206_p_shop_save_product_permutation_test.sql b/static/MySQL/7206_p_shop_save_product_permutation_test.sql index b9468e10..3ce60a20 100644 --- a/static/MySQL/7206_p_shop_save_product_permutation_test.sql +++ b/static/MySQL/7206_p_shop_save_product_permutation_test.sql @@ -18,6 +18,9 @@ BEGIN FROM partsltd_prod.Shop_Product_Permutation ; SELECT * + FROM partsltd_prod.Shop_Product_Permutation_Variation_Link + ; + SELECT * FROM partsltd_prod.Shop_Product_Permutation_Temp ; @@ -26,6 +29,7 @@ BEGIN INSERT INTO partsltd_prod.Shop_Product_Permutation_Temp ( id_permutation , id_product + , csv_id_pairs_variation , description , cost_local_VAT_excl , cost_local_VAT_incl @@ -48,10 +52,11 @@ BEGIN , guid ) VALUES - /* Test 1 - Insert */ + /* Test 1 - Insert ( -1 -- id_permutation , 5 -- id_product + , '' -- csv_id_pairs_variation , 'Hair clip' -- description , NULL -- cost_local_VAT_excl , NULL -- cost_local_VAT_incl @@ -73,6 +78,7 @@ BEGIN , 1 -- active , v_guid ) + */ /* Test 2 - Update ( 4 -- id_product @@ -85,6 +91,32 @@ BEGIN , v_guid ) */ + /* Test 3 - Insert with Variations */ + ( + -1 -- id_permutation + , 1 -- id_product + , '1:3' -- csv_id_pairs_variation + , 'Test with variations' -- description + , NULL -- cost_local_VAT_excl + , NULL -- cost_local_VAT_incl + , 1 -- id_currency_cost + , NULL -- profit_local_min + , 1 -- latency_manufacture + , 3 -- id_unit_measurement_quantity + , 1 -- count_unit_measurement_per_quantity_step + , 0 -- quantity_min + , 0 -- quantity_max + , 2 -- quantity_stock + , FALSE -- is_subscription + , NULL -- id_unit_measurement_interval_recurrence + , NULL -- count_interval_recurrence + , NULL -- id_stripe_product + , TRUE -- does_expire_faster_once_unsealed + , 8 -- id_unit_measurement_interval_expiration_unsealed + , 2 -- count_interval_expiration_unsealed + , 1 -- active + , v_guid + ) ; COMMIT; @@ -105,6 +137,9 @@ BEGIN FROM partsltd_prod.Shop_Product_Permutation ; SELECT * + FROM partsltd_prod.Shop_Product_Permutation_Variation_Link + ; + SELECT * FROM partsltd_prod.Shop_Product_Permutation_Temp ; @@ -112,6 +147,7 @@ BEGIN END // DELIMITER ;; +/* CALL partsltd_prod.p_shop_save_product_permutation_test (); DELETE FROM partsltd_prod.Shop_Product_Permutation_Temp; @@ -119,7 +155,17 @@ DELETE FROM partsltd_prod.Shop_Product_Permutation_Temp; DROP TABLE IF EXISTS tmp_Msg_Error; -/* -SELECT * FROM partsltd_prod.Shop_Product -Cannot add or update a child row: a foreign key constraint fails (`partsltd_prod`.`shop_product_permutation`, CONSTRAINT `FK_Shop_Product_Permutation_id_product` FOREIGN KEY (`id_product`) REFERENCES `shop_product` (`id_product`) ON UPDATE RESTRICT) +DELETE FROM partsltd_prod.Shop_Product_Permutation_Variation_Link +WHERE id_link >= 3 +; +DELETE FROM partsltd_prod.Shop_Product_Permutation +WHERE id_permutation >= 7 +; + + SELECT * + FROM partsltd_prod.Shop_Product_Permutation_Variation_Link_Temp + ; + SELECT * + FROM partsltd_prod.Shop_Variation + ; */ \ No newline at end of file diff --git a/static/MySQL/7403_p_shop_save_supplier_purchase_order.sql b/static/MySQL/7403_p_shop_save_supplier_purchase_order.sql index 674de967..82f0d8b3 100644 --- a/static/MySQL/7403_p_shop_save_supplier_purchase_order.sql +++ b/static/MySQL/7403_p_shop_save_supplier_purchase_order.sql @@ -683,7 +683,9 @@ BEGIN UPDATE tmp_Supplier_Purchase_Order t_SPO - INNER JOIN partsltd_prod.Shop_Supplier_Purchase_Order SPO ON t_SPO.id_order_temp = SPO.id_order_temp + INNER JOIN partsltd_prod.Shop_Supplier_Purchase_Order SPO + ON t_SPO.id_order_temp = SPO.id_order_temp + AND SPO.id_change_set = v_id_change_set SET t_SPO.id_order = SPO.id_order WHERE t_SPO.is_new = 1 diff --git a/static/MySQL/7403_p_shop_save_supplier_purchase_order_test.sql b/static/MySQL/7403_p_shop_save_supplier_purchase_order_test.sql index 3902064f..2f49dec4 100644 --- a/static/MySQL/7403_p_shop_save_supplier_purchase_order_test.sql +++ b/static/MySQL/7403_p_shop_save_supplier_purchase_order_test.sql @@ -58,7 +58,6 @@ BEGIN WHERE id_order = 6 */ ; - /* INSERT INTO partsltd_prod.Shop_Supplier_Purchase_Order_Product_Link_Temp ( id_link , id_order @@ -73,8 +72,7 @@ BEGIN , cost_total_local_VAT_incl , GUID ) - ; - / Test 1 - Insert + /* Test 1 - Insert */ VALUES ( -1 , -1 @@ -89,7 +87,6 @@ BEGIN , 6 , v_guid ) - */ /* Test 2 - Update SELECT id_link @@ -107,7 +104,7 @@ BEGIN FROM partsltd_prod.Shop_Supplier_Purchase_Order_Product_Link WHERE id_order = 6 */ - + ; COMMIT; diff --git a/static/MySQL/7415_p_shop_save_Manufacturing_purchase_order_test.sql b/static/MySQL/7415_p_shop_save_Manufacturing_purchase_order_test.sql index fe5b3378..447ea810 100644 --- a/static/MySQL/7415_p_shop_save_Manufacturing_purchase_order_test.sql +++ b/static/MySQL/7415_p_shop_save_Manufacturing_purchase_order_test.sql @@ -146,4 +146,5 @@ DELETE FROM partsltd_prod.Shop_Manufacturing_Purchase_Order_Product_Link_Temp; DROP TABLE IF EXISTS tmp_Msg_Error; select * from partsltd_prod.Shop_User; +Expression #2 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'partsltd_prod.t_MPOPL.name_error' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by */ \ No newline at end of file diff --git a/static/MySQL/7415_p_shop_save_manufacturing_purchase_order.sql b/static/MySQL/7415_p_shop_save_manufacturing_purchase_order.sql index b5f3d20c..dd50607c 100644 --- a/static/MySQL/7415_p_shop_save_manufacturing_purchase_order.sql +++ b/static/MySQL/7415_p_shop_save_manufacturing_purchase_order.sql @@ -581,13 +581,14 @@ BEGIN END IF; -- Duplicates + /* IF EXISTS ( SELECT - id_permutation - , name_error + t_MPOPL.id_permutation + , t_MPOPL.name_error , COUNT(*) FROM tmp_Manufacturing_Purchase_Order_Product_Link t_MPOPL - GROUP BY id_permutation + GROUP BY t_MPOPL.id_permutation, t_MPOPL.name_error HAVING COUNT(*) > 1 ) THEN INSERT INTO tmp_Msg_Error ( @@ -599,15 +600,16 @@ BEGIN CONCAT('Duplicate records: ', GROUP_CONCAT(t_MPOPLC.name_error SEPARATOR ', ')) FROM ( SELECT - id_permutation - , name_error - , COUNT(*) + t_MPOPL.id_permutation + , t_MPOPL.name_error + , COUNT(*) FROM tmp_Manufacturing_Purchase_Order_Product_Link t_MPOPL - GROUP BY id_permutation + GROUP BY t_MPOPL.id_permutation, t_MPOPL.name_error HAVING COUNT(*) > 1 ) t_MPOPLC ; END IF; + */ -- Empty Manufacturing Purchase Order IF EXISTS ( SELECT * FROM tmp_Manufacturing_Purchase_Order t_MPO LEFT JOIN tmp_Manufacturing_Purchase_Order_Product_Link t_MPOPL ON t_MPO.id_order = t_MPOPL.id_order WHERE ISNULL(t_MPOPL.id_order) ) THEN INSERT INTO tmp_Msg_Error ( @@ -829,7 +831,9 @@ BEGIN ; UPDATE tmp_Manufacturing_Purchase_Order t_MPO - INNER JOIN partsltd_prod.Shop_Manufacturing_Purchase_Order MPO ON t_MPO.id_order_temp = MPO.id_order_temp + INNER JOIN partsltd_prod.Shop_Manufacturing_Purchase_Order MPO + ON t_MPO.id_order_temp = MPO.id_order_temp + AND MPO.id_change_set = v_id_change_set SET t_MPO.id_order = MPO.id_order WHERE t_MPO.is_new = 1 diff --git a/static/MySQL/7416_p_shop_get_many_manufacturing_purchase_order.sql b/static/MySQL/7416_p_shop_get_many_manufacturing_purchase_order.sql index dead2110..edee8283 100644 --- a/static/MySQL/7416_p_shop_get_many_manufacturing_purchase_order.sql +++ b/static/MySQL/7416_p_shop_get_many_manufacturing_purchase_order.sql @@ -282,7 +282,7 @@ BEGIN VALUES ( v_id_type_error_no_permission , v_code_type_error_no_permission - , CONCAT('You do not have view permissions for ', IFNULL((SELECT IFNULL(name, '(No Permission Name)') FROM partsltd_prod.Shop_Permission WHERE id_permission LIKE CONCAT('%', v_ids_permission_manufacturing_purchase_order, '%') LIMIT 1), '(No Permissions Found)')) + , CONCAT('You do not have view permissions for ', IFNULL((SELECT IFNULL(name, '(No Permission Name)') FROM partsltd_prod.Shop_Permission WHERE FIND_IN_SET(id_permission, v_ids_permission_manufacturing_purchase_order) > 0 LIMIT 1), '(No Permissions Found)')) ) ; END IF; diff --git a/static/MySQL/9000_populate.sql b/static/MySQL/9000_populate.sql index dfa0f241..cbefd0d9 100644 --- a/static/MySQL/9000_populate.sql +++ b/static/MySQL/9000_populate.sql @@ -363,6 +363,7 @@ VALUES # Product Permutations INSERT INTO Shop_Product_Permutation ( -- display_order, + id_permutation_temp, id_product, description, cost_local_VAT_excl, @@ -387,7 +388,8 @@ INSERT INTO Shop_Product_Permutation ( ) VALUES ( - -- 1, + -- 1, + -1, 1, 'Good Red', 5, @@ -412,6 +414,7 @@ VALUES ), ( -- 2, + -2, 1, 'Good Blue', 6, @@ -436,6 +439,7 @@ VALUES ), ( -- 3, + -3, 2, 'Test product describes good', 10, @@ -460,6 +464,7 @@ VALUES ), ( -- 4, + -4, 3, 'Phone describes good', 10, @@ -484,6 +489,7 @@ VALUES ), ( -- 5, + -5, 4, 'Laptop describes good', 10, @@ -508,6 +514,7 @@ VALUES ), ( -- 6, + -6, 5, 'Smart watch describes good', 10, @@ -548,6 +555,9 @@ INSERT INTO Shop_Variation ( VALUES (1, 1, 'RED', 'Red', NULL, NULL) , (2, 1, 'BLUE', 'Blue', NULL, NULL) + , (3, 1, 'GREEN', 'Green', NULL, NULL) + , (4, 1, 'White', 'White', NULL, NULL) + , (5, 1, 'BLACK', 'Black', NULL, NULL) , (1, 2, '400ml', '400 millilitres', 6, 400) , (2, 2, '400g', '400 grams', 4, 400) , (3, 2, '410g', '410 grams', 4, 410) diff --git a/static/MySQL/temp.txt b/static/MySQL/file_list.txt similarity index 98% rename from static/MySQL/temp.txt rename to static/MySQL/file_list.txt index 76548723..c987460e 100644 --- a/static/MySQL/temp.txt +++ b/static/MySQL/file_list.txt @@ -57,6 +57,7 @@ 1214_tbl_Shop_Variation_Temp.sql 1215_tbl_Shop_Product_Permutation_Variation_Link.sql 1216_tbl_Shop_Product_Permutation_Variation_Link_Audit.sql +1217_tbl_Shop_Product_Permutation_Variation_Link_Temp.sql 1218_tbl_Shop_Stock_Item.sql 1219_tbl_Shop_Stock_Item_Audit.sql 1220_tbl_Shop_Stock_Item_Temp.sql @@ -172,6 +173,7 @@ 6004_p_clear_split_key_value_pair_csv_temp.sql 6206_fn_shop_get_product_permutation_name.sql 6210_fn_shop_get_id_product_permutation_from_variation_csv_list.sql +6211_fn_shop_get_product_variations_from_id_csv_list.sql 6500_p_shop_calc_user.sql 6501_p_shop_clear_calc_user.sql 7003_p_shop_get_many_access_level.sql diff --git a/static/batch/sql_combine.bat b/static/batch/sql_combine.bat index 54ad4175..997fadba 100644 --- a/static/batch/sql_combine.bat +++ b/static/batch/sql_combine.bat @@ -1,7 +1,6 @@ @echo off setlocal enabledelayedexpansion -:: set "test=C:\C:\ \" set dir_parent=C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\static\MySQL :: set dir_parent=C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\static\PostgreSQL set "f_list=file_list.txt" @@ -19,14 +18,12 @@ set "strs_delete_6=600_p_shop_save_product.sql" set "strs_delete_7=170_ish_tbl_ERP_Order.sql" set "strs_delete_7=dump.sql" set strs_n_max=8 -set strs_list =%strs_delete_0% %strs_delete_1% %strs_delete_2% %strs_delete_3% %strs_delete_4% -set "str_true=true" -set "str_replace=" set "str_list=" +set max_length=8191 +set threshold=1000 -:: report constants echo temp = %f_tmp% echo dir_parent = !%dir_parent%! echo dir_current = !%dir_current%! @@ -34,49 +31,43 @@ echo file_list = %f_list% echo file = %f_combine% echo n strings = !strs_n_max! -:: begin cd %dir_parent% -::echo current directory: %cd% del %f_tmp% del %f_list% del %f_combine% -:: colate dir files -dir /b > %f_list% +dir /b *.sql > %f_list% -::type %f_list% echo loopy -:: Remove blacklist files -:: grep -v '920_edit_permissions.sql' %f_list% > %f_list% -:: grep -v '910_anal.sql' %f_list% > %f_list% - (for /f "delims=" %%a in (%f_list%) do ( - ::if %verbose% gtr 0 ( echo new line ) set "line=%%a" - ::if %verbose% gtr 0 ( echo new line = !line! ) - ::if !line! neq %strs_delete_0% if !line! neq %strs_delete_1% if !line! neq %strs_delete_2% if !line! neq %strs_delete_3% if !line! neq %strs_delete_4% if !line! neq %strs_delete_5% if !line! neq %strs_delete_6% ( - :: echo !line! - :: set "str_list=!str_list! !line!" - ::) set include_line=1 for /L %%i in (0, 1, %strs_n_max%) do ( - ::set "str_delete=!strs_delete_%%i!" if !line! equ !strs_delete_%%i! ( set include_line=0 ) - ::set "include_line=!include_line!" set "line=!line!" ) if !include_line! gtr 0 ( echo !line! - set "str_list=!str_list! !line!" + ::set "str_list=!str_list! !line!" + ::set length=0 + ::for %%i in (!str_list!) do ( + :: set /a length+=1 + ::) + ::if !length! geq !threshold! ( + :: echo !str_list! + :: echo !str_list! > %f_combine% + :: set "str_list=" + ::) + type !line! >> %f_combine% ) set "line=!line!" )) > %f_tmp% -:: Combine files + echo output list: type %f_tmp% @@ -84,12 +75,15 @@ del %f_list% echo file_tmp: %f_tmp% echo file_list: %f_list% echo combining files -::type %f_tmp% | type > %f_list% -:: -::type %f_list% +echo !str_list! + echo cmd: -echo "type !str_list! > %f_combine%" -type !str_list! > %f_combine% +::echo "type !str_list! > %f_combine%" +::type !str_list! > %f_combine% +::(for %%f in (!str_list!) do ( +:: echo %%f +:: type "%%f" >> %f_combine% +::)) cd %dir_current% diff --git a/static/batch/sql_combine.ps1 b/static/batch/sql_combine.ps1 new file mode 100644 index 00000000..9918bf16 --- /dev/null +++ b/static/batch/sql_combine.ps1 @@ -0,0 +1,43 @@ + +# Combine-SqlFiles.ps1 +param( + [string]$sourceFolder = "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\static\MySQL\", + [string]$outputFileName = "0000_combined.sql", + [string]$filePattern = "*.sql", + [string[]]$excludeFiles = @("920_edit_permissions.sql", "910_anal.sql", "701_p_shop_get_many_role_permission.sql", "600_p_shop_save_product.sql", "dump.sql") # Array of filenames to exclude +) + +$outputFile = Join-Path $sourceFolder $outputFileName +$outputDir = Split-Path -Parent $outputFile + +# Remove output file if it exists +if (Test-Path $outputFile) { + Remove-Item $outputFile -Force +} + +# Create directory if needed +if (!(Test-Path -Path $outputDir)) { + New-Item -ItemType Directory -Force -Path $outputDir +} + +# Create a StringBuilder for efficiency +$output = New-Object System.Text.StringBuilder + +# Process each file +Get-ChildItem -Path $sourceFolder -Filter $filePattern -File | + Where-Object { $_.Name -notin $excludeFiles -and $_.Name -ne $outputFileName } | + ForEach-Object { + [void]$output.AppendLine("-- File: $($_.Name)") + # Read file content and remove BOM if present + $content = [System.IO.File]::ReadAllBytes($_.FullName) + if ($content[0] -eq 0xEF -and $content[1] -eq 0xBB -and $content[2] -eq 0xBF) { + $content = $content[3..($content.Length-1)] + } + [void]$output.AppendLine([System.Text.Encoding]::UTF8.GetString($content)) + [void]$output.AppendLine() + } + +# Write final output +[System.IO.File]::WriteAllText($outputFile, $output.ToString(), [System.Text.UTF8Encoding]::new($false)) + +Write-Host "Files combined successfully into $outputFile" \ No newline at end of file diff --git a/static/css/layouts/header.css b/static/css/layouts/header.css index 4918f844..eb486b3b 100644 --- a/static/css/layouts/header.css +++ b/static/css/layouts/header.css @@ -67,6 +67,28 @@ } /* Page Filters */ +#formFilters * { + font-size: 12px; +} + +#formFilters .container { + max-width: fit-content; +} +#formFilters .container-input { + padding: 0 0.5vh; +} + +#formFilters .container-input input { + max-width: 5vh; +} + +#formFilters .container-input.filter.active { + width: 8vh; +} +#formFilters .container-input.filter.is_not_empty { + width: 12vh; +} + button.collapsed { display: block; opacity: 0; @@ -79,11 +101,4 @@ form.filter button.save, form.filter button.button-cancel { form.filter button.save, form.filter button.button-cancel { margin-top: 0; margin-bottom: 0; -} - -#formFilters .container-input.filter.active { - width: 8vh; -} -#formFilters .container-input.filter.is_not_empty { - width: 12vh; } \ No newline at end of file diff --git a/static/css/pages/store/product_permutations.css b/static/css/pages/store/product_permutations.css index 2be740e6..bf8b4fa9 100644 --- a/static/css/pages/store/product_permutations.css +++ b/static/css/pages/store/product_permutations.css @@ -1,13 +1,8 @@ #formFilters { - width: 50vh; + width: 95vh; } -#formFilters .container { - max-width: fit-content; -} - - #tableMain { max-width: 90vw; } diff --git a/static/css/pages/store/products.css b/static/css/pages/store/products.css index 2a0c688e..9219df7c 100644 --- a/static/css/pages/store/products.css +++ b/static/css/pages/store/products.css @@ -15,11 +15,10 @@ width: 8vh; } -/* + #tableMain { - max-width: min(calc(1vh * 79), calc(1vw * 90)); + max-width: min(calc(1vh * 65), calc(1vw * 90)); } -*/ #tableMain tbody tr td.display_order, #tableMain thead tr th.display_order { width: 5vh; diff --git a/static/dist/css/main.bundle.css b/static/dist/css/main.bundle.css index 6f45fad5..5cfac856 100644 --- a/static/dist/css/main.bundle.css +++ b/static/dist/css/main.bundle.css @@ -563,6 +563,28 @@ table div { } /* Page Filters */ +#formFilters * { + font-size: 12px; +} + +#formFilters .container { + max-width: fit-content; +} +#formFilters .container-input { + padding: 0 0.5vh; +} + +#formFilters .container-input input { + max-width: 5vh; +} + +#formFilters .container-input.filter.active { + width: 8vh; +} +#formFilters .container-input.filter.is_not_empty { + width: 12vh; +} + button.collapsed { display: block; opacity: 0; @@ -577,13 +599,6 @@ form.filter button.save, form.filter button.button-cancel { margin-bottom: 0; } -#formFilters .container-input.filter.active { - width: 8vh; -} -#formFilters .container-input.filter.is_not_empty { - width: 12vh; -} - /* Footer */ .footer { padding: 1vh; diff --git a/static/dist/css/store_product_permutations.bundle.css b/static/dist/css/store_product_permutations.bundle.css index 3aa1b12e..c94b2239 100644 --- a/static/dist/css/store_product_permutations.bundle.css +++ b/static/dist/css/store_product_permutations.bundle.css @@ -57,14 +57,9 @@ #formFilters { - width: 50vh; + width: 95vh; } -#formFilters .container { - max-width: fit-content; -} - - #tableMain { max-width: 90vw; } diff --git a/static/dist/js/main.bundle.js b/static/dist/js/main.bundle.js index 2b8ea09c..51ba5f36 100644 --- a/static/dist/js/main.bundle.js +++ b/static/dist/js/main.bundle.js @@ -2792,7 +2792,7 @@ var TableBasePage = /*#__PURE__*/function (_BasePage) { key: "handleChangeProductCategoryDdl", value: function handleChangeProductCategoryDdl(event, ddlCategory) { this.handleChangeNestedElementCellTable(event, ddlCategory); - var idProductCategorySelected = DOM.getElementValueCurrent(ddlCategory); + var idProductCategorySelected = DOM.getElementAttributeValueCurrent(ddlCategory); var row = DOM.getRowFromElement(ddlCategory); var tdProduct = row.querySelector('td.' + flagProduct); tdProduct.dispatchEvent(new Event('click')); @@ -4646,8 +4646,8 @@ var PageStoreProductPermutations = /*#__PURE__*/function (_TableBasePage) { var tdProduct = row.querySelector('td.' + flagProduct); var tdProductVariations = row.querySelector('td.' + flagProductVariations); var inputDescription = row.querySelector('td.' + flagDescription + ' textarea'); - var inputCostLocalVatExcl = row.querySelector('td.' + flagCostUnitLocalVatExcl + ' input'); - var inputCostLocalVatIncl = row.querySelector('td.' + flagCostUnitLocalVatIncl + ' input'); + // let inputCostLocalVatExcl = row.querySelector('td.' + flagCostUnitLocalVatExcl + ' input'); + // let inputCostLocalVatIncl = row.querySelector('td.' + flagCostUnitLocalVatIncl + ' input'); var tdCurrencyCost = row.querySelector('td.' + flagCurrencyCost); var inputProfitLocalMin = row.querySelector('td.' + flagProfitLocalMin + ' input'); var inputLatencyManufactureDays = row.querySelector('td.' + flagLatencyManufacture + ' input'); @@ -4671,8 +4671,8 @@ var PageStoreProductPermutations = /*#__PURE__*/function (_TableBasePage) { jsonRow[flagProductVariations] = tdProductVariations.getAttribute(attrValueCurrent); jsonRow[flagHasVariations] = jsonRow[flagProductVariations] != ''; jsonRow[flagDescription] = inputDescription.getAttribute(attrValueCurrent); - jsonRow[flagCostUnitLocalVatExcl] = inputCostLocalVatExcl.getAttribute(attrValueCurrent); - jsonRow[flagCostUnitLocalVatIncl] = inputCostLocalVatIncl.getAttribute(attrValueCurrent); + // jsonRow[flagCostUnitLocalVatExcl] = inputCostLocalVatExcl.getAttribute(attrValueCurrent); + // jsonRow[flagCostUnitLocalVatIncl] = inputCostLocalVatIncl.getAttribute(attrValueCurrent); jsonRow[flagCurrencyCost] = tdCurrencyCost.getAttribute(attrValueCurrent); jsonRow[flagProfitLocalMin] = inputProfitLocalMin.getAttribute(attrValueCurrent); jsonRow[flagLatencyManufacture] = inputLatencyManufactureDays.getAttribute(attrValueCurrent); @@ -4694,6 +4694,15 @@ var PageStoreProductPermutations = /*#__PURE__*/function (_TableBasePage) { }, { key: "initialiseRowNew", value: function initialiseRowNew(tbody, row) { + this.initialiseRowNewDdlsProductCategoryAndProduct(row); + var checkboxIsSubscription = row.querySelector('td.' + flagIsSubscription + ' input'); + var checkboxDoesExpireFasterOnceUnsealed = row.querySelector('td.' + flagDoesExpireFasterOnceUnsealed + ' input'); + this.handleChangeCheckboxDoesExpireFasterOnceUnsealed(null, checkboxDoesExpireFasterOnceUnsealed); + this.handleChangeCheckboxIsSubscription(null, checkboxIsSubscription); + } + }, { + key: "initialiseRowNewDdlsProductCategoryAndProduct", + value: function initialiseRowNewDdlsProductCategoryAndProduct(row) { var ddlCategoryFilter = document.querySelector(idFormFilters + ' #' + attrIdProductCategory); var idProductCategoryFilter = DOM.getElementValueCurrent(ddlCategoryFilter); var hasCategoryFilter = !(validation_Validation.isEmpty(idProductCategoryFilter) || idProductCategoryFilter == '0'); @@ -4842,22 +4851,27 @@ var PageStoreProductPermutations = /*#__PURE__*/function (_TableBasePage) { value: function hookupIsSubscriptionFields() { var _this3 = this; this.hookupChangeHandlerTableCells(idTableMain + ' td.' + flagIsSubscription + ' input', function (event, element) { - _this3.handleChangeNestedElementCellTable(event, element); - var isSubscription = DOM.getElementValueCurrent(element); - var row = DOM.getRowFromElement(element); - var inputCountIntervalRecurrence = row.querySelector('td.' + flagCountUnitMeasurementIntervalRecurrence + ' input'); - var divOrDdlIntervalRecurrence = row.querySelector('td.' + flagUnitMeasurementIntervalRecurrence + ' .' + flagUnitMeasurementIntervalRecurrence); - if (isSubscription) { - inputCountIntervalRecurrence.classList.remove(flagCollapsed); - divOrDdlIntervalRecurrence.classList.remove(flagCollapsed); - var tdUnitMeasurementIntervalRecurrence = divOrDdlIntervalRecurrence.closest('td'); - tdUnitMeasurementIntervalRecurrence.dispatchEvent(new Event('click')); - } else { - inputCountIntervalRecurrence.classList.add(flagCollapsed); - divOrDdlIntervalRecurrence.classList.add(flagCollapsed); - } + _this3.handleChangeCheckboxIsSubscription(event, element); }); } + }, { + key: "handleChangeCheckboxIsSubscription", + value: function handleChangeCheckboxIsSubscription(event, element) { + this.handleChangeNestedElementCellTable(event, element); + var isSubscription = DOM.getElementValueCurrent(element); + var row = DOM.getRowFromElement(element); + var inputCountIntervalRecurrence = row.querySelector('td.' + flagCountUnitMeasurementIntervalRecurrence + ' input'); + var divOrDdlIntervalRecurrence = row.querySelector('td.' + flagUnitMeasurementIntervalRecurrence + ' .' + flagUnitMeasurementIntervalRecurrence); + if (isSubscription) { + inputCountIntervalRecurrence.classList.remove(flagCollapsed); + divOrDdlIntervalRecurrence.classList.remove(flagCollapsed); + var tdUnitMeasurementIntervalRecurrence = divOrDdlIntervalRecurrence.closest('td'); + tdUnitMeasurementIntervalRecurrence.dispatchEvent(new Event('click')); + } else { + inputCountIntervalRecurrence.classList.add(flagCollapsed); + divOrDdlIntervalRecurrence.classList.add(flagCollapsed); + } + } }, { key: "hookupIntervalRecurrenceFields", value: function hookupIntervalRecurrenceFields() { @@ -4885,22 +4899,27 @@ var PageStoreProductPermutations = /*#__PURE__*/function (_TableBasePage) { value: function hookupDoesExpireFasterOnceUnsealedCheckboxes() { var _this4 = this; this.hookupChangeHandlerTableCells(idTableMain + ' td.' + flagDoesExpireFasterOnceUnsealed + ' input', function (event, element) { - _this4.handleChangeNestedElementCellTable(event, element); - var doesExpireFasterOnceUnsealed = DOM.getElementValueCurrent(element); - var row = DOM.getRowFromElement(element); - var inputCountIntervalExpirationUnsealed = row.querySelector('td.' + flagCountUnitMeasurementIntervalExpirationUnsealed + ' input'); - var divOrDdlIntervalExpirationUnsealed = row.querySelector('td.' + flagUnitMeasurementIntervalExpirationUnsealed + ' .' + flagUnitMeasurementIntervalExpirationUnsealed); - if (doesExpireFasterOnceUnsealed) { - inputCountIntervalExpirationUnsealed.classList.remove(flagCollapsed); - divOrDdlIntervalExpirationUnsealed.classList.remove(flagCollapsed); - var tdUnitMeasurementIntervalExpirationUnsealed = divOrDdlIntervalExpirationUnsealed.closest('td'); - tdUnitMeasurementIntervalExpirationUnsealed.dispatchEvent(new Event('click')); - } else { - inputCountIntervalExpirationUnsealed.classList.add(flagCollapsed); - divOrDdlIntervalExpirationUnsealed.classList.add(flagCollapsed); - } + _this4.handleChangeCheckboxDoesExpireFasterOnceUnsealed(event, element); }); } + }, { + key: "handleChangeCheckboxDoesExpireFasterOnceUnsealed", + value: function handleChangeCheckboxDoesExpireFasterOnceUnsealed(event, element) { + this.handleChangeNestedElementCellTable(event, element); + var doesExpireFasterOnceUnsealed = DOM.getElementValueCurrent(element); + var row = DOM.getRowFromElement(element); + var inputCountIntervalExpirationUnsealed = row.querySelector('td.' + flagCountUnitMeasurementIntervalExpirationUnsealed + ' input'); + var divOrDdlIntervalExpirationUnsealed = row.querySelector('td.' + flagUnitMeasurementIntervalExpirationUnsealed + ' .' + flagUnitMeasurementIntervalExpirationUnsealed); + if (doesExpireFasterOnceUnsealed) { + inputCountIntervalExpirationUnsealed.classList.remove(flagCollapsed); + divOrDdlIntervalExpirationUnsealed.classList.remove(flagCollapsed); + var tdUnitMeasurementIntervalExpirationUnsealed = divOrDdlIntervalExpirationUnsealed.closest('td'); + tdUnitMeasurementIntervalExpirationUnsealed.dispatchEvent(new Event('click')); + } else { + inputCountIntervalExpirationUnsealed.classList.add(flagCollapsed); + divOrDdlIntervalExpirationUnsealed.classList.add(flagCollapsed); + } + } }, { key: "hookupIntervalExpirationUnsealedFields", value: function hookupIntervalExpirationUnsealedFields() { diff --git a/static/js/pages/base_table.js b/static/js/pages/base_table.js index fcdd49cd..3c59b31b 100644 --- a/static/js/pages/base_table.js +++ b/static/js/pages/base_table.js @@ -615,7 +615,7 @@ export default class TableBasePage extends BasePage { } handleChangeProductCategoryDdl(event, ddlCategory) { this.handleChangeNestedElementCellTable(event, ddlCategory); - let idProductCategorySelected = DOM.getElementValueCurrent(ddlCategory); + let idProductCategorySelected = DOM.getElementAttributeValueCurrent(ddlCategory); let row = DOM.getRowFromElement(ddlCategory); let tdProduct = row.querySelector('td.' + flagProduct); tdProduct.dispatchEvent(new Event('click')); diff --git a/static/js/pages/store/product_permutations.js b/static/js/pages/store/product_permutations.js index 4a653990..351d5e98 100644 --- a/static/js/pages/store/product_permutations.js +++ b/static/js/pages/store/product_permutations.js @@ -129,8 +129,8 @@ export default class PageStoreProductPermutations extends TableBasePage { let tdProduct = row.querySelector('td.' + flagProduct); let tdProductVariations = row.querySelector('td.' + flagProductVariations); let inputDescription = row.querySelector('td.' + flagDescription + ' textarea'); - let inputCostLocalVatExcl = row.querySelector('td.' + flagCostUnitLocalVatExcl + ' input'); - let inputCostLocalVatIncl = row.querySelector('td.' + flagCostUnitLocalVatIncl + ' input'); + // let inputCostLocalVatExcl = row.querySelector('td.' + flagCostUnitLocalVatExcl + ' input'); + // let inputCostLocalVatIncl = row.querySelector('td.' + flagCostUnitLocalVatIncl + ' input'); let tdCurrencyCost = row.querySelector('td.' + flagCurrencyCost); let inputProfitLocalMin = row.querySelector('td.' + flagProfitLocalMin + ' input'); let inputLatencyManufactureDays = row.querySelector('td.' + flagLatencyManufacture + ' input'); @@ -155,8 +155,8 @@ export default class PageStoreProductPermutations extends TableBasePage { jsonRow[flagProductVariations] = tdProductVariations.getAttribute(attrValueCurrent); jsonRow[flagHasVariations] = jsonRow[flagProductVariations] != ''; jsonRow[flagDescription] = inputDescription.getAttribute(attrValueCurrent); - jsonRow[flagCostUnitLocalVatExcl] = inputCostLocalVatExcl.getAttribute(attrValueCurrent); - jsonRow[flagCostUnitLocalVatIncl] = inputCostLocalVatIncl.getAttribute(attrValueCurrent); + // jsonRow[flagCostUnitLocalVatExcl] = inputCostLocalVatExcl.getAttribute(attrValueCurrent); + // jsonRow[flagCostUnitLocalVatIncl] = inputCostLocalVatIncl.getAttribute(attrValueCurrent); jsonRow[flagCurrencyCost] = tdCurrencyCost.getAttribute(attrValueCurrent); jsonRow[flagProfitLocalMin] = inputProfitLocalMin.getAttribute(attrValueCurrent); jsonRow[flagLatencyManufacture] = inputLatencyManufactureDays.getAttribute(attrValueCurrent); @@ -176,6 +176,14 @@ export default class PageStoreProductPermutations extends TableBasePage { return jsonRow; } initialiseRowNew(tbody, row) { + this.initialiseRowNewDdlsProductCategoryAndProduct(row); + + let checkboxIsSubscription = row.querySelector('td.' + flagIsSubscription + ' input'); + let checkboxDoesExpireFasterOnceUnsealed = row.querySelector('td.' + flagDoesExpireFasterOnceUnsealed + ' input'); + this.handleChangeCheckboxDoesExpireFasterOnceUnsealed(null, checkboxDoesExpireFasterOnceUnsealed); + this.handleChangeCheckboxIsSubscription(null, checkboxIsSubscription); + } + initialiseRowNewDdlsProductCategoryAndProduct(row) { let ddlCategoryFilter = document.querySelector(idFormFilters + ' #' + attrIdProductCategory); let idProductCategoryFilter = DOM.getElementValueCurrent(ddlCategoryFilter); let hasCategoryFilter = !(Validation.isEmpty(idProductCategoryFilter) || idProductCategoryFilter == '0'); @@ -283,22 +291,25 @@ export default class PageStoreProductPermutations extends TableBasePage { } hookupIsSubscriptionFields(){ this.hookupChangeHandlerTableCells(idTableMain + ' td.' + flagIsSubscription + ' input', (event, element) => { - this.handleChangeNestedElementCellTable(event, element); - let isSubscription = DOM.getElementValueCurrent(element); - let row = DOM.getRowFromElement(element); - let inputCountIntervalRecurrence = row.querySelector('td.' + flagCountUnitMeasurementIntervalRecurrence + ' input'); - let divOrDdlIntervalRecurrence = row.querySelector('td.' + flagUnitMeasurementIntervalRecurrence + ' .' + flagUnitMeasurementIntervalRecurrence); - if (isSubscription) { - inputCountIntervalRecurrence.classList.remove(flagCollapsed); - divOrDdlIntervalRecurrence.classList.remove(flagCollapsed); - let tdUnitMeasurementIntervalRecurrence = divOrDdlIntervalRecurrence.closest('td'); - tdUnitMeasurementIntervalRecurrence.dispatchEvent(new Event('click')); - } else { - inputCountIntervalRecurrence.classList.add(flagCollapsed); - divOrDdlIntervalRecurrence.classList.add(flagCollapsed); - } + this.handleChangeCheckboxIsSubscription(event, element); }); } + handleChangeCheckboxIsSubscription(event, element) { + this.handleChangeNestedElementCellTable(event, element); + let isSubscription = DOM.getElementValueCurrent(element); + let row = DOM.getRowFromElement(element); + let inputCountIntervalRecurrence = row.querySelector('td.' + flagCountUnitMeasurementIntervalRecurrence + ' input'); + let divOrDdlIntervalRecurrence = row.querySelector('td.' + flagUnitMeasurementIntervalRecurrence + ' .' + flagUnitMeasurementIntervalRecurrence); + if (isSubscription) { + inputCountIntervalRecurrence.classList.remove(flagCollapsed); + divOrDdlIntervalRecurrence.classList.remove(flagCollapsed); + let tdUnitMeasurementIntervalRecurrence = divOrDdlIntervalRecurrence.closest('td'); + tdUnitMeasurementIntervalRecurrence.dispatchEvent(new Event('click')); + } else { + inputCountIntervalRecurrence.classList.add(flagCollapsed); + divOrDdlIntervalRecurrence.classList.add(flagCollapsed); + } + } hookupIntervalRecurrenceFields(){ this.hookupTableCellDDlPreviewsWhenNotCollapsed(idTableMain + ' td.' + flagUnitMeasurementIntervalRecurrence, Utils.getListFromDict(unitMeasurementsTime)); } @@ -314,23 +325,26 @@ export default class PageStoreProductPermutations extends TableBasePage { this.hookupCountIntervalExpirationUnsealedInputs(); } hookupDoesExpireFasterOnceUnsealedCheckboxes(){ - this.hookupChangeHandlerTableCells(idTableMain + ' td.' + flagDoesExpireFasterOnceUnsealed + ' input', (event, element) => { - this.handleChangeNestedElementCellTable(event, element); - let doesExpireFasterOnceUnsealed = DOM.getElementValueCurrent(element); - let row = DOM.getRowFromElement(element); - let inputCountIntervalExpirationUnsealed = row.querySelector('td.' + flagCountUnitMeasurementIntervalExpirationUnsealed + ' input'); - let divOrDdlIntervalExpirationUnsealed = row.querySelector('td.' + flagUnitMeasurementIntervalExpirationUnsealed + ' .' + flagUnitMeasurementIntervalExpirationUnsealed); - if (doesExpireFasterOnceUnsealed) { - inputCountIntervalExpirationUnsealed.classList.remove(flagCollapsed); - divOrDdlIntervalExpirationUnsealed.classList.remove(flagCollapsed); - let tdUnitMeasurementIntervalExpirationUnsealed = divOrDdlIntervalExpirationUnsealed.closest('td'); - tdUnitMeasurementIntervalExpirationUnsealed.dispatchEvent(new Event('click')); - } else { - inputCountIntervalExpirationUnsealed.classList.add(flagCollapsed); - divOrDdlIntervalExpirationUnsealed.classList.add(flagCollapsed); - } + this.hookupChangeHandlerTableCells(idTableMain + ' td.' + flagDoesExpireFasterOnceUnsealed + ' input', (event, element) => { + this.handleChangeCheckboxDoesExpireFasterOnceUnsealed(event, element); }); } + handleChangeCheckboxDoesExpireFasterOnceUnsealed(event, element) { + this.handleChangeNestedElementCellTable(event, element); + let doesExpireFasterOnceUnsealed = DOM.getElementValueCurrent(element); + let row = DOM.getRowFromElement(element); + let inputCountIntervalExpirationUnsealed = row.querySelector('td.' + flagCountUnitMeasurementIntervalExpirationUnsealed + ' input'); + let divOrDdlIntervalExpirationUnsealed = row.querySelector('td.' + flagUnitMeasurementIntervalExpirationUnsealed + ' .' + flagUnitMeasurementIntervalExpirationUnsealed); + if (doesExpireFasterOnceUnsealed) { + inputCountIntervalExpirationUnsealed.classList.remove(flagCollapsed); + divOrDdlIntervalExpirationUnsealed.classList.remove(flagCollapsed); + let tdUnitMeasurementIntervalExpirationUnsealed = divOrDdlIntervalExpirationUnsealed.closest('td'); + tdUnitMeasurementIntervalExpirationUnsealed.dispatchEvent(new Event('click')); + } else { + inputCountIntervalExpirationUnsealed.classList.add(flagCollapsed); + divOrDdlIntervalExpirationUnsealed.classList.add(flagCollapsed); + } + } hookupIntervalExpirationUnsealedFields(){ this.hookupTableCellDDlPreviewsWhenNotCollapsed(idTableMain + ' td.' + flagUnitMeasurementIntervalExpirationUnsealed, Utils.getListFromDict(unitMeasurementsTime)); } diff --git a/templates/components/store/_row_product_permutation.html b/templates/components/store/_row_product_permutation.html index a24619dd..e3b9eb13 100644 --- a/templates/components/store/_row_product_permutation.html +++ b/templates/components/store/_row_product_permutation.html @@ -56,12 +56,12 @@ -
+
0
-
+
0
@@ -111,7 +111,11 @@ {% include 'components/store/_preview_DDL_product_permutation_unit_measurement_quantity.html' %} - + {% set value = permutation.count_interval_recurrence if permutation.count_interval_recurrence is not none else 1 %} @@ -132,7 +136,11 @@ - + {% set value = permutation.count_interval_expiration_unsealed if permutation.count_interval_expiration_unsealed is not none else 1 %} @@ -149,10 +157,14 @@ {% include 'components/store/_preview_DDL_product_permutation_interval_expiration_unsealed.html' %} - +
+ {{ permutation.cost_local_VAT_excl }} +
- +
+ {{ permutation.cost_local_VAT_incl }} +
{% set currency = permutation.currency_cost %} diff --git a/templates/js/sections/store.js b/templates/js/sections/store.js index 1aed253a..1a24213e 100644 --- a/templates/js/sections/store.js +++ b/templates/js/sections/store.js @@ -103,15 +103,17 @@ var flagUnitMeasurementIntervalExpirationUnsealed = "{{ model.FLAG_UNIT_MEASUREM var flagUnitMeasurementIntervalRecurrence = "{{ model.FLAG_UNIT_MEASUREMENT_INTERVAL_RECURRENCE }}"; var flagUnitMeasurementLatencyManufacture = "{{ model.FLAG_UNIT_MEASUREMENT_LATENCY_MANUFACTURE }}"; var flagUnitMeasurementQuantity = "{{ model.FLAG_UNIT_MEASUREMENT_QUANTITY }}"; -var hashGetStoreCustomerSalesOrder = "{{ model.HASH_GET_STORE_CUSTOMER_SALES_ORDER }}"; -var hashGetStoreManufacturingPurchaseOrder = "{{ model.HASH_GET_STORE_MANUFACTURING_PURCHASE_ORDER }}"; -var hashGetStoreProduct = "{{ model.HASH_GET_STORE_PRODUCT }}"; -var hashGetStoreProductCategory = "{{ model.HASH_GET_STORE_PRODUCT_CATEGORY }}"; -var hashGetStoreProductPermutation = "{{ model.HASH_GET_STORE_PRODUCT_PERMUTATION }}"; -var hashGetStoreProductVariation = "{{ model.HASH_GET_STORE_PRODUCT_VARIATION }}"; -var hashGetStoreStockItem = "{{ model.HASH_GET_STORE_STOCK_ITEM }}"; -var hashGetStoreSupplier = "{{ model.HASH_GET_STORE_SUPPLIER }}"; -var hashGetStoreSupplierPurchaseOrder = "{{ model.HASH_GET_STORE_SUPPLIER_PURCHASE_ORDER }}"; +{# + var hashGetStoreCustomerSalesOrder = "{{ model.HASH_GET_STORE_CUSTOMER_SALES_ORDER }}"; + var hashGetStoreManufacturingPurchaseOrder = "{{ model.HASH_GET_STORE_MANUFACTURING_PURCHASE_ORDER }}"; + var hashGetStoreProduct = "{{ model.HASH_GET_STORE_PRODUCT }}"; + var hashGetStoreProductCategory = "{{ model.HASH_GET_STORE_PRODUCT_CATEGORY }}"; + var hashGetStoreProductPermutation = "{{ model.HASH_GET_STORE_PRODUCT_PERMUTATION }}"; + var hashGetStoreProductVariation = "{{ model.HASH_GET_STORE_PRODUCT_VARIATION }}"; + var hashGetStoreStockItem = "{{ model.HASH_GET_STORE_STOCK_ITEM }}"; + var hashGetStoreSupplier = "{{ model.HASH_GET_STORE_SUPPLIER }}"; + var hashGetStoreSupplierPurchaseOrder = "{{ model.HASH_GET_STORE_SUPPLIER_PURCHASE_ORDER }}"; +#} var hashSaveStoreCustomerSalesOrder = "{{ model.HASH_SAVE_STORE_CUSTOMER_SALES_ORDER }}"; var hashSaveStoreManufacturingPurchaseOrder = "{{ model.HASH_SAVE_STORE_MANUFACTURING_PURCHASE_ORDER }}"; var hashSaveStoreProduct = "{{ model.HASH_SAVE_STORE_PRODUCT }}"; diff --git a/templates/layouts/layout.html b/templates/layouts/layout.html index d728221c..93e500f3 100644 --- a/templates/layouts/layout.html +++ b/templates/layouts/layout.html @@ -273,64 +273,66 @@ Contact
- {% if model.is_page_store and model.user.can_admin_store %} - - {% if model.user.can_admin_store %} + {# + {% if model.is_page_store and model.user.can_admin_store %} - {% endif %} - - {% else %} - {% if model.user.can_admin_store %} + {% endif %} + + {% else %} + {% if model.user.can_admin_store %} +
+ Shop +
+ {% endif %} {% endif %} - {% endif %} + #} {% if model.user.can_admin_store %}