diff --git a/e2e/src/fixtures/1.7/modules.json b/e2e/src/fixtures/1.7/modules.json index fdbb20db..310a6483 100644 --- a/e2e/src/fixtures/1.7/modules.json +++ b/e2e/src/fixtures/1.7/modules.json @@ -7,8 +7,8 @@ "name": "blockwishlist", "module_version": "2.1.2", "active": true, - "created_at": "2023-12-20T22:56:03+0100", - "updated_at": "2023-12-20T22:56:03+0100" + "created_at": "2024-10-26T00:32:14+0200", + "updated_at": "2024-10-26T00:32:14+0200" } }, { @@ -19,8 +19,8 @@ "name": "contactform", "module_version": "4.4.1", "active": true, - "created_at": "2023-12-20T22:56:03+0100", - "updated_at": "2023-12-20T22:56:03+0100" + "created_at": "2024-10-26T00:32:14+0200", + "updated_at": "2024-10-26T00:32:14+0200" } }, { @@ -31,8 +31,8 @@ "name": "dashactivity", "module_version": "2.1.0", "active": true, - "created_at": "2023-12-20T22:56:03+0100", - "updated_at": "2023-12-20T22:56:03+0100" + "created_at": "2024-10-26T00:32:14+0200", + "updated_at": "2024-10-26T00:32:14+0200" } }, { @@ -43,8 +43,8 @@ "name": "dashtrends", "module_version": "2.1.2", "active": true, - "created_at": "2023-12-20T22:56:03+0100", - "updated_at": "2023-12-20T22:56:03+0100" + "created_at": "2024-10-26T00:32:14+0200", + "updated_at": "2024-10-26T00:32:14+0200" } }, { @@ -55,8 +55,8 @@ "name": "dashgoals", "module_version": "2.0.4", "active": true, - "created_at": "2023-12-20T22:56:03+0100", - "updated_at": "2023-12-20T22:56:03+0100" + "created_at": "2024-10-26T00:32:14+0200", + "updated_at": "2024-10-26T00:32:14+0200" } }, { @@ -67,8 +67,8 @@ "name": "dashproducts", "module_version": "2.1.3", "active": true, - "created_at": "2023-12-20T22:56:03+0100", - "updated_at": "2023-12-20T22:56:03+0100" + "created_at": "2024-10-26T00:32:14+0200", + "updated_at": "2024-10-26T00:32:14+0200" } }, { @@ -79,8 +79,8 @@ "name": "graphnvd3", "module_version": "2.0.3", "active": true, - "created_at": "2023-12-20T22:56:03+0100", - "updated_at": "2023-12-20T22:56:03+0100" + "created_at": "2024-10-26T00:32:14+0200", + "updated_at": "2024-10-26T00:32:14+0200" } }, { @@ -91,8 +91,8 @@ "name": "gridhtml", "module_version": "2.0.3", "active": true, - "created_at": "2023-12-20T22:56:03+0100", - "updated_at": "2023-12-20T22:56:03+0100" + "created_at": "2024-10-26T00:32:14+0200", + "updated_at": "2024-10-26T00:32:14+0200" } }, { @@ -103,8 +103,8 @@ "name": "gsitemap", "module_version": "4.3.0", "active": true, - "created_at": "2023-12-20T22:56:03+0100", - "updated_at": "2023-12-20T22:56:03+0100" + "created_at": "2024-10-26T00:32:14+0200", + "updated_at": "2024-10-26T00:32:14+0200" } }, { @@ -115,8 +115,8 @@ "name": "pagesnotfound", "module_version": "2.0.2", "active": true, - "created_at": "2023-12-20T22:56:03+0100", - "updated_at": "2023-12-20T22:56:03+0100" + "created_at": "2024-10-26T00:32:14+0200", + "updated_at": "2024-10-26T00:32:14+0200" } }, { @@ -127,8 +127,8 @@ "name": "productcomments", "module_version": "5.0.3", "active": true, - "created_at": "2023-12-20T22:56:03+0100", - "updated_at": "2023-12-20T22:56:03+0100" + "created_at": "2024-10-26T00:32:14+0200", + "updated_at": "2024-10-26T00:32:14+0200" } }, { @@ -139,8 +139,8 @@ "name": "ps_banner", "module_version": "2.1.2", "active": true, - "created_at": "2023-12-20T22:56:03+0100", - "updated_at": "2023-12-20T22:56:03+0100" + "created_at": "2024-10-26T00:32:14+0200", + "updated_at": "2024-10-26T00:32:14+0200" } }, { @@ -151,8 +151,8 @@ "name": "ps_categorytree", "module_version": "2.0.3", "active": true, - "created_at": "2023-12-20T22:56:03+0100", - "updated_at": "2023-12-20T22:56:03+0100" + "created_at": "2024-10-26T00:32:14+0200", + "updated_at": "2024-10-26T00:32:14+0200" } }, { @@ -163,8 +163,8 @@ "name": "ps_checkpayment", "module_version": "2.0.6", "active": true, - "created_at": "2023-12-20T22:56:03+0100", - "updated_at": "2023-12-20T22:56:03+0100" + "created_at": "2024-10-26T00:32:14+0200", + "updated_at": "2024-10-26T00:32:14+0200" } }, { @@ -175,8 +175,8 @@ "name": "ps_contactinfo", "module_version": "3.3.2", "active": true, - "created_at": "2023-12-20T22:56:03+0100", - "updated_at": "2023-12-20T22:56:03+0100" + "created_at": "2024-10-26T00:32:14+0200", + "updated_at": "2024-10-26T00:32:14+0200" } }, { @@ -187,8 +187,8 @@ "name": "ps_crossselling", "module_version": "2.0.2", "active": true, - "created_at": "2023-12-20T22:56:03+0100", - "updated_at": "2023-12-20T22:56:03+0100" + "created_at": "2024-10-26T00:32:14+0200", + "updated_at": "2024-10-26T00:32:14+0200" } }, { @@ -199,8 +199,8 @@ "name": "ps_currencyselector", "module_version": "2.1.1", "active": true, - "created_at": "2023-12-20T22:56:03+0100", - "updated_at": "2023-12-20T22:56:03+0100" + "created_at": "2024-10-26T00:32:14+0200", + "updated_at": "2024-10-26T00:32:14+0200" } }, { @@ -211,8 +211,8 @@ "name": "ps_customeraccountlinks", "module_version": "3.2.0", "active": true, - "created_at": "2023-12-20T22:56:03+0100", - "updated_at": "2023-12-20T22:56:03+0100" + "created_at": "2024-10-26T00:32:14+0200", + "updated_at": "2024-10-26T00:32:14+0200" } }, { @@ -223,8 +223,8 @@ "name": "ps_customersignin", "module_version": "2.0.5", "active": true, - "created_at": "2023-12-20T22:56:03+0100", - "updated_at": "2023-12-20T22:56:03+0100" + "created_at": "2024-10-26T00:32:14+0200", + "updated_at": "2024-10-26T00:32:14+0200" } }, { @@ -235,8 +235,8 @@ "name": "ps_customtext", "module_version": "4.2.1", "active": true, - "created_at": "2023-12-20T22:56:03+0100", - "updated_at": "2023-12-20T22:56:03+0100" + "created_at": "2024-10-26T00:32:14+0200", + "updated_at": "2024-10-26T00:32:14+0200" } }, { @@ -247,8 +247,8 @@ "name": "ps_dataprivacy", "module_version": "2.1.1", "active": true, - "created_at": "2023-12-20T22:56:03+0100", - "updated_at": "2023-12-20T22:56:03+0100" + "created_at": "2024-10-26T00:32:14+0200", + "updated_at": "2024-10-26T00:32:14+0200" } }, { @@ -259,8 +259,8 @@ "name": "ps_emailsubscription", "module_version": "2.7.1", "active": true, - "created_at": "2023-12-20T22:56:03+0100", - "updated_at": "2023-12-20T22:56:03+0100" + "created_at": "2024-10-26T00:32:14+0200", + "updated_at": "2024-10-26T00:32:14+0200" } }, { @@ -271,8 +271,8 @@ "name": "ps_faviconnotificationbo", "module_version": "2.1.3", "active": true, - "created_at": "2023-12-20T22:56:03+0100", - "updated_at": "2023-12-20T22:56:03+0100" + "created_at": "2024-10-26T00:32:14+0200", + "updated_at": "2024-10-26T00:32:14+0200" } }, { @@ -283,8 +283,8 @@ "name": "ps_featuredproducts", "module_version": "2.1.4", "active": true, - "created_at": "2023-12-20T22:56:03+0100", - "updated_at": "2023-12-20T22:56:03+0100" + "created_at": "2024-10-26T00:32:14+0200", + "updated_at": "2024-10-26T00:32:14+0200" } }, { @@ -295,8 +295,8 @@ "name": "ps_imageslider", "module_version": "3.1.3", "active": true, - "created_at": "2023-12-20T22:56:03+0100", - "updated_at": "2023-12-20T22:56:03+0100" + "created_at": "2024-10-26T00:32:14+0200", + "updated_at": "2024-10-26T00:32:14+0200" } }, { @@ -307,8 +307,8 @@ "name": "ps_languageselector", "module_version": "2.1.3", "active": true, - "created_at": "2023-12-20T22:56:03+0100", - "updated_at": "2023-12-20T22:56:03+0100" + "created_at": "2024-10-26T00:32:14+0200", + "updated_at": "2024-10-26T00:32:14+0200" } }, { @@ -319,8 +319,8 @@ "name": "ps_linklist", "module_version": "5.0.5", "active": true, - "created_at": "2023-12-20T22:56:03+0100", - "updated_at": "2023-12-20T22:56:03+0100" + "created_at": "2024-10-26T00:32:14+0200", + "updated_at": "2024-10-26T00:32:14+0200" } }, { @@ -331,8 +331,8 @@ "name": "ps_mainmenu", "module_version": "2.3.2", "active": true, - "created_at": "2023-12-20T22:56:03+0100", - "updated_at": "2023-12-20T22:56:03+0100" + "created_at": "2024-10-26T00:32:14+0200", + "updated_at": "2024-10-26T00:32:14+0200" } }, { @@ -343,8 +343,8 @@ "name": "ps_searchbar", "module_version": "2.1.3", "active": true, - "created_at": "2023-12-20T22:56:03+0100", - "updated_at": "2023-12-20T22:56:03+0100" + "created_at": "2024-10-26T00:32:14+0200", + "updated_at": "2024-10-26T00:32:14+0200" } }, { @@ -355,8 +355,8 @@ "name": "ps_sharebuttons", "module_version": "2.1.2", "active": true, - "created_at": "2023-12-20T22:56:03+0100", - "updated_at": "2023-12-20T22:56:03+0100" + "created_at": "2024-10-26T00:32:14+0200", + "updated_at": "2024-10-26T00:32:14+0200" } }, { @@ -367,8 +367,8 @@ "name": "ps_shoppingcart", "module_version": "2.0.7", "active": true, - "created_at": "2023-12-20T22:56:03+0100", - "updated_at": "2023-12-20T22:56:03+0100" + "created_at": "2024-10-26T00:32:14+0200", + "updated_at": "2024-10-26T00:32:14+0200" } }, { @@ -379,8 +379,8 @@ "name": "ps_socialfollow", "module_version": "2.3.0", "active": true, - "created_at": "2023-12-20T22:56:03+0100", - "updated_at": "2023-12-20T22:56:03+0100" + "created_at": "2024-10-26T00:32:14+0200", + "updated_at": "2024-10-26T00:32:14+0200" } }, { @@ -391,8 +391,8 @@ "name": "ps_themecusto", "module_version": "1.2.3", "active": true, - "created_at": "2023-12-20T22:56:03+0100", - "updated_at": "2023-12-20T22:56:03+0100" + "created_at": "2024-10-26T00:32:14+0200", + "updated_at": "2024-10-26T00:32:14+0200" } }, { @@ -403,8 +403,8 @@ "name": "ps_wirepayment", "module_version": "2.1.3", "active": true, - "created_at": "2023-12-20T22:56:03+0100", - "updated_at": "2023-12-20T22:56:03+0100" + "created_at": "2024-10-26T00:32:14+0200", + "updated_at": "2024-10-26T00:32:14+0200" } }, { @@ -415,8 +415,8 @@ "name": "statsbestcategories", "module_version": "2.0.1", "active": true, - "created_at": "2023-12-20T22:56:03+0100", - "updated_at": "2023-12-20T22:56:03+0100" + "created_at": "2024-10-26T00:32:14+0200", + "updated_at": "2024-10-26T00:32:14+0200" } }, { @@ -427,8 +427,8 @@ "name": "statsbestcustomers", "module_version": "2.0.4", "active": true, - "created_at": "2023-12-20T22:56:03+0100", - "updated_at": "2023-12-20T22:56:03+0100" + "created_at": "2024-10-26T00:32:14+0200", + "updated_at": "2024-10-26T00:32:14+0200" } }, { @@ -439,8 +439,8 @@ "name": "statsbestproducts", "module_version": "2.0.1", "active": true, - "created_at": "2023-12-20T22:56:03+0100", - "updated_at": "2023-12-20T22:56:03+0100" + "created_at": "2024-10-26T00:32:14+0200", + "updated_at": "2024-10-26T00:32:14+0200" } }, { @@ -451,8 +451,8 @@ "name": "statsbestsuppliers", "module_version": "2.0.2", "active": true, - "created_at": "2023-12-20T22:56:03+0100", - "updated_at": "2023-12-20T22:56:03+0100" + "created_at": "2024-10-26T00:32:14+0200", + "updated_at": "2024-10-26T00:32:14+0200" } }, { @@ -463,8 +463,8 @@ "name": "statsbestvouchers", "module_version": "2.0.1", "active": true, - "created_at": "2023-12-20T22:56:03+0100", - "updated_at": "2023-12-20T22:56:03+0100" + "created_at": "2024-10-26T00:32:14+0200", + "updated_at": "2024-10-26T00:32:14+0200" } }, { @@ -475,8 +475,8 @@ "name": "statscarrier", "module_version": "2.0.1", "active": true, - "created_at": "2023-12-20T22:56:03+0100", - "updated_at": "2023-12-20T22:56:03+0100" + "created_at": "2024-10-26T00:32:14+0200", + "updated_at": "2024-10-26T00:32:14+0200" } }, { @@ -487,8 +487,8 @@ "name": "statscatalog", "module_version": "2.0.3", "active": true, - "created_at": "2023-12-20T22:56:03+0100", - "updated_at": "2023-12-20T22:56:03+0100" + "created_at": "2024-10-26T00:32:14+0200", + "updated_at": "2024-10-26T00:32:14+0200" } }, { @@ -499,8 +499,8 @@ "name": "statscheckup", "module_version": "2.0.2", "active": true, - "created_at": "2023-12-20T22:56:03+0100", - "updated_at": "2023-12-20T22:56:03+0100" + "created_at": "2024-10-26T00:32:14+0200", + "updated_at": "2024-10-26T00:32:14+0200" } }, { @@ -511,8 +511,8 @@ "name": "statsdata", "module_version": "2.1.1", "active": true, - "created_at": "2023-12-20T22:56:03+0100", - "updated_at": "2023-12-20T22:56:03+0100" + "created_at": "2024-10-26T00:32:14+0200", + "updated_at": "2024-10-26T00:32:14+0200" } }, { @@ -523,8 +523,8 @@ "name": "statsforecast", "module_version": "2.0.4", "active": true, - "created_at": "2023-12-20T22:56:03+0100", - "updated_at": "2023-12-20T22:56:03+0100" + "created_at": "2024-10-26T00:32:14+0200", + "updated_at": "2024-10-26T00:32:14+0200" } }, { @@ -535,8 +535,8 @@ "name": "statsnewsletter", "module_version": "2.0.3", "active": true, - "created_at": "2023-12-20T22:56:03+0100", - "updated_at": "2023-12-20T22:56:03+0100" + "created_at": "2024-10-26T00:32:14+0200", + "updated_at": "2024-10-26T00:32:14+0200" } }, { @@ -547,8 +547,8 @@ "name": "statspersonalinfos", "module_version": "2.0.4", "active": true, - "created_at": "2023-12-20T22:56:03+0100", - "updated_at": "2023-12-20T22:56:03+0100" + "created_at": "2024-10-26T00:32:14+0200", + "updated_at": "2024-10-26T00:32:14+0200" } }, { @@ -559,8 +559,8 @@ "name": "statsproduct", "module_version": "2.1.1", "active": true, - "created_at": "2023-12-20T22:56:03+0100", - "updated_at": "2023-12-20T22:56:03+0100" + "created_at": "2024-10-26T00:32:14+0200", + "updated_at": "2024-10-26T00:32:14+0200" } }, { @@ -571,8 +571,8 @@ "name": "statsregistrations", "module_version": "2.0.1", "active": true, - "created_at": "2023-12-20T22:56:03+0100", - "updated_at": "2023-12-20T22:56:03+0100" + "created_at": "2024-10-26T00:32:14+0200", + "updated_at": "2024-10-26T00:32:14+0200" } }, { @@ -583,8 +583,8 @@ "name": "statssales", "module_version": "2.1.0", "active": true, - "created_at": "2023-12-20T22:56:03+0100", - "updated_at": "2023-12-20T22:56:03+0100" + "created_at": "2024-10-26T00:32:14+0200", + "updated_at": "2024-10-26T00:32:14+0200" } }, { @@ -595,8 +595,8 @@ "name": "statssearch", "module_version": "2.0.2", "active": true, - "created_at": "2023-12-20T22:56:03+0100", - "updated_at": "2023-12-20T22:56:03+0100" + "created_at": "2024-10-26T00:32:14+0200", + "updated_at": "2024-10-26T00:32:14+0200" } }, { @@ -607,8 +607,8 @@ "name": "statsstock", "module_version": "2.0.1", "active": true, - "created_at": "2023-12-20T22:56:03+0100", - "updated_at": "2023-12-20T22:56:03+0100" + "created_at": "2024-10-26T00:32:14+0200", + "updated_at": "2024-10-26T00:32:14+0200" } }, { @@ -619,8 +619,8 @@ "name": "welcome", "module_version": "6.0.9", "active": true, - "created_at": "2023-12-20T22:56:03+0100", - "updated_at": "2023-12-20T22:56:03+0100" + "created_at": "2024-10-26T00:32:14+0200", + "updated_at": "2024-10-26T00:32:14+0200" } }, { @@ -631,8 +631,8 @@ "name": "psgdpr", "module_version": "1.4.3", "active": true, - "created_at": "2023-12-20T22:56:03+0100", - "updated_at": "2023-12-20T22:56:03+0100" + "created_at": "2024-10-26T00:32:14+0200", + "updated_at": "2024-10-26T00:32:14+0200" } }, { @@ -641,10 +641,10 @@ "properties": { "module_id": "55", "name": "ps_mbo", - "module_version": "3.0.1", + "module_version": "3.2.0", "active": true, - "created_at": "2023-12-20T22:56:03+0100", - "updated_at": "2023-12-20T22:56:03+0100" + "created_at": "2024-10-26T00:32:14+0200", + "updated_at": "2024-10-26T00:32:14+0200" } }, { @@ -655,8 +655,8 @@ "name": "ps_buybuttonlite", "module_version": "1.0.1", "active": true, - "created_at": "2023-12-20T22:56:03+0100", - "updated_at": "2023-12-20T22:56:03+0100" + "created_at": "2024-10-26T00:32:14+0200", + "updated_at": "2024-10-26T00:32:14+0200" } }, { @@ -665,10 +665,10 @@ "properties": { "module_id": "57", "name": "ps_checkout", - "module_version": "7.3.5.2", + "module_version": "7.3.6.3", "active": true, - "created_at": "2023-12-20T22:56:03+0100", - "updated_at": "2023-12-20T22:56:03+0100" + "created_at": "2024-10-26T00:32:14+0200", + "updated_at": "2024-10-26T00:32:14+0200" } }, { @@ -677,10 +677,10 @@ "properties": { "module_id": "58", "name": "ps_metrics", - "module_version": "4.0.3", + "module_version": "4.0.8", "active": true, - "created_at": "2023-12-20T22:56:03+0100", - "updated_at": "2023-12-20T22:56:03+0100" + "created_at": "2024-10-26T00:32:14+0200", + "updated_at": "2024-10-26T00:32:14+0200" } }, { @@ -689,10 +689,10 @@ "properties": { "module_id": "59", "name": "ps_facebook", - "module_version": "1.33.2", + "module_version": "1.38.1", "active": true, - "created_at": "2023-12-20T22:56:03+0100", - "updated_at": "2023-12-20T22:56:03+0100" + "created_at": "2024-10-26T00:32:14+0200", + "updated_at": "2024-10-26T00:32:14+0200" } }, { @@ -701,10 +701,10 @@ "properties": { "module_id": "60", "name": "psxmarketingwithgoogle", - "module_version": "1.63.0", + "module_version": "1.74.8", "active": true, - "created_at": "2023-12-20T22:56:03+0100", - "updated_at": "2023-12-20T22:56:03+0100" + "created_at": "2024-10-26T00:32:14+0200", + "updated_at": "2024-10-26T00:32:14+0200" } }, { @@ -715,8 +715,8 @@ "name": "blockreassurance", "module_version": "5.1.2", "active": true, - "created_at": "2023-12-20T22:56:03+0100", - "updated_at": "2023-12-20T22:56:03+0100" + "created_at": "2024-10-26T00:32:14+0200", + "updated_at": "2024-10-26T00:32:14+0200" } }, { @@ -727,8 +727,8 @@ "name": "ps_facetedsearch", "module_version": "3.12.1", "active": true, - "created_at": "2023-12-20T22:56:03+0100", - "updated_at": "2023-12-20T22:56:03+0100" + "created_at": "2024-10-26T00:32:14+0200", + "updated_at": "2024-10-26T00:32:14+0200" } }, { @@ -737,10 +737,10 @@ "properties": { "module_id": "63", "name": "ps_accounts", - "module_version": "42.0.0", + "module_version": "7.0.2", "active": true, - "created_at": "2023-12-20T22:56:03+0100", - "updated_at": "2023-12-20T22:56:03+0100" + "created_at": "2024-10-26T00:32:14+0200", + "updated_at": "2024-10-26T00:32:14+0200" } }, { @@ -751,8 +751,8 @@ "name": "ps_eventbus", "module_version": "0.0.0", "active": true, - "created_at": "2023-12-20T22:56:03+0100", - "updated_at": "2023-12-20T22:56:03+0100" + "created_at": "2024-10-26T00:32:14+0200", + "updated_at": "2024-10-26T00:32:14+0200" } } ] diff --git a/src/Handler/ErrorHandler/ErrorHandler.php b/src/Handler/ErrorHandler/ErrorHandler.php index 20606b47..d2fb4c7b 100644 --- a/src/Handler/ErrorHandler/ErrorHandler.php +++ b/src/Handler/ErrorHandler/ErrorHandler.php @@ -51,10 +51,10 @@ class ErrorHandler public function __construct($sentryDsn, $sentryEnv) { try { - /** @var \ModuleCore $accountsModule */ + /** @var false|\ModuleCore $accountsModule */ $accountsModule = \Module::getInstanceByName('ps_accounts'); /** @var mixed $accountService */ - $accountService = $accountsModule->get('PrestaShop\Module\PsAccounts\Service\PsAccountsService'); + $accountService = $accountsModule->getService('PrestaShop\Module\PsAccounts\Service\PsAccountsService'); /** @var \ModuleCore $eventbusModule */ $eventbusModule = \Module::getInstanceByName('ps_eventbus'); diff --git a/src/Repository/BundleRepository.php b/src/Repository/BundleRepository.php index 16d2103a..a86c80a3 100644 --- a/src/Repository/BundleRepository.php +++ b/src/Repository/BundleRepository.php @@ -38,7 +38,7 @@ class BundleRepository extends AbstractRepository implements RepositoryInterface * @param string $langIso * @param bool $withSelecParameters * - * @return mixed + * @return void * * @throws \PrestaShopException */ @@ -103,7 +103,7 @@ public function retrieveContentsForIncremental($limit, $contentIds, $langIso) $this->query ->where('pac.id_product_pack IN(' . implode(',', array_map('intval', $contentIds)) . ')') - // ->limit($limit) Sub shop content depend from another, temporary disabled + ->limit($limit) ; return $this->runQuery(); diff --git a/src/Repository/CarrierDetailRepository.php b/src/Repository/CarrierDetailRepository.php index 0c66a5ed..b3cf36ac 100644 --- a/src/Repository/CarrierDetailRepository.php +++ b/src/Repository/CarrierDetailRepository.php @@ -38,7 +38,7 @@ class CarrierDetailRepository extends AbstractRepository implements RepositoryIn * @param string $langIso * @param bool $withSelecParameters * - * @return mixed + * @return void * * @throws \PrestaShopException */ @@ -46,6 +46,7 @@ public function generateFullQuery($langIso, $withSelecParameters) { $this->generateMinimalQuery(self::TABLE_NAME, 'ca'); + // minimal query for countable query $this->query ->innerJoin('delivery', 'd', 'ca.id_carrier = d.id_carrier AND d.id_zone IS NOT NULL') ->innerJoin('country', 'co', 'd.id_zone = co.id_zone AND co.iso_code IS NOT NULL AND co.active = 1') @@ -53,11 +54,12 @@ public function generateFullQuery($langIso, $withSelecParameters) ->leftJoin('range_price', 'rp', 'ca.id_carrier = rp.id_carrier AND d.id_range_price = rp.id_range_price') ->leftJoin('state', 's', 'co.id_zone = s.id_zone AND co.id_country = s.id_country AND s.active = 1') ->leftJoin('configuration', 'conf', 'conf.name = "PS_SHIPPING_METHOD"') + ->select('ca.id_reference') + ->groupBy('ca.id_reference, co.id_zone, id_range') ; if ($withSelecParameters) { $this->query - ->select('ca.id_reference') ->select('d.id_zone') ->select(' CASE @@ -111,8 +113,6 @@ public function generateFullQuery($langIso, $withSelecParameters) ) AS price ') ; - - $this->query->groupBy('ca.id_reference, co.id_zone, id_range'); } } @@ -176,10 +176,10 @@ public function countFullSyncContentLeft($offset, $limit, $langIso) $this->generateFullQuery($langIso, true); $result = $this->db->executeS(' - SELECT (COUNT(*) - ' . (int) $offset . ') AS count + SELECT COUNT(*) - ' . (int) $offset . ' AS count FROM (' . $this->query->build() . ') as subquery; '); - return is_array($result) ? $result[0]['count'] : []; + return is_array($result) ? $result[0]['count'] : 0; } } diff --git a/src/Repository/CarrierRepository.php b/src/Repository/CarrierRepository.php index b6c5b3e4..3375cc76 100644 --- a/src/Repository/CarrierRepository.php +++ b/src/Repository/CarrierRepository.php @@ -38,7 +38,7 @@ class CarrierRepository extends AbstractRepository implements RepositoryInterfac * @param string $langIso * @param bool $withSelecParameters * - * @return mixed + * @return void * * @throws \PrestaShopException */ diff --git a/src/Repository/CarrierTaxeRepository.php b/src/Repository/CarrierTaxeRepository.php index 430c4a79..2d702e9e 100644 --- a/src/Repository/CarrierTaxeRepository.php +++ b/src/Repository/CarrierTaxeRepository.php @@ -38,7 +38,7 @@ class CarrierTaxeRepository extends AbstractRepository implements RepositoryInte * @param string $langIso * @param bool $withSelecParameters * - * @return mixed + * @return void * * @throws \PrestaShopException */ @@ -46,6 +46,7 @@ public function generateFullQuery($langIso, $withSelecParameters) { $this->generateMinimalQuery(self::TABLE_NAME, 'ca'); + // minimal query for countable query $this->query ->innerJoin('carrier_tax_rules_group_shop', 'ctrgs', 'ca.id_carrier = ctrgs.id_carrier') ->innerJoin('tax_rule', 'tr', 'ctrgs.id_tax_rules_group = tr.id_tax_rules_group') @@ -53,15 +54,13 @@ public function generateFullQuery($langIso, $withSelecParameters) ->innerJoin('delivery', 'd', 'ca.id_carrier = d.id_carrier AND d.id_zone IS NOT NULL') ->innerJoin('tax', 't', 'tr.id_tax = t.id_tax AND t.active = 1') ->leftJoin('state', 's', 'tr.id_state = s.id_state AND s.active = 1') - ; - - $this->query ->where('(co.id_zone = d.id_zone OR s.id_zone = d.id_zone)') + ->select('ca.id_reference') + ->groupBy('ca.id_reference, co.id_zone, id_range, country_id') ; if ($withSelecParameters) { $this->query - ->select('ca.id_reference') ->select('co.id_zone') ->select(' CASE @@ -81,8 +80,6 @@ public function generateFullQuery($langIso, $withSelecParameters) ') ->select('t.rate AS tax_rate') ; - - $this->query->groupBy('ca.id_reference, co.id_zone, id_range, country_id'); } } @@ -146,10 +143,10 @@ public function countFullSyncContentLeft($offset, $limit, $langIso) $this->generateFullQuery($langIso, true); $result = $this->db->executeS(' - SELECT (COUNT(*) - ' . (int) $offset . ') AS count + SELECT COUNT(*) - ' . (int) $offset . ' AS count FROM (' . $this->query->build() . ') as subquery; '); - return is_array($result) ? $result[0]['count'] : []; + return is_array($result) ? $result[0]['count'] : 0; } } diff --git a/src/Repository/CartProductRepository.php b/src/Repository/CartProductRepository.php index f229081b..b029ee5b 100644 --- a/src/Repository/CartProductRepository.php +++ b/src/Repository/CartProductRepository.php @@ -38,7 +38,7 @@ class CartProductRepository extends AbstractRepository implements RepositoryInte * @param string $langIso * @param bool $withSelecParameters * - * @return mixed + * @return void * * @throws \PrestaShopException */ diff --git a/src/Repository/CartRepository.php b/src/Repository/CartRepository.php index 111db8a7..6c867baa 100644 --- a/src/Repository/CartRepository.php +++ b/src/Repository/CartRepository.php @@ -38,7 +38,7 @@ class CartRepository extends AbstractRepository implements RepositoryInterface * @param string $langIso * @param bool $withSelecParameters * - * @return mixed + * @return void * * @throws \PrestaShopException */ diff --git a/src/Repository/CartRuleRepository.php b/src/Repository/CartRuleRepository.php index 545a6e08..f0841e45 100644 --- a/src/Repository/CartRuleRepository.php +++ b/src/Repository/CartRuleRepository.php @@ -38,7 +38,7 @@ class CartRuleRepository extends AbstractRepository implements RepositoryInterfa * @param string $langIso * @param bool $withSelecParameters * - * @return mixed + * @return void * * @throws \PrestaShopException */ diff --git a/src/Repository/CategoryRepository.php b/src/Repository/CategoryRepository.php index d2b2c2a0..f162b69a 100644 --- a/src/Repository/CategoryRepository.php +++ b/src/Repository/CategoryRepository.php @@ -38,7 +38,7 @@ class CategoryRepository extends AbstractRepository implements RepositoryInterfa * @param string $langIso * @param bool $withSelecParameters * - * @return mixed + * @return void * * @throws \PrestaShopException */ diff --git a/src/Repository/CurrencyRepository.php b/src/Repository/CurrencyRepository.php index 31e2e5a0..b85da292 100644 --- a/src/Repository/CurrencyRepository.php +++ b/src/Repository/CurrencyRepository.php @@ -38,7 +38,7 @@ class CurrencyRepository extends AbstractRepository implements RepositoryInterfa * @param string $langIso * @param bool $withSelecParameters * - * @return mixed + * @return void * * @throws \PrestaShopException */ diff --git a/src/Repository/CustomProductCarrierRepository.php b/src/Repository/CustomProductCarrierRepository.php index cbae7dcd..ca7aded3 100644 --- a/src/Repository/CustomProductCarrierRepository.php +++ b/src/Repository/CustomProductCarrierRepository.php @@ -38,7 +38,7 @@ class CustomProductCarrierRepository extends AbstractRepository implements Repos * @param string $langIso * @param bool $withSelecParameters * - * @return mixed + * @return void * * @throws \PrestaShopException */ diff --git a/src/Repository/CustomerRepository.php b/src/Repository/CustomerRepository.php index 94e6eb83..d5e44aa4 100644 --- a/src/Repository/CustomerRepository.php +++ b/src/Repository/CustomerRepository.php @@ -38,7 +38,7 @@ class CustomerRepository extends AbstractRepository implements RepositoryInterfa * @param string $langIso * @param bool $withSelecParameters * - * @return mixed + * @return void * * @throws \PrestaShopException */ diff --git a/src/Repository/EmployeeRepository.php b/src/Repository/EmployeeRepository.php index 15b1a373..b09bb554 100644 --- a/src/Repository/EmployeeRepository.php +++ b/src/Repository/EmployeeRepository.php @@ -38,7 +38,7 @@ class EmployeeRepository extends AbstractRepository implements RepositoryInterfa * @param string $langIso * @param bool $withSelecParameters * - * @return mixed + * @return void * * @throws \PrestaShopException */ diff --git a/src/Repository/ImageRepository.php b/src/Repository/ImageRepository.php index 4ebe7d65..b71d1d30 100644 --- a/src/Repository/ImageRepository.php +++ b/src/Repository/ImageRepository.php @@ -38,7 +38,7 @@ class ImageRepository extends AbstractRepository implements RepositoryInterface * @param string $langIso * @param bool $withSelecParameters * - * @return mixed + * @return void * * @throws \PrestaShopException */ diff --git a/src/Repository/ImageTypeRepository.php b/src/Repository/ImageTypeRepository.php index fbc872b4..20bb86dc 100644 --- a/src/Repository/ImageTypeRepository.php +++ b/src/Repository/ImageTypeRepository.php @@ -38,7 +38,7 @@ class ImageTypeRepository extends AbstractRepository implements RepositoryInterf * @param string $langIso * @param bool $withSelecParameters * - * @return mixed + * @return void * * @throws \PrestaShopException */ diff --git a/src/Repository/LanguageRepository.php b/src/Repository/LanguageRepository.php index ea0c8533..4e292d27 100644 --- a/src/Repository/LanguageRepository.php +++ b/src/Repository/LanguageRepository.php @@ -38,7 +38,7 @@ class LanguageRepository extends AbstractRepository implements RepositoryInterfa * @param string $langIso * @param bool $withSelecParameters * - * @return mixed + * @return void * * @throws \PrestaShopException */ diff --git a/src/Repository/ManufacturerRepository.php b/src/Repository/ManufacturerRepository.php index b2bbc81a..2e359bba 100644 --- a/src/Repository/ManufacturerRepository.php +++ b/src/Repository/ManufacturerRepository.php @@ -38,7 +38,7 @@ class ManufacturerRepository extends AbstractRepository implements RepositoryInt * @param string $langIso * @param bool $withSelecParameters * - * @return mixed + * @return void * * @throws \PrestaShopException */ diff --git a/src/Repository/ModuleRepository.php b/src/Repository/ModuleRepository.php index 41e4a41e..24b67193 100644 --- a/src/Repository/ModuleRepository.php +++ b/src/Repository/ModuleRepository.php @@ -38,7 +38,7 @@ class ModuleRepository extends AbstractRepository implements RepositoryInterface * @param string $langIso * @param bool $withSelecParameters * - * @return mixed + * @return void * * @throws \PrestaShopException */ diff --git a/src/Repository/OrderCarrierRepository.php b/src/Repository/OrderCarrierRepository.php index 709c153d..a5fe9b27 100644 --- a/src/Repository/OrderCarrierRepository.php +++ b/src/Repository/OrderCarrierRepository.php @@ -38,7 +38,7 @@ class OrderCarrierRepository extends AbstractRepository implements RepositoryInt * @param string $langIso * @param bool $withSelecParameters * - * @return mixed + * @return void * * @throws \PrestaShopException */ diff --git a/src/Repository/OrderCartRuleRepository.php b/src/Repository/OrderCartRuleRepository.php index 3795a04a..2cda0547 100644 --- a/src/Repository/OrderCartRuleRepository.php +++ b/src/Repository/OrderCartRuleRepository.php @@ -38,7 +38,7 @@ class OrderCartRuleRepository extends AbstractRepository implements RepositoryIn * @param string $langIso * @param bool $withSelecParameters * - * @return mixed + * @return void * * @throws \PrestaShopException */ @@ -101,8 +101,8 @@ public function retrieveContentsForIncremental($limit, $contentIds, $langIso) $this->generateFullQuery($langIso, true); $this->query - ->where('ocr.id_order IN(' . implode(',', array_map('intval', $contentIds)) . ')') - // ->limit($limit) Sub shop content depend from another, temporary disabled + ->where('ocr.id_order_cart_rule IN(' . implode(',', array_map('intval', $contentIds)) . ')') + ->limit($limit) ; return $this->runQuery(); diff --git a/src/Repository/OrderDetailRepository.php b/src/Repository/OrderDetailRepository.php index 0466ab0c..7f2a5c27 100644 --- a/src/Repository/OrderDetailRepository.php +++ b/src/Repository/OrderDetailRepository.php @@ -38,7 +38,7 @@ class OrderDetailRepository extends AbstractRepository implements RepositoryInte * @param string $langIso * @param bool $withSelecParameters * - * @return mixed + * @return void * * @throws \PrestaShopException */ @@ -56,6 +56,7 @@ public function generateFullQuery($langIso, $withSelecParameters) $this->generateMinimalQuery(self::TABLE_NAME, 'od'); + // minimal query for countable query $this->query ->where('od.id_shop = ' . $context->shop->id) ->innerJoin('orders', 'o', 'od.id_order = o.id_order') @@ -63,11 +64,12 @@ public function generateFullQuery($langIso, $withSelecParameters) ->leftJoin('product_shop', 'ps', 'od.product_id = ps.id_product AND ps.id_shop = ' . (int) $context->shop->id) ->leftJoin('currency', 'c', 'c.id_currency = o.id_currency') ->leftJoin('lang', 'l', 'o.id_lang = l.id_lang') + ->select('od.id_order_detail') + ->groupBy('od.id_order_detail') ; if ($withSelecParameters) { $this->query - ->select('od.id_order_detail') ->select('od.id_order') ->select('od.product_id') ->select('od.product_attribute_id') @@ -98,8 +100,6 @@ public function retrieveContentsForFull($offset, $limit, $langIso) { $this->generateFullQuery($langIso, true); - $this->query->groupBy('od.id_order_detail'); - $this->query->limit((int) $limit, (int) $offset); return $this->runQuery(); @@ -124,8 +124,8 @@ public function retrieveContentsForIncremental($limit, $contentIds, $langIso) $this->generateFullQuery($langIso, true); $this->query - ->where('od.id_order IN(' . implode(',', array_map('intval', $contentIds)) . ')') - // ->limit($limit) Sub shop content depend from another, temporary disabled + ->where('od.id_order_detail IN(' . implode(',', array_map('intval', $contentIds)) . ')') + ->limit($limit) ; return $this->runQuery(); @@ -143,12 +143,13 @@ public function retrieveContentsForIncremental($limit, $contentIds, $langIso) */ public function countFullSyncContentLeft($offset, $limit, $langIso) { - $this->generateFullQuery($langIso, false); - - $this->query->select('(COUNT(*) - ' . (int) $offset . ') as count'); + $this->generateFullQuery($langIso, true); - $result = $this->runQuery(true); + $result = $this->db->executeS(' + SELECT COUNT(*) - ' . (int) $offset . ' AS count + FROM (' . $this->query->build() . ') as subquery; + '); - return $result[0]['count']; + return is_array($result) ? $result[0]['count'] : 0; } } diff --git a/src/Repository/OrderRepository.php b/src/Repository/OrderRepository.php index 71352a86..84c24b52 100644 --- a/src/Repository/OrderRepository.php +++ b/src/Repository/OrderRepository.php @@ -38,7 +38,7 @@ class OrderRepository extends AbstractRepository implements RepositoryInterface * @param string $langIso * @param bool $withSelecParameters * - * @return mixed + * @return void * * @throws \PrestaShopException */ @@ -46,6 +46,7 @@ public function generateFullQuery($langIso, $withSelecParameters) { $this->generateMinimalQuery(self::TABLE_NAME, 'o'); + // minimal query for countable query $this->query ->leftJoin('currency', 'c', 'o.id_currency = c.id_currency') ->leftJoin('order_slip', 'os', 'o.id_order = os.id_order') @@ -56,11 +57,12 @@ public function generateFullQuery($langIso, $withSelecParameters) ->leftJoin('order_state_lang', 'osl', 'o.current_state = osl.id_order_state') ->leftJoin('order_state', 'ost', 'o.current_state = ost.id_order_state') ->where('o.id_shop = ' . (int) parent::getShopContext()->id) + ->select('o.id_order') + ->groupBy('o.id_order') ; if ($withSelecParameters) { $this->query - ->select('o.id_order') ->select('o.reference') ->select('o.id_customer') ->select('o.id_cart') @@ -128,8 +130,6 @@ public function retrieveContentsForFull($offset, $limit, $langIso) { $this->generateFullQuery($langIso, true); - $this->query->groupBy('o.id_order'); - $this->query->limit((int) $limit, (int) $offset); return $this->runQuery(); @@ -175,10 +175,11 @@ public function countFullSyncContentLeft($offset, $limit, $langIso) { $this->generateFullQuery($langIso, false); - $this->query->select('(COUNT(*) - ' . (int) $offset . ') as count'); - - $result = $this->runQuery(true); + $result = $this->db->executeS(' + SELECT COUNT(*) - ' . (int) $offset . ' AS count + FROM (' . $this->query->build() . ') as subquery; + '); - return $result[0]['count']; + return is_array($result) ? $result[0]['count'] : 0; } } diff --git a/src/Repository/OrderStatusHistoryRepository.php b/src/Repository/OrderStatusHistoryRepository.php index e60ca28d..989ea401 100644 --- a/src/Repository/OrderStatusHistoryRepository.php +++ b/src/Repository/OrderStatusHistoryRepository.php @@ -38,7 +38,7 @@ class OrderStatusHistoryRepository extends AbstractRepository implements Reposit * @param string $langIso * @param bool $withSelecParameters * - * @return mixed + * @return void * * @throws \PrestaShopException */ @@ -108,8 +108,8 @@ public function retrieveContentsForIncremental($limit, $contentIds, $langIso) $this->generateFullQuery($langIso, true); $this->query - ->where('oh.id_order IN(' . implode(',', array_map('intval', $contentIds)) . ')') - // ->limit($limit) Sub shop content depend from another, temporary disabled + ->where('oh.id_order_history IN(' . implode(',', array_map('intval', $contentIds)) . ')') + ->limit($limit) ; return $this->runQuery(); diff --git a/src/Repository/ProductRepository.php b/src/Repository/ProductRepository.php index 4e0bf247..db62159e 100644 --- a/src/Repository/ProductRepository.php +++ b/src/Repository/ProductRepository.php @@ -38,7 +38,7 @@ class ProductRepository extends AbstractRepository implements RepositoryInterfac * @param string $langIso * @param bool $withSelecParameters * - * @return mixed + * @return void * * @throws \PrestaShopException */ diff --git a/src/Repository/ProductSupplierRepository.php b/src/Repository/ProductSupplierRepository.php index abc336fb..3abe82d6 100644 --- a/src/Repository/ProductSupplierRepository.php +++ b/src/Repository/ProductSupplierRepository.php @@ -38,7 +38,7 @@ class ProductSupplierRepository extends AbstractRepository implements Repository * @param string $langIso * @param bool $withSelecParameters * - * @return mixed + * @return void * * @throws \PrestaShopException */ diff --git a/src/Repository/RepositoryInterface.php b/src/Repository/RepositoryInterface.php index 9904a316..530b1c84 100644 --- a/src/Repository/RepositoryInterface.php +++ b/src/Repository/RepositoryInterface.php @@ -39,7 +39,7 @@ interface RepositoryInterface * @param string $langIso * @param bool $withSelecParameters * - * @return mixed + * @return void */ public function generateFullQuery($langIso, $withSelecParameters); diff --git a/src/Repository/SpecificPriceRepository.php b/src/Repository/SpecificPriceRepository.php index ea95c292..ed21db9b 100644 --- a/src/Repository/SpecificPriceRepository.php +++ b/src/Repository/SpecificPriceRepository.php @@ -38,7 +38,7 @@ class SpecificPriceRepository extends AbstractRepository implements RepositoryIn * @param string $langIso * @param bool $withSelecParameters * - * @return mixed + * @return void * * @throws \PrestaShopException */ diff --git a/src/Repository/StockMovementRepository.php b/src/Repository/StockMovementRepository.php index 6a03f05a..337b39f5 100644 --- a/src/Repository/StockMovementRepository.php +++ b/src/Repository/StockMovementRepository.php @@ -38,7 +38,7 @@ class StockMovementRepository extends AbstractRepository implements RepositoryIn * @param string $langIso * @param bool $withSelecParameters * - * @return mixed + * @return void * * @throws \PrestaShopException */ diff --git a/src/Repository/StockRepository.php b/src/Repository/StockRepository.php index 3e69300e..355581e6 100644 --- a/src/Repository/StockRepository.php +++ b/src/Repository/StockRepository.php @@ -38,7 +38,7 @@ class StockRepository extends AbstractRepository implements RepositoryInterface * @param string $langIso * @param bool $withSelecParameters * - * @return mixed + * @return void * * @throws \PrestaShopException */ diff --git a/src/Repository/StoreRepository.php b/src/Repository/StoreRepository.php index 6be5d5b9..8f3461b2 100644 --- a/src/Repository/StoreRepository.php +++ b/src/Repository/StoreRepository.php @@ -38,7 +38,7 @@ class StoreRepository extends AbstractRepository implements RepositoryInterface * @param string $langIso * @param bool $withSelecParameters * - * @return mixed + * @return void * * @throws \PrestaShopException */ diff --git a/src/Repository/SupplierRepository.php b/src/Repository/SupplierRepository.php index 9a2a81c4..1b716a20 100644 --- a/src/Repository/SupplierRepository.php +++ b/src/Repository/SupplierRepository.php @@ -38,7 +38,7 @@ class SupplierRepository extends AbstractRepository implements RepositoryInterfa * @param string $langIso * @param bool $withSelecParameters * - * @return mixed + * @return void * * @throws \PrestaShopException */ diff --git a/src/Repository/TaxonomyRepository.php b/src/Repository/TaxonomyRepository.php index edefb17e..53dab9fe 100644 --- a/src/Repository/TaxonomyRepository.php +++ b/src/Repository/TaxonomyRepository.php @@ -38,7 +38,7 @@ class TaxonomyRepository extends AbstractRepository implements RepositoryInterfa * @param string $langIso * @param bool $withSelecParameters * - * @return mixed + * @return void * * @throws \PrestaShopException */ diff --git a/src/Repository/TranslationRepository.php b/src/Repository/TranslationRepository.php index 62cb6d2a..cf483319 100644 --- a/src/Repository/TranslationRepository.php +++ b/src/Repository/TranslationRepository.php @@ -38,7 +38,7 @@ class TranslationRepository extends AbstractRepository implements RepositoryInte * @param string $langIso * @param bool $withSelecParameters * - * @return mixed + * @return void * * @throws \PrestaShopException */ diff --git a/src/Repository/WishlistProductRepository.php b/src/Repository/WishlistProductRepository.php index 764e50ad..01bc0f47 100644 --- a/src/Repository/WishlistProductRepository.php +++ b/src/Repository/WishlistProductRepository.php @@ -38,7 +38,7 @@ class WishlistProductRepository extends AbstractRepository implements Repository * @param string $langIso * @param bool $withSelecParameters * - * @return mixed + * @return void * * @throws \PrestaShopException */ diff --git a/src/Repository/WishlistRepository.php b/src/Repository/WishlistRepository.php index f56fc089..25558cfa 100644 --- a/src/Repository/WishlistRepository.php +++ b/src/Repository/WishlistRepository.php @@ -38,7 +38,7 @@ class WishlistRepository extends AbstractRepository implements RepositoryInterfa * @param string $langIso * @param bool $withSelecParameters * - * @return mixed + * @return void * * @throws \PrestaShopException */ diff --git a/src/Traits/Hooks/UseOrderCarrierHooks.php b/src/Traits/Hooks/UseOrderCarrierHooks.php new file mode 100644 index 00000000..183cfd6c --- /dev/null +++ b/src/Traits/Hooks/UseOrderCarrierHooks.php @@ -0,0 +1,87 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ + +namespace PrestaShop\Module\PsEventbus\Traits\Hooks; + +use PrestaShop\Module\PsEventbus\Config\Config; +use PrestaShop\Module\PsEventbus\Service\SynchronizationService; + +if (!defined('_PS_VERSION_')) { + exit; +} + +trait UseOrderCarrierHooks +{ + /** + * @param array $parameters + * + * @return void + */ + public function hookActionObjectOrderCarrierAddAfter($parameters) + { + /** @var SynchronizationService $synchronizationService * */ + $synchronizationService = $this->getService(Config::SYNC_SERVICE_NAME); + + /** @var \OrderCarrier $orderCarrier */ + $orderCarrier = $parameters['object']; + + if (isset($orderCarrier->id)) { + $synchronizationService->sendLiveSync(Config::COLLECTION_ORDER_CARRIERS, Config::INCREMENTAL_TYPE_UPSERT); + $synchronizationService->insertContentIntoIncremental( + [Config::COLLECTION_ORDER_CARRIERS => $orderCarrier->id], + Config::INCREMENTAL_TYPE_UPSERT, + date(DATE_ATOM), + $this->shopId, + false + ); + } + } + + /** + * @param array $parameters + * + * @return void + */ + public function hookActionObjectOrderCarrierUpdateAfter($parameters) + { + /** @var SynchronizationService $synchronizationService * */ + $synchronizationService = $this->getService(Config::SYNC_SERVICE_NAME); + + /** @var \OrderCarrier $orderCarrier */ + $orderCarrier = $parameters['object']; + + if (isset($orderCarrier->id)) { + $synchronizationService->sendLiveSync(Config::COLLECTION_ORDER_CARRIERS, Config::INCREMENTAL_TYPE_UPSERT); + $synchronizationService->insertContentIntoIncremental( + [Config::COLLECTION_ORDER_CARRIERS => $orderCarrier->id], + Config::INCREMENTAL_TYPE_UPSERT, + date(DATE_ATOM), + $this->shopId, + false + ); + } + } +} diff --git a/src/Traits/Hooks/UseOrderCartRuleHooks.php b/src/Traits/Hooks/UseOrderCartRuleHooks.php new file mode 100644 index 00000000..5660ca6f --- /dev/null +++ b/src/Traits/Hooks/UseOrderCartRuleHooks.php @@ -0,0 +1,87 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ + +namespace PrestaShop\Module\PsEventbus\Traits\Hooks; + +use PrestaShop\Module\PsEventbus\Config\Config; +use PrestaShop\Module\PsEventbus\Service\SynchronizationService; + +if (!defined('_PS_VERSION_')) { + exit; +} + +trait UseOrderCartRuleHooks +{ + /** + * @param array $parameters + * + * @return void + */ + public function hookActionObjectOrderCartRuleAddAfter($parameters) + { + /** @var SynchronizationService $synchronizationService * */ + $synchronizationService = $this->getService(Config::SYNC_SERVICE_NAME); + + /** @var \OrderCartRule $orderCartRule */ + $orderCartRule = $parameters['object']; + + if (isset($orderCartRule->id)) { + $synchronizationService->sendLiveSync(Config::COLLECTION_ORDER_CART_RULES, Config::INCREMENTAL_TYPE_UPSERT); + $synchronizationService->insertContentIntoIncremental( + [Config::COLLECTION_ORDER_CART_RULES => $orderCartRule->id], + Config::INCREMENTAL_TYPE_UPSERT, + date(DATE_ATOM), + $this->shopId, + false + ); + } + } + + /** + * @param array $parameters + * + * @return void + */ + public function hookActionObjectOrderCartRuleUpdateAfter($parameters) + { + /** @var SynchronizationService $synchronizationService * */ + $synchronizationService = $this->getService(Config::SYNC_SERVICE_NAME); + + /** @var \OrderCartRule $orderCartRule */ + $orderCartRule = $parameters['object']; + + if (isset($orderCartRule->id)) { + $synchronizationService->sendLiveSync(Config::COLLECTION_ORDER_CART_RULES, Config::INCREMENTAL_TYPE_UPSERT); + $synchronizationService->insertContentIntoIncremental( + [Config::COLLECTION_ORDER_CART_RULES => $orderCartRule->id], + Config::INCREMENTAL_TYPE_UPSERT, + date(DATE_ATOM), + $this->shopId, + false + ); + } + } +} diff --git a/src/Traits/Hooks/UseOrderDetailHooks.php b/src/Traits/Hooks/UseOrderDetailHooks.php new file mode 100644 index 00000000..45073ad8 --- /dev/null +++ b/src/Traits/Hooks/UseOrderDetailHooks.php @@ -0,0 +1,87 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ + +namespace PrestaShop\Module\PsEventbus\Traits\Hooks; + +use PrestaShop\Module\PsEventbus\Config\Config; +use PrestaShop\Module\PsEventbus\Service\SynchronizationService; + +if (!defined('_PS_VERSION_')) { + exit; +} + +trait UseOrderDetailHooks +{ + /** + * @param array $parameters + * + * @return void + */ + public function hookActionObjectOrderDetailAddAfter($parameters) + { + /** @var SynchronizationService $synchronizationService * */ + $synchronizationService = $this->getService(Config::SYNC_SERVICE_NAME); + + /** @var \OrderDetail $orderDetail */ + $orderDetail = $parameters['object']; + + if (isset($orderDetail->id)) { + $synchronizationService->sendLiveSync(Config::COLLECTION_ORDER_DETAILS, Config::INCREMENTAL_TYPE_UPSERT); + $synchronizationService->insertContentIntoIncremental( + [Config::COLLECTION_ORDER_DETAILS => $orderDetail->id], + Config::INCREMENTAL_TYPE_UPSERT, + date(DATE_ATOM), + $this->shopId, + false + ); + } + } + + /** + * @param array $parameters + * + * @return void + */ + public function hookActionObjectOrderDetailUpdateAfter($parameters) + { + /** @var SynchronizationService $synchronizationService * */ + $synchronizationService = $this->getService(Config::SYNC_SERVICE_NAME); + + /** @var \OrderDetail $orderDetail */ + $orderDetail = $parameters['object']; + + if (isset($orderDetail->id)) { + $synchronizationService->sendLiveSync(Config::COLLECTION_ORDER_DETAILS, Config::INCREMENTAL_TYPE_UPSERT); + $synchronizationService->insertContentIntoIncremental( + [Config::COLLECTION_ORDER_DETAILS => $orderDetail->id], + Config::INCREMENTAL_TYPE_UPSERT, + date(DATE_ATOM), + $this->shopId, + false + ); + } + } +} diff --git a/src/Traits/Hooks/UseOrderHistoryHooks.php b/src/Traits/Hooks/UseOrderHistoryHooks.php new file mode 100644 index 00000000..325c6ca4 --- /dev/null +++ b/src/Traits/Hooks/UseOrderHistoryHooks.php @@ -0,0 +1,87 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ + +namespace PrestaShop\Module\PsEventbus\Traits\Hooks; + +use PrestaShop\Module\PsEventbus\Config\Config; +use PrestaShop\Module\PsEventbus\Service\SynchronizationService; + +if (!defined('_PS_VERSION_')) { + exit; +} + +trait UseOrderHistoryHooks +{ + /** + * @param array $parameters + * + * @return void + */ + public function hookActionObjectOrderHistoryAddAfter($parameters) + { + /** @var SynchronizationService $synchronizationService * */ + $synchronizationService = $this->getService(Config::SYNC_SERVICE_NAME); + + /** @var \OrderHistory $orderHistory */ + $orderHistory = $parameters['object']; + + if (isset($orderHistory->id)) { + $synchronizationService->sendLiveSync(Config::COLLECTION_ORDER_STATUS_HISTORY, Config::INCREMENTAL_TYPE_UPSERT); + $synchronizationService->insertContentIntoIncremental( + [Config::COLLECTION_ORDER_STATUS_HISTORY => $orderHistory->id], + Config::INCREMENTAL_TYPE_UPSERT, + date(DATE_ATOM), + $this->shopId, + false + ); + } + } + + /** + * @param array $parameters + * + * @return void + */ + public function hookActionObjectOrderHistoryUpdateAfter($parameters) + { + /** @var SynchronizationService $synchronizationService * */ + $synchronizationService = $this->getService(Config::SYNC_SERVICE_NAME); + + /** @var \OrderHistory $orderHistory */ + $orderHistory = $parameters['object']; + + if (isset($orderHistory->id)) { + $synchronizationService->sendLiveSync(Config::COLLECTION_ORDER_STATUS_HISTORY, Config::INCREMENTAL_TYPE_UPSERT); + $synchronizationService->insertContentIntoIncremental( + [Config::COLLECTION_ORDER_STATUS_HISTORY => $orderHistory->id], + Config::INCREMENTAL_TYPE_UPSERT, + date(DATE_ATOM), + $this->shopId, + false + ); + } + } +} diff --git a/src/Traits/Hooks/UseOrderHooks.php b/src/Traits/Hooks/UseOrderHooks.php index 3d503449..254b5955 100644 --- a/src/Traits/Hooks/UseOrderHooks.php +++ b/src/Traits/Hooks/UseOrderHooks.php @@ -45,6 +45,7 @@ public function hookActionObjectOrderAddAfter($parameters) /** @var SynchronizationService $synchronizationService * */ $synchronizationService = $this->getService(Config::SYNC_SERVICE_NAME); + /** @var \Order $order */ $order = $parameters['object']; if (isset($order->id)) { @@ -69,25 +70,13 @@ public function hookActionObjectOrderUpdateAfter($parameters) /** @var SynchronizationService $synchronizationService * */ $synchronizationService = $this->getService(Config::SYNC_SERVICE_NAME); + /** @var \Order $order */ $order = $parameters['object']; if (isset($order->id)) { - $synchronizationService->sendLiveSync( - [ - Config::COLLECTION_ORDERS, - Config::COLLECTION_ORDER_CART_RULES, - Config::COLLECTION_ORDER_DETAILS, - Config::COLLECTION_ORDER_STATUS_HISTORY, - ], - Config::INCREMENTAL_TYPE_UPSERT - ); + $synchronizationService->sendLiveSync(Config::COLLECTION_ORDERS, Config::INCREMENTAL_TYPE_UPSERT); $synchronizationService->insertContentIntoIncremental( - [ - Config::COLLECTION_ORDERS => $order->id, - Config::COLLECTION_ORDER_CART_RULES => $order->id, - Config::COLLECTION_ORDER_DETAILS => $order->id, - Config::COLLECTION_ORDER_STATUS_HISTORY => $order->id, - ], + [Config::COLLECTION_ORDERS => $order->id], Config::INCREMENTAL_TYPE_UPSERT, date(DATE_ATOM), $this->shopId, diff --git a/src/Traits/Hooks/UseStockHooks.php b/src/Traits/Hooks/UseStockHooks.php index 29414ee4..3f74bb1d 100644 --- a/src/Traits/Hooks/UseStockHooks.php +++ b/src/Traits/Hooks/UseStockHooks.php @@ -84,31 +84,4 @@ public function hookActionObjectStockAvailableUpdateAfter($parameters) ); } } - - /** - * Work Only on 1.6 - * - * @param array $parameters - * - * @return void - */ - public function hookActionObjectStockMvtAddAfter($parameters) - { - /** @var SynchronizationService $synchronizationService * */ - $synchronizationService = $this->getService(Config::SYNC_SERVICE_NAME); - - /** @var \StockMvt $stockMvt */ - $stockMvt = $parameters['object']; - - if (isset($stockMvt->id)) { - $synchronizationService->sendLiveSync(Config::COLLECTION_STOCK_MOVEMENTS, Config::INCREMENTAL_TYPE_UPSERT); - $synchronizationService->insertContentIntoIncremental( - [Config::COLLECTION_STOCK_MOVEMENTS => $stockMvt->id], - Config::INCREMENTAL_TYPE_UPSERT, - date(DATE_ATOM), - $this->shopId, - true - ); - } - } } diff --git a/src/Traits/Hooks/UseStockMvtHooks.php b/src/Traits/Hooks/UseStockMvtHooks.php new file mode 100644 index 00000000..f4a37d84 --- /dev/null +++ b/src/Traits/Hooks/UseStockMvtHooks.php @@ -0,0 +1,64 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ + +namespace PrestaShop\Module\PsEventbus\Traits\Hooks; + +use PrestaShop\Module\PsEventbus\Config\Config; +use PrestaShop\Module\PsEventbus\Service\SynchronizationService; + +if (!defined('_PS_VERSION_')) { + exit; +} + +trait UseStockMvtHooks +{ + /** + * Work Only on 1.6 + * + * @param array $parameters + * + * @return void + */ + public function hookActionObjectStockMvtAddAfter($parameters) + { + /** @var SynchronizationService $synchronizationService * */ + $synchronizationService = $this->getService(Config::SYNC_SERVICE_NAME); + + /** @var \StockMvt $stockMvt */ + $stockMvt = $parameters['object']; + + if (isset($stockMvt->id)) { + $synchronizationService->sendLiveSync(Config::COLLECTION_STOCK_MOVEMENTS, Config::INCREMENTAL_TYPE_UPSERT); + $synchronizationService->insertContentIntoIncremental( + [Config::COLLECTION_STOCK_MOVEMENTS => $stockMvt->id], + Config::INCREMENTAL_TYPE_UPSERT, + date(DATE_ATOM), + $this->shopId, + true + ); + } + } +} diff --git a/src/Traits/UseHooks.php b/src/Traits/UseHooks.php index f29f7f86..02b36a40 100644 --- a/src/Traits/UseHooks.php +++ b/src/Traits/UseHooks.php @@ -38,10 +38,15 @@ use PrestaShop\Module\PsEventbus\Traits\Hooks\UseImageTypeHooks; use PrestaShop\Module\PsEventbus\Traits\Hooks\UseLanguageHooks; use PrestaShop\Module\PsEventbus\Traits\Hooks\UseManufacturerHooks; +use PrestaShop\Module\PsEventbus\Traits\Hooks\UseOrderCarrierHooks; +use PrestaShop\Module\PsEventbus\Traits\Hooks\UseOrderCartRuleHooks; +use PrestaShop\Module\PsEventbus\Traits\Hooks\UseOrderDetailHooks; +use PrestaShop\Module\PsEventbus\Traits\Hooks\UseOrderHistoryHooks; use PrestaShop\Module\PsEventbus\Traits\Hooks\UseOrderHooks; use PrestaShop\Module\PsEventbus\Traits\Hooks\UseProductHooks; use PrestaShop\Module\PsEventbus\Traits\Hooks\UseSpecificPriceHooks; use PrestaShop\Module\PsEventbus\Traits\Hooks\UseStockHooks; +use PrestaShop\Module\PsEventbus\Traits\Hooks\UseStockMvtHooks; use PrestaShop\Module\PsEventbus\Traits\Hooks\UseStoreHooks; use PrestaShop\Module\PsEventbus\Traits\Hooks\UseSupplierHooks; use PrestaShop\Module\PsEventbus\Traits\Hooks\UseWishlistHooks; @@ -64,10 +69,15 @@ trait UseHooks use UseImageTypeHooks; use UseLanguageHooks; use UseManufacturerHooks; + use UseOrderCarrierHooks; + use UseOrderCartRuleHooks; + use UseOrderDetailHooks; + use UseOrderHistoryHooks; use UseOrderHooks; use UseProductHooks; use UseSpecificPriceHooks; use UseStockHooks; + use UseStockMvtHooks; use UseStoreHooks; use UseSupplierHooks; use UseWishlistHooks; @@ -126,6 +136,18 @@ public function getHooks() 'actionObjectManufacturerUpdateAfter', 'actionObjectManufacturerDeleteAfter', + 'actionObjectOrderCarrierAddAfter', + 'actionObjectOrderCarrierUpdateAfter', + + 'actionObjectOrderCartRuleAddAfter', + 'actionObjectOrderCartRuleUpdateAfter', + + 'actionObjectOrderDetailAddAfter', + 'actionObjectOrderDetailUpdateAfter', + + 'actionObjectOrderHistoryAddAfter', + 'actionObjectOrderHistoryUpdateAfter', + 'actionObjectOrderAddAfter', 'actionObjectOrderUpdateAfter',