| Total Complexity | 81 |
| Total Lines | 2842 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
Complex classes like Migration1536233560BasicData often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use Migration1536233560BasicData, and based on these observations, apply Extract Interface, too.
| 1 | <?php declare(strict_types=1); |
||
| 33 | class Migration1536233560BasicData extends MigrationStep |
||
| 34 | { |
||
| 35 | /** |
||
| 36 | * @var array |
||
| 37 | */ |
||
| 38 | private $mailTypes; |
||
| 39 | |||
| 40 | public function getCreationTimestamp(): int |
||
| 41 | { |
||
| 42 | return 1536233560; |
||
| 43 | } |
||
| 44 | |||
| 45 | public function update(Connection $connection): void |
||
| 46 | { |
||
| 47 | $hasData = $connection->executeQuery('SELECT 1 FROM `language` LIMIT 1')->fetch(); |
||
| 48 | if ($hasData) { |
||
| 49 | return; |
||
| 50 | } |
||
| 51 | |||
| 52 | $this->createLanguage($connection); |
||
| 53 | $this->createLocale($connection); |
||
| 54 | |||
| 55 | $this->createDocumentTypes($connection); |
||
| 56 | $this->createSalutation($connection); |
||
| 57 | $this->createCountry($connection); |
||
| 58 | $this->createCurrency($connection); |
||
| 59 | $this->createCustomerGroup($connection); |
||
| 60 | $this->createPaymentMethod($connection); |
||
| 61 | $this->createShippingMethod($connection); |
||
| 62 | $this->createTax($connection); |
||
| 63 | $this->createRootCategory($connection); |
||
| 64 | $this->createSalesChannelTypes($connection); |
||
| 65 | $this->createSalesChannel($connection); |
||
| 66 | $this->createProductManufacturer($connection); |
||
| 67 | $this->createDefaultSnippetSets($connection); |
||
| 68 | $this->createDefaultMediaFolders($connection); |
||
| 69 | $this->createRules($connection); |
||
| 70 | $this->createMailTemplateTypes($connection); |
||
| 71 | $this->createNewsletterMailTemplate($connection); |
||
| 72 | $this->createDocumentConfiguration($connection); |
||
| 73 | $this->createMailEvents($connection); |
||
| 74 | $this->createNumberRanges($connection); |
||
| 75 | |||
| 76 | $this->createOrderStateMachine($connection); |
||
| 77 | $this->createOrderDeliveryStateMachine($connection); |
||
| 78 | $this->createOrderTransactionStateMachine($connection); |
||
| 79 | |||
| 80 | $this->createSystemConfigOptions($connection); |
||
| 81 | |||
| 82 | $this->createCmsPages($connection); |
||
| 83 | } |
||
| 84 | |||
| 85 | public function updateDestructive(Connection $connection): void |
||
| 86 | { |
||
| 87 | // implement update destructive |
||
| 88 | } |
||
| 89 | |||
| 90 | private function createLanguage(Connection $connection): void |
||
| 91 | { |
||
| 92 | $localeEn = Uuid::randomBytes(); |
||
| 93 | $localeDe = Uuid::randomBytes(); |
||
| 94 | $languageEn = Uuid::fromHexToBytes(Defaults::LANGUAGE_SYSTEM); |
||
| 95 | $languageDe = Uuid::fromHexToBytes(Defaults::LANGUAGE_SYSTEM_DE); |
||
| 96 | |||
| 97 | // first locales |
||
| 98 | $connection->insert('locale', ['id' => $localeEn, 'code' => 'en-GB', 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 99 | $connection->insert('locale', ['id' => $localeDe, 'code' => 'de-DE', 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 100 | |||
| 101 | // second languages |
||
| 102 | $connection->insert('language', [ |
||
| 103 | 'id' => $languageEn, |
||
| 104 | 'name' => 'English', |
||
| 105 | 'locale_id' => $localeEn, |
||
| 106 | 'translation_code_id' => $localeEn, |
||
| 107 | 'created_at' => date(Defaults::STORAGE_DATE_FORMAT), |
||
| 108 | ]); |
||
| 109 | |||
| 110 | $connection->insert('language', [ |
||
| 111 | 'id' => $languageDe, |
||
| 112 | 'name' => 'Deutsch', |
||
| 113 | 'locale_id' => $localeDe, |
||
| 114 | 'translation_code_id' => $localeDe, |
||
| 115 | 'created_at' => date(Defaults::STORAGE_DATE_FORMAT), |
||
| 116 | ]); |
||
| 117 | |||
| 118 | // third translations |
||
| 119 | $connection->insert('locale_translation', [ |
||
| 120 | 'locale_id' => $localeEn, |
||
| 121 | 'language_id' => $languageEn, |
||
| 122 | 'name' => 'English', |
||
| 123 | 'territory' => 'United Kingdom', |
||
| 124 | 'created_at' => date(Defaults::STORAGE_DATE_FORMAT), |
||
| 125 | ]); |
||
| 126 | $connection->insert('locale_translation', [ |
||
| 127 | 'locale_id' => $localeEn, |
||
| 128 | 'language_id' => $languageDe, |
||
| 129 | 'name' => 'Englisch', |
||
| 130 | 'territory' => 'Vereinigtes Königreich', |
||
| 131 | 'created_at' => date(Defaults::STORAGE_DATE_FORMAT), |
||
| 132 | ]); |
||
| 133 | $connection->insert('locale_translation', [ |
||
| 134 | 'locale_id' => $localeDe, |
||
| 135 | 'language_id' => $languageEn, |
||
| 136 | 'name' => 'German', |
||
| 137 | 'territory' => 'Germany', |
||
| 138 | 'created_at' => date(Defaults::STORAGE_DATE_FORMAT), |
||
| 139 | ]); |
||
| 140 | $connection->insert('locale_translation', [ |
||
| 141 | 'locale_id' => $localeDe, |
||
| 142 | 'language_id' => $languageDe, |
||
| 143 | 'name' => 'Deutsch', |
||
| 144 | 'territory' => 'Deutschland', |
||
| 145 | 'created_at' => date(Defaults::STORAGE_DATE_FORMAT), |
||
| 146 | ]); |
||
| 147 | } |
||
| 148 | |||
| 149 | private function createLocale(Connection $connection): void |
||
| 150 | { |
||
| 151 | $localeData = include __DIR__ . '/../locales.php'; |
||
| 152 | |||
| 153 | $queue = new MultiInsertQueryQueue($connection); |
||
| 154 | $languageEn = Uuid::fromHexToBytes(Defaults::LANGUAGE_SYSTEM); |
||
| 155 | $languageDe = Uuid::fromHexToBytes(Defaults::LANGUAGE_SYSTEM_DE); |
||
| 156 | |||
| 157 | foreach ($localeData as $locale) { |
||
| 158 | if (\in_array($locale['locale'], ['en-GB', 'de-DE'], true)) { |
||
| 159 | continue; |
||
| 160 | } |
||
| 161 | |||
| 162 | $localeId = Uuid::randomBytes(); |
||
| 163 | |||
| 164 | $queue->addInsert( |
||
| 165 | 'locale', |
||
| 166 | ['id' => $localeId, 'code' => $locale['locale'], 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)] |
||
| 167 | ); |
||
| 168 | |||
| 169 | $queue->addInsert( |
||
| 170 | 'locale_translation', |
||
| 171 | [ |
||
| 172 | 'locale_id' => $localeId, |
||
| 173 | 'language_id' => $languageEn, |
||
| 174 | 'created_at' => date(Defaults::STORAGE_DATE_FORMAT), |
||
| 175 | 'name' => $locale['name']['en-GB'], |
||
| 176 | 'territory' => $locale['territory']['en-GB'], |
||
| 177 | ] |
||
| 178 | ); |
||
| 179 | |||
| 180 | $queue->addInsert( |
||
| 181 | 'locale_translation', |
||
| 182 | [ |
||
| 183 | 'locale_id' => $localeId, |
||
| 184 | 'language_id' => $languageDe, |
||
| 185 | 'created_at' => date(Defaults::STORAGE_DATE_FORMAT), |
||
| 186 | 'name' => $locale['name']['de-DE'], |
||
| 187 | 'territory' => $locale['territory']['de-DE'], |
||
| 188 | ] |
||
| 189 | ); |
||
| 190 | } |
||
| 191 | |||
| 192 | $queue->execute(); |
||
| 193 | } |
||
| 194 | |||
| 195 | private function createCountry(Connection $connection): void |
||
| 196 | { |
||
| 197 | $languageDE = function (string $countryId, string $name) { |
||
| 198 | return [ |
||
| 199 | 'language_id' => Uuid::fromHexToBytes(Defaults::LANGUAGE_SYSTEM_DE), |
||
| 200 | 'name' => $name, |
||
| 201 | 'country_id' => $countryId, |
||
| 202 | 'created_at' => date(Defaults::STORAGE_DATE_FORMAT), |
||
| 203 | ]; |
||
| 204 | }; |
||
| 205 | |||
| 206 | $languageEN = function (string $countryId, string $name) { |
||
| 207 | return [ |
||
| 208 | 'language_id' => Uuid::fromHexToBytes(Defaults::LANGUAGE_SYSTEM), |
||
| 209 | 'name' => $name, |
||
| 210 | 'country_id' => $countryId, |
||
| 211 | 'created_at' => date(Defaults::STORAGE_DATE_FORMAT), |
||
| 212 | ]; |
||
| 213 | }; |
||
| 214 | |||
| 215 | $deId = Uuid::randomBytes(); |
||
| 216 | $connection->insert('country', ['id' => $deId, 'iso' => 'DE', 'position' => 1, 'iso3' => 'DEU', 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 217 | $connection->insert('country_translation', $languageDE($deId, 'Deutschland')); |
||
| 218 | $connection->insert('country_translation', $languageEN($deId, 'Germany')); |
||
| 219 | |||
| 220 | $this->createCountryStates($connection, $deId, 'DE'); |
||
| 221 | |||
| 222 | $grId = Uuid::randomBytes(); |
||
| 223 | $connection->insert('country', ['id' => $grId, 'iso' => 'GR', 'position' => 10, 'iso3' => 'GRC', 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 224 | $connection->insert('country_translation', $languageEN($grId, 'Greece')); |
||
| 225 | $connection->insert('country_translation', $languageDE($grId, 'Griechenland')); |
||
| 226 | |||
| 227 | $gbId = Uuid::randomBytes(); |
||
| 228 | $connection->insert('country', ['id' => $gbId, 'iso' => 'GB', 'position' => 5, 'iso3' => 'GBR', 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 229 | $connection->insert('country_translation', $languageEN($gbId, 'Great Britain')); |
||
| 230 | $connection->insert('country_translation', $languageDE($gbId, 'Großbritannien')); |
||
| 231 | |||
| 232 | $this->createCountryStates($connection, $gbId, 'GB'); |
||
| 233 | |||
| 234 | $ieId = Uuid::randomBytes(); |
||
| 235 | $connection->insert('country', ['id' => $ieId, 'iso' => 'IE', 'position' => 10, 'iso3' => 'IRL', 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 236 | $connection->insert('country_translation', $languageEN($ieId, 'Ireland')); |
||
| 237 | $connection->insert('country_translation', $languageDE($ieId, 'Irland')); |
||
| 238 | |||
| 239 | $isId = Uuid::randomBytes(); |
||
| 240 | $connection->insert('country', ['id' => $isId, 'iso' => 'IS', 'position' => 10, 'iso3' => 'ISL', 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 241 | $connection->insert('country_translation', $languageEN($isId, 'Iceland')); |
||
| 242 | $connection->insert('country_translation', $languageDE($isId, 'Island')); |
||
| 243 | |||
| 244 | $itId = Uuid::randomBytes(); |
||
| 245 | $connection->insert('country', ['id' => $itId, 'iso' => 'IT', 'position' => 10, 'active' => 1, 'iso3' => 'ITA', 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 246 | $connection->insert('country_translation', $languageEN($itId, 'Italy')); |
||
| 247 | $connection->insert('country_translation', $languageDE($itId, 'Italien')); |
||
| 248 | |||
| 249 | $jpId = Uuid::randomBytes(); |
||
| 250 | $connection->insert('country', ['id' => $jpId, 'iso' => 'JP', 'position' => 10, 'iso3' => 'JPN', 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 251 | $connection->insert('country_translation', $languageEN($jpId, 'Japan')); |
||
| 252 | $connection->insert('country_translation', $languageDE($jpId, 'Japan')); |
||
| 253 | |||
| 254 | $caId = Uuid::randomBytes(); |
||
| 255 | $connection->insert('country', ['id' => $caId, 'iso' => 'CA', 'position' => 10, 'iso3' => 'CAN', 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 256 | $connection->insert('country_translation', $languageEN($caId, 'Canada')); |
||
| 257 | $connection->insert('country_translation', $languageDE($caId, 'Kanada')); |
||
| 258 | |||
| 259 | $luId = Uuid::randomBytes(); |
||
| 260 | $connection->insert('country', ['id' => $luId, 'iso' => 'LU', 'position' => 10, 'iso3' => 'LUX', 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 261 | $connection->insert('country_translation', $languageEN($luId, 'Luxembourg')); |
||
| 262 | $connection->insert('country_translation', $languageDE($luId, 'Luxemburg')); |
||
| 263 | |||
| 264 | $naId = Uuid::randomBytes(); |
||
| 265 | $connection->insert('country', ['id' => $naId, 'iso' => 'NA', 'position' => 10, 'iso3' => 'NAM', 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 266 | $connection->insert('country_translation', $languageEN($naId, 'Namibia')); |
||
| 267 | $connection->insert('country_translation', $languageDE($naId, 'Namibia')); |
||
| 268 | |||
| 269 | $nlId = Uuid::randomBytes(); |
||
| 270 | $connection->insert('country', ['id' => $nlId, 'iso' => 'NL', 'position' => 10, 'active' => 1, 'iso3' => 'NLD', 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 271 | $connection->insert('country_translation', $languageEN($nlId, 'Netherlands')); |
||
| 272 | $connection->insert('country_translation', $languageDE($nlId, 'Niederlande')); |
||
| 273 | |||
| 274 | $noId = Uuid::randomBytes(); |
||
| 275 | $connection->insert('country', ['id' => $noId, 'iso' => 'NO', 'position' => 10, 'iso3' => 'NOR', 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 276 | $connection->insert('country_translation', $languageEN($noId, 'Norway')); |
||
| 277 | $connection->insert('country_translation', $languageDE($noId, 'Norwegen')); |
||
| 278 | |||
| 279 | $atId = Uuid::randomBytes(); |
||
| 280 | $connection->insert('country', ['id' => $atId, 'iso' => 'AT', 'position' => 10, 'active' => 1, 'iso3' => 'AUT', 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 281 | $connection->insert('country_translation', $languageEN($atId, 'Austria')); |
||
| 282 | $connection->insert('country_translation', $languageDE($atId, 'Österreich')); |
||
| 283 | |||
| 284 | $ptId = Uuid::randomBytes(); |
||
| 285 | $connection->insert('country', ['id' => $ptId, 'iso' => 'PT', 'position' => 10, 'iso3' => 'PRT', 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 286 | $connection->insert('country_translation', $languageEN($ptId, 'Portugal')); |
||
| 287 | $connection->insert('country_translation', $languageDE($ptId, 'Portugal')); |
||
| 288 | |||
| 289 | $seId = Uuid::randomBytes(); |
||
| 290 | $connection->insert('country', ['id' => $seId, 'iso' => 'SE', 'position' => 10, 'iso3' => 'SWE', 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 291 | $connection->insert('country_translation', $languageEN($seId, 'Sweden')); |
||
| 292 | $connection->insert('country_translation', $languageDE($seId, 'Schweden')); |
||
| 293 | |||
| 294 | $chId = Uuid::randomBytes(); |
||
| 295 | $connection->insert('country', ['id' => $chId, 'iso' => 'CH', 'position' => 10, 'tax_free' => 1, 'active' => 1, 'iso3' => 'CHE', 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 296 | $connection->insert('country_translation', $languageEN($chId, 'Switzerland')); |
||
| 297 | $connection->insert('country_translation', $languageDE($chId, 'Schweiz')); |
||
| 298 | |||
| 299 | $esId = Uuid::randomBytes(); |
||
| 300 | $connection->insert('country', ['id' => $esId, 'iso' => 'ES', 'position' => 10, 'active' => 1, 'iso3' => 'ESP', 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 301 | $connection->insert('country_translation', $languageEN($esId, 'Spain')); |
||
| 302 | $connection->insert('country_translation', $languageDE($esId, 'Spanien')); |
||
| 303 | |||
| 304 | $usId = Uuid::randomBytes(); |
||
| 305 | $connection->insert('country', ['id' => $usId, 'iso' => 'US', 'position' => 10, 'iso3' => 'USA', 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 306 | $connection->insert('country_translation', $languageEN($usId, 'USA')); |
||
| 307 | $connection->insert('country_translation', $languageDE($usId, 'USA')); |
||
| 308 | |||
| 309 | $this->createCountryStates($connection, $usId, 'US'); |
||
| 310 | |||
| 311 | $liId = Uuid::randomBytes(); |
||
| 312 | $connection->insert('country', ['id' => $liId, 'iso' => 'LI', 'position' => 10, 'iso3' => 'LIE', 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 313 | $connection->insert('country_translation', $languageEN($liId, 'Liechtenstein')); |
||
| 314 | $connection->insert('country_translation', $languageDE($liId, 'Liechtenstein')); |
||
| 315 | |||
| 316 | $aeId = Uuid::randomBytes(); |
||
| 317 | $connection->insert('country', ['id' => $aeId, 'iso' => 'AE', 'position' => 10, 'active' => 1, 'iso3' => 'ARE', 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 318 | $connection->insert('country_translation', $languageEN($aeId, 'Arab Emirates')); |
||
| 319 | $connection->insert('country_translation', $languageDE($aeId, 'Arabische Emirate')); |
||
| 320 | |||
| 321 | $plId = Uuid::randomBytes(); |
||
| 322 | $connection->insert('country', ['id' => $plId, 'iso' => 'PL', 'position' => 10, 'iso3' => 'POL', 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 323 | $connection->insert('country_translation', $languageEN($plId, 'Poland')); |
||
| 324 | $connection->insert('country_translation', $languageDE($plId, 'Polen')); |
||
| 325 | |||
| 326 | $huId = Uuid::randomBytes(); |
||
| 327 | $connection->insert('country', ['id' => $huId, 'iso' => 'HU', 'position' => 10, 'iso3' => 'HUN', 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 328 | $connection->insert('country_translation', $languageEN($huId, 'Hungary')); |
||
| 329 | $connection->insert('country_translation', $languageDE($huId, 'Ungarn')); |
||
| 330 | |||
| 331 | $trId = Uuid::randomBytes(); |
||
| 332 | $connection->insert('country', ['id' => $trId, 'iso' => 'TR', 'position' => 10, 'iso3' => 'TUR', 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 333 | $connection->insert('country_translation', $languageEN($trId, 'Turkey')); |
||
| 334 | $connection->insert('country_translation', $languageDE($trId, 'Türkei')); |
||
| 335 | |||
| 336 | $czId = Uuid::randomBytes(); |
||
| 337 | $connection->insert('country', ['id' => $czId, 'iso' => 'CZ', 'position' => 10, 'iso3' => 'CZE', 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 338 | $connection->insert('country_translation', $languageEN($czId, 'Czech Republic')); |
||
| 339 | $connection->insert('country_translation', $languageDE($czId, 'Tschechische Republik')); |
||
| 340 | |||
| 341 | $skId = Uuid::randomBytes(); |
||
| 342 | $connection->insert('country', ['id' => $skId, 'iso' => 'SK', 'position' => 10, 'iso3' => 'SVK', 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 343 | $connection->insert('country_translation', $languageEN($skId, 'Slovenia')); |
||
| 344 | $connection->insert('country_translation', $languageDE($skId, 'Slowenien')); |
||
| 345 | |||
| 346 | $roId = Uuid::randomBytes(); |
||
| 347 | $connection->insert('country', ['id' => $roId, 'iso' => 'RO', 'position' => 10, 'iso3' => 'ROU', 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 348 | $connection->insert('country_translation', $languageEN($roId, 'Romania')); |
||
| 349 | $connection->insert('country_translation', $languageDE($roId, 'Rumänien')); |
||
| 350 | |||
| 351 | $brId = Uuid::randomBytes(); |
||
| 352 | $connection->insert('country', ['id' => $brId, 'iso' => 'BR', 'position' => 10, 'iso3' => 'BRA', 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 353 | $connection->insert('country_translation', $languageEN($brId, 'Brazil')); |
||
| 354 | $connection->insert('country_translation', $languageDE($brId, 'Brasilien')); |
||
| 355 | |||
| 356 | $ilId = Uuid::randomBytes(); |
||
| 357 | $connection->insert('country', ['id' => $ilId, 'iso' => 'IL', 'position' => 10, 'iso3' => 'ISR', 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 358 | $connection->insert('country_translation', $languageEN($ilId, 'Isreal')); |
||
| 359 | $connection->insert('country_translation', $languageDE($ilId, 'Isreal')); |
||
| 360 | |||
| 361 | $auId = Uuid::randomBytes(); |
||
| 362 | $connection->insert('country', ['id' => $auId, 'iso' => 'AU', 'position' => 10, 'active' => 1, 'iso3' => 'AUS', 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 363 | $connection->insert('country_translation', $languageEN($auId, 'Australia')); |
||
| 364 | $connection->insert('country_translation', $languageDE($auId, 'Australien')); |
||
| 365 | |||
| 366 | $beId = Uuid::randomBytes(); |
||
| 367 | $connection->insert('country', ['id' => $beId, 'iso' => 'BE', 'position' => 10, 'active' => 1, 'iso3' => 'BEL', 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 368 | $connection->insert('country_translation', $languageEN($beId, 'Belgium')); |
||
| 369 | $connection->insert('country_translation', $languageDE($beId, 'Belgien')); |
||
| 370 | |||
| 371 | $dkId = Uuid::randomBytes(); |
||
| 372 | $connection->insert('country', ['id' => $dkId, 'iso' => 'DK', 'position' => 10, 'active' => 1, 'iso3' => 'DNK', 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 373 | $connection->insert('country_translation', $languageEN($dkId, 'Denmark')); |
||
| 374 | $connection->insert('country_translation', $languageDE($dkId, 'Dänemark')); |
||
| 375 | |||
| 376 | $fiId = Uuid::randomBytes(); |
||
| 377 | $connection->insert('country', ['id' => $fiId, 'iso' => 'FI', 'position' => 10, 'active' => 1, 'iso3' => 'FIN', 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 378 | $connection->insert('country_translation', $languageEN($fiId, 'Finland')); |
||
| 379 | $connection->insert('country_translation', $languageDE($fiId, 'Finnland')); |
||
| 380 | |||
| 381 | $frId = Uuid::randomBytes(); |
||
| 382 | $connection->insert('country', ['id' => $frId, 'iso' => 'FR', 'position' => 10, 'iso3' => 'FRA', 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 383 | $connection->insert('country_translation', $languageEN($frId, 'France')); |
||
| 384 | $connection->insert('country_translation', $languageDE($frId, 'Frankreich')); |
||
| 385 | } |
||
| 386 | |||
| 387 | private function createCountryStates(Connection $connection, string $countryId, string $countryCode): void |
||
| 388 | { |
||
| 389 | $data = [ |
||
| 390 | 'US' => [ |
||
| 391 | 'US-AL' => 'Alabama', |
||
| 392 | 'US-AK' => 'Alaska', |
||
| 393 | 'US-AZ' => 'Arizona', |
||
| 394 | 'US-AR' => 'Arkansas', |
||
| 395 | 'US-CA' => 'California', |
||
| 396 | 'US-CO' => 'Colorado', |
||
| 397 | 'US-CT' => 'Connecticut', |
||
| 398 | 'US-DE' => 'Delaware', |
||
| 399 | 'US-FL' => 'Florida', |
||
| 400 | 'US-GA' => 'Georgia', |
||
| 401 | 'US-HI' => 'Hawaii', |
||
| 402 | 'US-ID' => 'Idaho', |
||
| 403 | 'US-IL' => 'Illinois', |
||
| 404 | 'US-IN' => 'Indiana', |
||
| 405 | 'US-IA' => 'Iowa', |
||
| 406 | 'US-KS' => 'Kansas', |
||
| 407 | 'US-KY' => 'Kentucky', |
||
| 408 | 'US-LA' => 'Louisiana', |
||
| 409 | 'US-ME' => 'Maine', |
||
| 410 | 'US-MD' => 'Maryland', |
||
| 411 | 'US-MA' => 'Massachusetts', |
||
| 412 | 'US-MI' => 'Michigan', |
||
| 413 | 'US-MN' => 'Minnesota', |
||
| 414 | 'US-MS' => 'Mississippi', |
||
| 415 | 'US-MO' => 'Missouri', |
||
| 416 | 'US-MT' => 'Montana', |
||
| 417 | 'US-NE' => 'Nebraska', |
||
| 418 | 'US-NV' => 'Nevada', |
||
| 419 | 'US-NH' => 'New Hampshire', |
||
| 420 | 'US-NJ' => 'New Jersey', |
||
| 421 | 'US-NM' => 'New Mexico', |
||
| 422 | 'US-NY' => 'New York', |
||
| 423 | 'US-NC' => 'North Carolina', |
||
| 424 | 'US-ND' => 'North Dakota', |
||
| 425 | 'US-OH' => 'Ohio', |
||
| 426 | 'US-OK' => 'Oklahoma', |
||
| 427 | 'US-OR' => 'Oregon', |
||
| 428 | 'US-PA' => 'Pennsylvania', |
||
| 429 | 'US-RI' => 'Rhode Island', |
||
| 430 | 'US-SC' => 'South Carolina', |
||
| 431 | 'US-SD' => 'South Dakota', |
||
| 432 | 'US-TN' => 'Tennessee', |
||
| 433 | 'US-TX' => 'Texas', |
||
| 434 | 'US-UT' => 'Utah', |
||
| 435 | 'US-VT' => 'Vermont', |
||
| 436 | 'US-VA' => 'Virginia', |
||
| 437 | 'US-WA' => 'Washington', |
||
| 438 | 'US-WV' => 'West Virginia', |
||
| 439 | 'US-WI' => 'Wisconsin', |
||
| 440 | 'US-WY' => 'Wyoming', |
||
| 441 | 'US-DC' => 'District of Columbia', |
||
| 442 | ], |
||
| 443 | 'DE' => [ |
||
| 444 | 'DE-BW' => 'Baden-Württemberg', |
||
| 445 | 'DE-BY' => 'Bavaria', |
||
| 446 | 'DE-BE' => 'Berlin', |
||
| 447 | 'DE-BB' => 'Brandenburg', |
||
| 448 | 'DE-HB' => 'Bremen', |
||
| 449 | 'DE-HH' => 'Hamburg', |
||
| 450 | 'DE-HE' => 'Hesse', |
||
| 451 | 'DE-NI' => 'Lower Saxony', |
||
| 452 | 'DE-MV' => 'Mecklenburg-Western Pomerania', |
||
| 453 | 'DE-NW' => 'North Rhine-Westphalia', |
||
| 454 | 'DE-RP' => 'Rhineland-Palatinate', |
||
| 455 | 'DE-SL' => 'Saarland', |
||
| 456 | 'DE-SN' => 'Saxony', |
||
| 457 | 'DE-ST' => 'Saxony-Anhalt', |
||
| 458 | 'DE-SH' => 'Schleswig-Holstein', |
||
| 459 | 'DE-TH' => 'Thuringia', |
||
| 460 | ], |
||
| 461 | 'GB' => [ |
||
| 462 | 'GB-ENG' => 'England', |
||
| 463 | 'GB-NIR' => 'Northern Ireland', |
||
| 464 | 'GB-SCT' => 'Scotland', |
||
| 465 | 'GB-WLS' => 'Wales', |
||
| 466 | |||
| 467 | 'GB-EAW' => 'England and Wales', |
||
| 468 | 'GB-GBN' => 'Great Britain', |
||
| 469 | 'GB-UKM' => 'United Kingdom', |
||
| 470 | |||
| 471 | 'GB-BKM' => 'Buckinghamshire', |
||
| 472 | 'GB-CAM' => 'Cambridgeshire', |
||
| 473 | 'GB-CMA' => 'Cumbria', |
||
| 474 | 'GB-DBY' => 'Derbyshire', |
||
| 475 | 'GB-DEV' => 'Devon', |
||
| 476 | 'GB-DOR' => 'Dorset', |
||
| 477 | 'GB-ESX' => 'East Sussex', |
||
| 478 | 'GB-ESS' => 'Essex', |
||
| 479 | 'GB-GLS' => 'Gloucestershire', |
||
| 480 | 'GB-HAM' => 'Hampshire', |
||
| 481 | 'GB-HRT' => 'Hertfordshire', |
||
| 482 | 'GB-KEN' => 'Kent', |
||
| 483 | 'GB-LAN' => 'Lancashire', |
||
| 484 | 'GB-LEC' => 'Leicestershire', |
||
| 485 | 'GB-LIN' => 'Lincolnshire', |
||
| 486 | 'GB-NFK' => 'Norfolk', |
||
| 487 | 'GB-NYK' => 'North Yorkshire', |
||
| 488 | 'GB-NTH' => 'Northamptonshire', |
||
| 489 | 'GB-NTT' => 'Nottinghamshire', |
||
| 490 | 'GB-OXF' => 'Oxfordshire', |
||
| 491 | 'GB-SOM' => 'Somerset', |
||
| 492 | 'GB-STS' => 'Staffordshire', |
||
| 493 | 'GB-SFK' => 'Suffolk', |
||
| 494 | 'GB-SRY' => 'Surrey', |
||
| 495 | 'GB-WAR' => 'Warwickshire', |
||
| 496 | 'GB-WSX' => 'West Sussex', |
||
| 497 | 'GB-WOR' => 'Worcestershire', |
||
| 498 | 'GB-LND' => 'London, City of', |
||
| 499 | 'GB-BDG' => 'Barking and Dagenham', |
||
| 500 | 'GB-BNE' => 'Barnet', |
||
| 501 | 'GB-BEX' => 'Bexley', |
||
| 502 | 'GB-BEN' => 'Brent', |
||
| 503 | 'GB-BRY' => 'Bromley', |
||
| 504 | 'GB-CMD' => 'Camden', |
||
| 505 | 'GB-CRY' => 'Croydon', |
||
| 506 | 'GB-EAL' => 'Ealing', |
||
| 507 | 'GB-ENF' => 'Enfield', |
||
| 508 | 'GB-GRE' => 'Greenwich', |
||
| 509 | 'GB-HCK' => 'Hackney', |
||
| 510 | 'GB-HMF' => 'Hammersmith and Fulham', |
||
| 511 | 'GB-HRY' => 'Haringey', |
||
| 512 | 'GB-HRW' => 'Harrow', |
||
| 513 | 'GB-HAV' => 'Havering', |
||
| 514 | 'GB-HIL' => 'Hillingdon', |
||
| 515 | 'GB-HNS' => 'Hounslow', |
||
| 516 | 'GB-ISL' => 'Islington', |
||
| 517 | 'GB-KEC' => 'Kensington and Chelsea', |
||
| 518 | 'GB-KTT' => 'Kingston upon Thames', |
||
| 519 | 'GB-LBH' => 'Lambeth', |
||
| 520 | 'GB-LEW' => 'Lewisham', |
||
| 521 | 'GB-MRT' => 'Merton', |
||
| 522 | 'GB-NWM' => 'Newham', |
||
| 523 | 'GB-RDB' => 'Redbridge', |
||
| 524 | 'GB-RIC' => 'Richmond upon Thames', |
||
| 525 | 'GB-SWK' => 'Southwark', |
||
| 526 | 'GB-STN' => 'Sutton', |
||
| 527 | 'GB-TWH' => 'Tower Hamlets', |
||
| 528 | 'GB-WFT' => 'Waltham Forest', |
||
| 529 | 'GB-WND' => 'Wandsworth', |
||
| 530 | 'GB-WSM' => 'Westminster', |
||
| 531 | 'GB-BNS' => 'Barnsley', |
||
| 532 | 'GB-BIR' => 'Birmingham', |
||
| 533 | 'GB-BOL' => 'Bolton', |
||
| 534 | 'GB-BRD' => 'Bradford', |
||
| 535 | 'GB-BUR' => 'Bury', |
||
| 536 | 'GB-CLD' => 'Calderdale', |
||
| 537 | 'GB-COV' => 'Coventry', |
||
| 538 | 'GB-DNC' => 'Doncaster', |
||
| 539 | 'GB-DUD' => 'Dudley', |
||
| 540 | 'GB-GAT' => 'Gateshead', |
||
| 541 | 'GB-KIR' => 'Kirklees', |
||
| 542 | 'GB-KWL' => 'Knowsley', |
||
| 543 | 'GB-LDS' => 'Leeds', |
||
| 544 | 'GB-LIV' => 'Liverpool', |
||
| 545 | 'GB-MAN' => 'Manchester', |
||
| 546 | 'GB-NET' => 'Newcastle upon Tyne', |
||
| 547 | 'GB-NTY' => 'North Tyneside', |
||
| 548 | 'GB-OLD' => 'Oldham', |
||
| 549 | 'GB-RCH' => 'Rochdale', |
||
| 550 | 'GB-ROT' => 'Rotherham', |
||
| 551 | 'GB-SHN' => 'St. Helens', |
||
| 552 | 'GB-SLF' => 'Salford', |
||
| 553 | 'GB-SAW' => 'Sandwell', |
||
| 554 | 'GB-SFT' => 'Sefton', |
||
| 555 | 'GB-SHF' => 'Sheffield', |
||
| 556 | 'GB-SOL' => 'Solihull', |
||
| 557 | 'GB-STY' => 'South Tyneside', |
||
| 558 | 'GB-SKP' => 'Stockport', |
||
| 559 | 'GB-SND' => 'Sunderland', |
||
| 560 | 'GB-TAM' => 'Tameside', |
||
| 561 | 'GB-TRF' => 'Trafford', |
||
| 562 | 'GB-WKF' => 'Wakefield', |
||
| 563 | 'GB-WLL' => 'Walsall', |
||
| 564 | 'GB-WGN' => 'Wigan', |
||
| 565 | 'GB-WRL' => 'Wirral', |
||
| 566 | 'GB-WLV' => 'Wolverhampton', |
||
| 567 | 'GB-BAS' => 'Bath and North East Somerset', |
||
| 568 | 'GB-BDF' => 'Bedford', |
||
| 569 | 'GB-BBD' => 'Blackburn with Darwen', |
||
| 570 | 'GB-BPL' => 'Blackpool', |
||
| 571 | 'GB-BMH' => 'Bournemouth', |
||
| 572 | 'GB-BRC' => 'Bracknell Forest', |
||
| 573 | 'GB-BNH' => 'Brighton and Hove', |
||
| 574 | 'GB-BST' => 'Bristol, City of', |
||
| 575 | 'GB-CBF' => 'Central Bedfordshire', |
||
| 576 | 'GB-CHE' => 'Cheshire East', |
||
| 577 | 'GB-CHW' => 'Cheshire West and Chester', |
||
| 578 | 'GB-CON' => 'Cornwall', |
||
| 579 | 'GB-DAL' => 'Darlington', |
||
| 580 | 'GB-DER' => 'Derby', |
||
| 581 | 'GB-DUR' => 'Durham County', |
||
| 582 | 'GB-ERY' => 'East Riding of Yorkshire', |
||
| 583 | 'GB-HAL' => 'Halton', |
||
| 584 | 'GB-HPL' => 'Hartlepool', |
||
| 585 | 'GB-HEF' => 'Herefordshire', |
||
| 586 | 'GB-IOW' => 'Isle of Wight', |
||
| 587 | 'GB-IOS' => 'Isles of Scilly', |
||
| 588 | 'GB-KHL' => 'Kingston upon Hull', |
||
| 589 | 'GB-LCE' => 'Leicester', |
||
| 590 | 'GB-LUT' => 'Luton', |
||
| 591 | 'GB-MDW' => 'Medway', |
||
| 592 | 'GB-MDB' => 'Middlesbrough', |
||
| 593 | 'GB-MIK' => 'Milton Keynes', |
||
| 594 | 'GB-NEL' => 'North East Lincolnshire', |
||
| 595 | 'GB-NLN' => 'North Lincolnshire', |
||
| 596 | 'GB-NSM' => 'North Somerset', |
||
| 597 | 'GB-NBL' => 'Northumberland', |
||
| 598 | 'GB-NGM' => 'Nottingham', |
||
| 599 | 'GB-PTE' => 'Peterborough', |
||
| 600 | 'GB-PLY' => 'Plymouth', |
||
| 601 | 'GB-POL' => 'Poole', |
||
| 602 | 'GB-POR' => 'Portsmouth', |
||
| 603 | 'GB-RDG' => 'Reading', |
||
| 604 | 'GB-RCC' => 'Redcar and Cleveland', |
||
| 605 | 'GB-RUT' => 'Rutland', |
||
| 606 | 'GB-SHR' => 'Shropshire', |
||
| 607 | 'GB-SLG' => 'Slough', |
||
| 608 | 'GB-SGC' => 'South Gloucestershire', |
||
| 609 | 'GB-STH' => 'Southampton', |
||
| 610 | 'GB-SOS' => 'Southend-on-Sea', |
||
| 611 | 'GB-STT' => 'Stockton-on-Tees', |
||
| 612 | 'GB-STE' => 'Stoke-on-Trent', |
||
| 613 | 'GB-SWD' => 'Swindon', |
||
| 614 | 'GB-TFW' => 'Telford and Wrekin', |
||
| 615 | 'GB-THR' => 'Thurrock', |
||
| 616 | 'GB-TOB' => 'Torbay', |
||
| 617 | 'GB-WRT' => 'Warrington', |
||
| 618 | 'GB-WBK' => 'West Berkshire', |
||
| 619 | 'GB-WIL' => 'Wiltshire', |
||
| 620 | 'GB-WNM' => 'Windsor and Maidenhead', |
||
| 621 | 'GB-WOK' => 'Wokingham', |
||
| 622 | 'GB-YOR' => 'York', |
||
| 623 | 'GB-ANN' => 'Antrim and Newtownabbey', |
||
| 624 | 'GB-AND' => 'Ards and North Down', |
||
| 625 | 'GB-ABC' => 'Armagh, Banbridge and Craigavon', |
||
| 626 | 'GB-BFS' => 'Belfast', |
||
| 627 | 'GB-CCG' => 'Causeway Coast and Glens', |
||
| 628 | 'GB-DRS' => 'Derry and Strabane', |
||
| 629 | 'GB-FMO' => 'Fermanagh and Omagh', |
||
| 630 | 'GB-LBC' => 'Lisburn and Castlereagh', |
||
| 631 | 'GB-MEA' => 'Mid and East Antrim', |
||
| 632 | 'GB-MUL' => 'Mid Ulster', |
||
| 633 | 'GB-NMD' => 'Newry, Mourne and Down', |
||
| 634 | 'GB-ABE' => 'Aberdeen City', |
||
| 635 | 'GB-ABD' => 'Aberdeenshire', |
||
| 636 | 'GB-ANS' => 'Angus', |
||
| 637 | 'GB-AGB' => 'Argyll and Bute', |
||
| 638 | 'GB-CLK' => 'Clackmannanshire', |
||
| 639 | 'GB-DGY' => 'Dumfries and Galloway', |
||
| 640 | 'GB-DND' => 'Dundee City', |
||
| 641 | 'GB-EAY' => 'East Ayrshire', |
||
| 642 | 'GB-EDU' => 'East Dunbartonshire', |
||
| 643 | 'GB-ELN' => 'East Lothian', |
||
| 644 | 'GB-ERW' => 'East Renfrewshire', |
||
| 645 | 'GB-EDH' => 'Edinburgh, City of', |
||
| 646 | 'GB-ELS' => 'Eilean Siar', |
||
| 647 | 'GB-FAL' => 'Falkirk', |
||
| 648 | 'GB-FIF' => 'Fife', |
||
| 649 | 'GB-GLG' => 'Glasgow City', |
||
| 650 | 'GB-HLD' => 'Highland', |
||
| 651 | 'GB-IVC' => 'Inverclyde', |
||
| 652 | 'GB-MLN' => 'Midlothian', |
||
| 653 | 'GB-MRY' => 'Moray', |
||
| 654 | 'GB-NAY' => 'North Ayrshire', |
||
| 655 | 'GB-NLK' => 'North Lanarkshire', |
||
| 656 | 'GB-ORK' => 'Orkney Islands', |
||
| 657 | 'GB-PKN' => 'Perth and Kinross', |
||
| 658 | 'GB-RFW' => 'Renfrewshire', |
||
| 659 | 'GB-SCB' => 'Scottish Borders, The', |
||
| 660 | 'GB-ZET' => 'Shetland Islands', |
||
| 661 | 'GB-SAY' => 'South Ayrshire', |
||
| 662 | 'GB-SLK' => 'South Lanarkshire', |
||
| 663 | 'GB-STG' => 'Stirling', |
||
| 664 | 'GB-WDU' => 'West Dunbartonshire', |
||
| 665 | 'GB-WLN' => 'West Lothian', |
||
| 666 | 'GB-BGW' => 'Blaenau Gwent', |
||
| 667 | 'GB-BGE' => 'Bridgend', |
||
| 668 | 'GB-CAY' => 'Caerphilly', |
||
| 669 | 'GB-CRF' => 'Cardiff', |
||
| 670 | 'GB-CMN' => 'Carmarthenshire', |
||
| 671 | 'GB-CGN' => 'Ceredigion', |
||
| 672 | 'GB-CWY' => 'Conwy', |
||
| 673 | 'GB-DEN' => 'Denbighshire', |
||
| 674 | 'GB-FLN' => 'Flintshire', |
||
| 675 | 'GB-GWN' => 'Gwynedd', |
||
| 676 | 'GB-AGY' => 'Isle of Anglesey', |
||
| 677 | 'GB-MTY' => 'Merthyr Tydfil', |
||
| 678 | 'GB-MON' => 'Monmouthshire', |
||
| 679 | 'GB-NTL' => 'Neath Port Talbot', |
||
| 680 | 'GB-NWP' => 'Newport', |
||
| 681 | 'GB-PEM' => 'Pembrokeshire', |
||
| 682 | 'GB-POW' => 'Powys', |
||
| 683 | 'GB-RCT' => 'Rhondda, Cynon, Taff', |
||
| 684 | 'GB-SWA' => 'Swansea', |
||
| 685 | 'GB-TOF' => 'Torfaen', |
||
| 686 | 'GB-VGL' => 'Vale of Glamorgan, The', |
||
| 687 | 'GB-WRX' => 'Wrexham', |
||
| 688 | ], |
||
| 689 | ]; |
||
| 690 | $germanTranslations = [ |
||
| 691 | 'DE' => [ |
||
| 692 | 'DE-BW' => 'Baden-Württemberg', |
||
| 693 | 'DE-BY' => 'Bayern', |
||
| 694 | 'DE-BE' => 'Berlin', |
||
| 695 | 'DE-BB' => 'Brandenburg', |
||
| 696 | 'DE-HB' => 'Bremen', |
||
| 697 | 'DE-HH' => 'Hamburg', |
||
| 698 | 'DE-HE' => 'Hessen', |
||
| 699 | 'DE-NI' => 'Niedersachsen', |
||
| 700 | 'DE-MV' => 'Mecklenburg-Vorpommern', |
||
| 701 | 'DE-NW' => 'Nordrhein-Westfalen', |
||
| 702 | 'DE-RP' => 'Rheinland-Pfalz', |
||
| 703 | 'DE-SL' => 'Saarland', |
||
| 704 | 'DE-SN' => 'Sachsen', |
||
| 705 | 'DE-ST' => 'Sachsen-Anhalt', |
||
| 706 | 'DE-SH' => 'Schleswig-Holstein', |
||
| 707 | 'DE-TH' => 'Thüringen', |
||
| 708 | ], |
||
| 709 | ]; |
||
| 710 | |||
| 711 | foreach ($data[$countryCode] as $isoCode => $name) { |
||
| 712 | $storageDate = date(Defaults::STORAGE_DATE_FORMAT); |
||
| 713 | $id = Uuid::randomBytes(); |
||
| 714 | $countryStateData = [ |
||
| 715 | 'id' => $id, |
||
| 716 | 'country_id' => $countryId, |
||
| 717 | 'short_code' => $isoCode, |
||
| 718 | 'created_at' => $storageDate, |
||
| 719 | ]; |
||
| 720 | $connection->insert('country_state', $countryStateData); |
||
| 721 | $connection->insert('country_state_translation', [ |
||
| 722 | 'language_id' => Uuid::fromHexToBytes(Defaults::LANGUAGE_SYSTEM), |
||
| 723 | 'country_state_id' => $id, |
||
| 724 | 'name' => $name, |
||
| 725 | 'created_at' => $storageDate, |
||
| 726 | ]); |
||
| 727 | |||
| 728 | if (isset($germanTranslations[$countryCode])) { |
||
| 729 | $connection->insert('country_state_translation', [ |
||
| 730 | 'language_id' => Uuid::fromHexToBytes(Defaults::LANGUAGE_SYSTEM_DE), |
||
| 731 | 'country_state_id' => $id, |
||
| 732 | 'name' => $name, |
||
| 733 | 'created_at' => $storageDate, |
||
| 734 | ]); |
||
| 735 | } |
||
| 736 | } |
||
| 737 | } |
||
| 738 | |||
| 739 | private function createCurrency(Connection $connection): void |
||
| 740 | { |
||
| 741 | $EUR = Uuid::fromHexToBytes(Defaults::CURRENCY); |
||
| 742 | $USD = Uuid::randomBytes(); |
||
| 743 | $GBP = Uuid::randomBytes(); |
||
| 744 | |||
| 745 | $languageEN = Uuid::fromHexToBytes(Defaults::LANGUAGE_SYSTEM); |
||
| 746 | |||
| 747 | $connection->insert('currency', ['id' => $EUR, 'iso_code' => 'EUR', 'factor' => 1, 'symbol' => '€', 'position' => 1, 'decimal_precision' => 2, 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 748 | $connection->insert('currency_translation', ['currency_id' => $EUR, 'language_id' => $languageEN, 'short_name' => 'EUR', 'name' => 'Euro', 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 749 | |||
| 750 | $connection->insert('currency', ['id' => $USD, 'iso_code' => 'USD', 'factor' => 1.17085, 'symbol' => '$', 'position' => 1, 'decimal_precision' => 2, 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 751 | $connection->insert('currency_translation', ['currency_id' => $USD, 'language_id' => $languageEN, 'short_name' => 'USD', 'name' => 'US-Dollar', 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 752 | |||
| 753 | $connection->insert('currency', ['id' => $GBP, 'iso_code' => 'GBP', 'factor' => 0.89157, 'symbol' => '£', 'position' => 1, 'decimal_precision' => 2, 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 754 | $connection->insert('currency_translation', ['currency_id' => $GBP, 'language_id' => $languageEN, 'short_name' => 'GBP', 'name' => 'Pound', 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 755 | } |
||
| 756 | |||
| 757 | private function createCustomerGroup(Connection $connection): void |
||
| 758 | { |
||
| 759 | $connection->insert('customer_group', ['id' => Uuid::fromHexToBytes(Defaults::FALLBACK_CUSTOMER_GROUP), 'display_gross' => 1, 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 760 | $connection->insert('customer_group_translation', ['customer_group_id' => Uuid::fromHexToBytes(Defaults::FALLBACK_CUSTOMER_GROUP), 'language_id' => Uuid::fromHexToBytes(Defaults::LANGUAGE_SYSTEM), 'name' => 'Standard customer group', 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 761 | $connection->insert('customer_group_translation', ['customer_group_id' => Uuid::fromHexToBytes(Defaults::FALLBACK_CUSTOMER_GROUP), 'language_id' => Uuid::fromHexToBytes(Defaults::LANGUAGE_SYSTEM_DE), 'name' => 'Standard-Kundengruppe', 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 762 | } |
||
| 763 | |||
| 764 | private function createPaymentMethod(Connection $connection): void |
||
| 765 | { |
||
| 766 | $languageEN = Uuid::fromHexToBytes(Defaults::LANGUAGE_SYSTEM); |
||
| 767 | |||
| 768 | $ruleId = Uuid::randomBytes(); |
||
| 769 | $connection->insert('rule', ['id' => $ruleId, 'name' => 'Cart >= 0 (Payment)', 'priority' => 100, 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 770 | $connection->insert('rule_condition', ['id' => Uuid::randomBytes(), 'rule_id' => $ruleId, 'type' => 'cartCartAmount', 'value' => json_encode(['operator' => '>=', 'amount' => 0]), 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 771 | |||
| 772 | $debit = Uuid::randomBytes(); |
||
| 773 | $connection->insert('payment_method', ['id' => $debit, 'handler_identifier' => DebitPayment::class, 'position' => 4, 'active' => 0, 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 774 | $connection->insert('payment_method_translation', ['payment_method_id' => $debit, 'language_id' => $languageEN, 'name' => 'Direct Debit', 'description' => 'Additional text', 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 775 | |||
| 776 | $invoice = Uuid::randomBytes(); |
||
| 777 | $connection->insert('payment_method', ['id' => $invoice, 'handler_identifier' => InvoicePayment::class, 'position' => 5, 'active' => 1, 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 778 | $connection->insert('payment_method_translation', ['payment_method_id' => $invoice, 'language_id' => $languageEN, 'name' => 'Invoice', 'description' => 'Payment by invoice. Shopware provides automatic invoicing for all customers on orders after the first, in order to avoid defaults on payment.', 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 779 | |||
| 780 | $cash = Uuid::randomBytes(); |
||
| 781 | $connection->insert('payment_method', ['id' => $cash, 'handler_identifier' => CashPayment::class, 'position' => 1, 'active' => 1, 'created_at' => (new \DateTime())->format(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 782 | $connection->insert('payment_method_translation', ['payment_method_id' => $cash, 'language_id' => $languageEN, 'name' => 'Cash on delivery', 'description' => 'Pay when you get the order', 'created_at' => (new \DateTime())->format(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 783 | |||
| 784 | $pre = Uuid::randomBytes(); |
||
| 785 | $connection->insert('payment_method', ['id' => $pre, 'handler_identifier' => PrePayment::class, 'position' => 2, 'active' => 1, 'created_at' => (new \DateTime())->format(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 786 | $connection->insert('payment_method_translation', ['payment_method_id' => $pre, 'language_id' => $languageEN, 'name' => 'Paid in advance', 'description' => 'Pay in advance and get your order afterwards', 'created_at' => (new \DateTime())->format(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 787 | } |
||
| 788 | |||
| 789 | private function createShippingMethod(Connection $connection): void |
||
| 790 | { |
||
| 791 | $deliveryTimeId = $this->createDeliveryTimes($connection); |
||
| 792 | $standard = Uuid::randomBytes(); |
||
| 793 | $express = Uuid::randomBytes(); |
||
| 794 | |||
| 795 | $ruleId = Uuid::randomBytes(); |
||
| 796 | |||
| 797 | $connection->insert('rule', ['id' => $ruleId, 'name' => 'Cart >= 0', 'priority' => 100, 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 798 | $connection->insert('rule_condition', ['id' => Uuid::randomBytes(), 'rule_id' => $ruleId, 'type' => 'cartCartAmount', 'value' => json_encode(['operator' => '>=', 'amount' => 0]), 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 799 | |||
| 800 | $languageEN = Uuid::fromHexToBytes(Defaults::LANGUAGE_SYSTEM); |
||
| 801 | |||
| 802 | $connection->insert('shipping_method', ['id' => $standard, 'active' => 1, 'availability_rule_id' => $ruleId, 'delivery_time_id' => $deliveryTimeId, 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 803 | $connection->insert('shipping_method_translation', ['shipping_method_id' => $standard, 'language_id' => $languageEN, 'name' => 'Standard', 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 804 | $connection->insert('shipping_method_price', ['id' => Uuid::randomBytes(), 'shipping_method_id' => $standard, 'calculation' => 1, 'currency_id' => Uuid::fromHexToBytes(Defaults::CURRENCY), 'price' => 0, 'quantity_start' => 0, 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 805 | |||
| 806 | $connection->insert('shipping_method', ['id' => $express, 'active' => 1, 'availability_rule_id' => $ruleId, 'delivery_time_id' => $deliveryTimeId, 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 807 | $connection->insert('shipping_method_translation', ['shipping_method_id' => $express, 'language_id' => $languageEN, 'name' => 'Express', 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 808 | $connection->insert('shipping_method_price', ['id' => Uuid::randomBytes(), 'shipping_method_id' => $express, 'calculation' => 1, 'currency_id' => Uuid::fromHexToBytes(Defaults::CURRENCY), 'price' => 0, 'quantity_start' => 0, 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 809 | } |
||
| 810 | |||
| 811 | private function createTax(Connection $connection): void |
||
| 812 | { |
||
| 813 | $tax19 = Uuid::randomBytes(); |
||
| 814 | $tax7 = Uuid::randomBytes(); |
||
| 815 | |||
| 816 | $connection->insert('tax', ['id' => $tax19, 'tax_rate' => 19, 'name' => '19%', 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 817 | $connection->insert('tax', ['id' => $tax7, 'tax_rate' => 7, 'name' => '7%', 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 818 | } |
||
| 819 | |||
| 820 | private function createSalesChannelTypes(Connection $connection): void |
||
| 821 | { |
||
| 822 | $languageEN = Uuid::fromHexToBytes(Defaults::LANGUAGE_SYSTEM); |
||
| 823 | |||
| 824 | $storefront = Uuid::fromHexToBytes(Defaults::SALES_CHANNEL_TYPE_STOREFRONT); |
||
| 825 | $storefrontApi = Uuid::fromHexToBytes(Defaults::SALES_CHANNEL_TYPE_API); |
||
| 826 | |||
| 827 | $connection->insert('sales_channel_type', ['id' => $storefront, 'icon_name' => 'default-building-shop', 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 828 | $connection->insert('sales_channel_type_translation', ['sales_channel_type_id' => $storefront, 'language_id' => $languageEN, 'name' => 'Storefront', 'manufacturer' => 'shopware AG', 'description' => 'Sales channel with HTML storefront', 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 829 | |||
| 830 | $connection->insert('sales_channel_type', ['id' => $storefrontApi, 'icon_name' => 'default-shopping-basket', 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 831 | $connection->insert('sales_channel_type_translation', ['sales_channel_type_id' => $storefrontApi, 'language_id' => $languageEN, 'name' => 'Headless', 'manufacturer' => 'shopware AG', 'description' => 'API only sales channel', 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 832 | } |
||
| 833 | |||
| 834 | private function createProductManufacturer(Connection $connection): void |
||
| 835 | { |
||
| 836 | $id = Uuid::randomBytes(); |
||
| 837 | $languageEN = Uuid::fromHexToBytes(Defaults::LANGUAGE_SYSTEM); |
||
| 838 | $versionId = Uuid::fromHexToBytes(Defaults::LIVE_VERSION); |
||
| 839 | |||
| 840 | $connection->insert('product_manufacturer', ['id' => $id, 'version_id' => $versionId, 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 841 | $connection->insert('product_manufacturer_translation', ['product_manufacturer_id' => $id, 'product_manufacturer_version_id' => $versionId, 'language_id' => $languageEN, 'name' => 'shopware AG', 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 842 | } |
||
| 843 | |||
| 844 | private function createRootCategory(Connection $connection): void |
||
| 845 | { |
||
| 846 | $id = Uuid::randomBytes(); |
||
| 847 | $languageEN = Uuid::fromHexToBytes(Defaults::LANGUAGE_SYSTEM); |
||
| 848 | $versionId = Uuid::fromHexToBytes(Defaults::LIVE_VERSION); |
||
| 849 | |||
| 850 | $connection->insert('category', ['id' => $id, 'version_id' => $versionId, 'type' => CategoryDefinition::TYPE_PAGE, 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 851 | $connection->insert('category_translation', ['category_id' => $id, 'category_version_id' => $versionId, 'language_id' => $languageEN, 'name' => 'Catalogue #1', 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 852 | } |
||
| 853 | |||
| 854 | private function createSalesChannel(Connection $connection): void |
||
| 855 | { |
||
| 856 | $currencies = $connection->executeQuery('SELECT id FROM currency')->fetchAll(FetchMode::COLUMN); |
||
| 857 | $languages = $connection->executeQuery('SELECT id FROM language')->fetchAll(FetchMode::COLUMN); |
||
| 858 | $shippingMethods = $connection->executeQuery('SELECT id FROM shipping_method')->fetchAll(FetchMode::COLUMN); |
||
| 859 | $paymentMethods = $connection->executeQuery('SELECT id FROM payment_method')->fetchAll(FetchMode::COLUMN); |
||
| 860 | $defaultPaymentMethod = $connection->executeQuery('SELECT id FROM payment_method WHERE active = 1 ORDER BY `position`')->fetchColumn(); |
||
| 861 | $defaultShippingMethod = $connection->executeQuery('SELECT id FROM shipping_method WHERE active = 1')->fetchColumn(); |
||
| 862 | $countryStatement = $connection->executeQuery('SELECT id FROM country WHERE active = 1 ORDER BY `position`'); |
||
| 863 | $defaultCountry = $countryStatement->fetchColumn(); |
||
| 864 | $rootCategoryId = $connection->executeQuery('SELECT id FROM category')->fetchColumn(); |
||
| 865 | |||
| 866 | $id = Uuid::fromHexToBytes(Defaults::SALES_CHANNEL); |
||
| 867 | $languageEN = Uuid::fromHexToBytes(Defaults::LANGUAGE_SYSTEM); |
||
| 868 | |||
| 869 | $connection->insert('sales_channel', [ |
||
| 870 | 'id' => $id, |
||
| 871 | 'type_id' => Uuid::fromHexToBytes(Defaults::SALES_CHANNEL_TYPE_API), |
||
| 872 | 'access_key' => AccessKeyHelper::generateAccessKey('sales-channel'), |
||
| 873 | 'active' => 1, |
||
| 874 | 'tax_calculation_type' => 'vertical', |
||
| 875 | 'language_id' => Uuid::fromHexToBytes(Defaults::LANGUAGE_SYSTEM), |
||
| 876 | 'currency_id' => Uuid::fromHexToBytes(Defaults::CURRENCY), |
||
| 877 | 'payment_method_id' => $defaultPaymentMethod, |
||
| 878 | 'shipping_method_id' => $defaultShippingMethod, |
||
| 879 | 'country_id' => $defaultCountry, |
||
| 880 | 'navigation_category_id' => $rootCategoryId, |
||
| 881 | 'navigation_category_version_id' => Uuid::fromHexToBytes(Defaults::LIVE_VERSION), |
||
| 882 | 'customer_group_id' => Uuid::fromHexToBytes(Defaults::FALLBACK_CUSTOMER_GROUP), |
||
| 883 | 'created_at' => date(Defaults::STORAGE_DATE_FORMAT), |
||
| 884 | ]); |
||
| 885 | |||
| 886 | $connection->insert('sales_channel_translation', ['sales_channel_id' => $id, 'language_id' => $languageEN, 'name' => 'Headless', 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 887 | |||
| 888 | // country |
||
| 889 | $connection->insert('sales_channel_country', ['sales_channel_id' => $id, 'country_id' => $defaultCountry]); |
||
| 890 | $connection->insert('sales_channel_country', ['sales_channel_id' => $id, 'country_id' => $countryStatement->fetchColumn()]); |
||
| 891 | |||
| 892 | // currency |
||
| 893 | foreach ($currencies as $currency) { |
||
| 894 | $connection->insert('sales_channel_currency', ['sales_channel_id' => $id, 'currency_id' => $currency]); |
||
| 895 | } |
||
| 896 | |||
| 897 | // language |
||
| 898 | foreach ($languages as $language) { |
||
| 899 | $connection->insert('sales_channel_language', ['sales_channel_id' => $id, 'language_id' => $language]); |
||
| 900 | } |
||
| 901 | |||
| 902 | // shipping methods |
||
| 903 | foreach ($shippingMethods as $shippingMethod) { |
||
| 904 | $connection->insert('sales_channel_shipping_method', ['sales_channel_id' => $id, 'shipping_method_id' => $shippingMethod]); |
||
| 905 | } |
||
| 906 | |||
| 907 | // payment methods |
||
| 908 | foreach ($paymentMethods as $paymentMethod) { |
||
| 909 | $connection->insert('sales_channel_payment_method', ['sales_channel_id' => $id, 'payment_method_id' => $paymentMethod]); |
||
| 910 | } |
||
| 911 | } |
||
| 912 | |||
| 913 | private function createDefaultSnippetSets(Connection $connection): void |
||
| 914 | { |
||
| 915 | $queue = new MultiInsertQueryQueue($connection); |
||
| 916 | |||
| 917 | $queue->addInsert('snippet_set', ['id' => Uuid::randomBytes(), 'name' => 'BASE de-DE', 'base_file' => 'messages.de-DE', 'iso' => 'de-DE', 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 918 | $queue->addInsert('snippet_set', ['id' => Uuid::randomBytes(), 'name' => 'BASE en-GB', 'base_file' => 'messages.en-GB', 'iso' => 'en-GB', 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 919 | |||
| 920 | $queue->execute(); |
||
| 921 | } |
||
| 922 | |||
| 923 | private function createDefaultMediaFolders(Connection $connection): void |
||
| 924 | { |
||
| 925 | $queue = new MultiInsertQueryQueue($connection); |
||
| 926 | |||
| 927 | $queue->addInsert('media_default_folder', ['id' => Uuid::randomBytes(), 'association_fields' => '["productMedia"]', 'entity' => 'product', 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 928 | $queue->addInsert('media_default_folder', ['id' => Uuid::randomBytes(), 'association_fields' => '["productManufacturers"]', 'entity' => 'product_manufacturer', 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 929 | $queue->addInsert('media_default_folder', ['id' => Uuid::randomBytes(), 'association_fields' => '["avatarUser"]', 'entity' => 'user', 'created_at' => (new \DateTime())->format(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 930 | $queue->addInsert('media_default_folder', ['id' => Uuid::randomBytes(), 'association_fields' => '["mailTemplateMedia"]', 'entity' => 'mail_template', 'created_at' => (new \DateTime())->format(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 931 | $queue->addInsert('media_default_folder', ['id' => Uuid::randomBytes(), 'association_fields' => '["categories"]', 'entity' => 'category', 'created_at' => (new \DateTime())->format(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 932 | $queue->addInsert('media_default_folder', ['id' => Uuid::randomBytes(), 'association_fields' => '[]', 'entity' => 'cms_page', 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 933 | $queue->execute(); |
||
| 934 | |||
| 935 | $notCreatedDefaultFolders = $connection->executeQuery(' |
||
| 936 | SELECT `media_default_folder`.`id` default_folder_id, `media_default_folder`.`entity` entity |
||
| 937 | FROM `media_default_folder` |
||
| 938 | LEFT JOIN `media_folder` ON `media_folder`.`default_folder_id` = `media_default_folder`.`id` |
||
| 939 | WHERE `media_folder`.`id` IS NULL |
||
| 940 | ')->fetchAll(); |
||
| 941 | |||
| 942 | foreach ($notCreatedDefaultFolders as $notCreatedDefaultFolder) { |
||
| 943 | $this->createDefaultFolder( |
||
| 944 | $connection, |
||
| 945 | $notCreatedDefaultFolder['default_folder_id'], |
||
| 946 | $notCreatedDefaultFolder['entity'] |
||
| 947 | ); |
||
| 948 | } |
||
| 949 | } |
||
| 950 | |||
| 951 | private function createDefaultFolder(Connection $connection, string $defaultFolderId, string $entity): void |
||
| 952 | { |
||
| 953 | $connection->transactional(function (Connection $connection) use ($defaultFolderId, $entity) { |
||
| 954 | $configurationId = Uuid::randomBytes(); |
||
| 955 | $folderId = Uuid::randomBytes(); |
||
| 956 | $folderName = $this->getMediaFolderName($entity); |
||
| 957 | |||
| 958 | $connection->executeUpdate(' |
||
| 959 | INSERT INTO `media_folder_configuration` (`id`, `thumbnail_quality`, `create_thumbnails`, created_at) |
||
| 960 | VALUES (:id, 80, 1, :createdAt) |
||
| 961 | ', [ |
||
| 962 | 'id' => $configurationId, |
||
| 963 | 'createdAt' => date(Defaults::STORAGE_DATE_FORMAT), |
||
| 964 | ]); |
||
| 965 | |||
| 966 | $connection->executeUpdate(' |
||
| 967 | INSERT into `media_folder` (`id`, `name`, `default_folder_id`, `media_folder_configuration_id`, `use_parent_configuration`, `child_count`, `created_at`) |
||
| 968 | VALUES (:folderId, :folderName, :defaultFolderId, :configurationId, 0, 0, :createdAt) |
||
| 969 | ', [ |
||
| 970 | 'folderId' => $folderId, |
||
| 971 | 'folderName' => $folderName, |
||
| 972 | 'defaultFolderId' => $defaultFolderId, |
||
| 973 | 'configurationId' => $configurationId, |
||
| 974 | 'createdAt' => date(Defaults::STORAGE_DATE_FORMAT), |
||
| 975 | ]); |
||
| 976 | }); |
||
| 977 | } |
||
| 978 | |||
| 979 | private function getMediaFolderName(string $entity): string |
||
| 980 | { |
||
| 981 | $capitalizedEntityParts = array_map(function ($part) { |
||
| 982 | return ucfirst($part); |
||
| 983 | }, |
||
| 984 | explode('_', $entity) |
||
| 985 | ); |
||
| 986 | |||
| 987 | return implode(' ', $capitalizedEntityParts) . ' Media'; |
||
| 988 | } |
||
| 989 | |||
| 990 | private function createOrderStateMachine(Connection $connection): void |
||
| 991 | { |
||
| 992 | $stateMachineId = Uuid::randomBytes(); |
||
| 993 | $openId = Uuid::randomBytes(); |
||
| 994 | $completedId = Uuid::randomBytes(); |
||
| 995 | $inProgressId = Uuid::randomBytes(); |
||
| 996 | $canceledId = Uuid::randomBytes(); |
||
| 997 | |||
| 998 | $germanId = Uuid::fromHexToBytes(Defaults::LANGUAGE_SYSTEM_DE); |
||
| 999 | $englishId = Uuid::fromHexToBytes(Defaults::LANGUAGE_SYSTEM); |
||
| 1000 | |||
| 1001 | $translationDE = ['language_id' => $germanId, 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]; |
||
| 1002 | $translationEN = ['language_id' => $englishId, 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]; |
||
| 1003 | |||
| 1004 | // state machine |
||
| 1005 | $connection->insert('state_machine', [ |
||
| 1006 | 'id' => $stateMachineId, |
||
| 1007 | 'technical_name' => OrderStates::STATE_MACHINE, |
||
| 1008 | 'created_at' => date(Defaults::STORAGE_DATE_FORMAT), |
||
| 1009 | ]); |
||
| 1010 | |||
| 1011 | $connection->insert('state_machine_translation', array_merge($translationDE, [ |
||
| 1012 | 'state_machine_id' => $stateMachineId, |
||
| 1013 | 'name' => 'Bestellstatus', |
||
| 1014 | 'created_at' => date(Defaults::STORAGE_DATE_FORMAT), |
||
| 1015 | ])); |
||
| 1016 | |||
| 1017 | $connection->insert('state_machine_translation', array_merge($translationEN, [ |
||
| 1018 | 'state_machine_id' => $stateMachineId, |
||
| 1019 | 'name' => 'Order state', |
||
| 1020 | 'created_at' => date(Defaults::STORAGE_DATE_FORMAT), |
||
| 1021 | ])); |
||
| 1022 | |||
| 1023 | // states |
||
| 1024 | $connection->insert('state_machine_state', ['id' => $openId, 'state_machine_id' => $stateMachineId, 'technical_name' => OrderStates::STATE_OPEN, 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 1025 | $connection->insert('state_machine_state_translation', array_merge($translationDE, ['state_machine_state_id' => $openId, 'name' => 'Offen'])); |
||
| 1026 | $connection->insert('state_machine_state_translation', array_merge($translationEN, ['state_machine_state_id' => $openId, 'name' => 'Open'])); |
||
| 1027 | |||
| 1028 | $connection->insert('state_machine_state', ['id' => $completedId, 'state_machine_id' => $stateMachineId, 'technical_name' => OrderStates::STATE_COMPLETED, 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 1029 | $connection->insert('state_machine_state_translation', array_merge($translationDE, ['state_machine_state_id' => $completedId, 'name' => 'Abgeschlossen'])); |
||
| 1030 | $connection->insert('state_machine_state_translation', array_merge($translationEN, ['state_machine_state_id' => $completedId, 'name' => 'Done'])); |
||
| 1031 | |||
| 1032 | $connection->insert('state_machine_state', ['id' => $inProgressId, 'state_machine_id' => $stateMachineId, 'technical_name' => OrderStates::STATE_IN_PROGRESS, 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 1033 | $connection->insert('state_machine_state_translation', array_merge($translationDE, ['state_machine_state_id' => $inProgressId, 'name' => 'In Bearbeitung'])); |
||
| 1034 | $connection->insert('state_machine_state_translation', array_merge($translationEN, ['state_machine_state_id' => $inProgressId, 'name' => 'In progress'])); |
||
| 1035 | |||
| 1036 | $connection->insert('state_machine_state', ['id' => $canceledId, 'state_machine_id' => $stateMachineId, 'technical_name' => OrderStates::STATE_CANCELLED, 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 1037 | $connection->insert('state_machine_state_translation', array_merge($translationDE, ['state_machine_state_id' => $canceledId, 'name' => 'Abgebrochen'])); |
||
| 1038 | $connection->insert('state_machine_state_translation', array_merge($translationEN, ['state_machine_state_id' => $canceledId, 'name' => 'Cancelled'])); |
||
| 1039 | |||
| 1040 | // transitions |
||
| 1041 | $connection->insert('state_machine_transition', ['id' => Uuid::randomBytes(), 'state_machine_id' => $stateMachineId, 'action_name' => 'process', 'from_state_id' => $openId, 'to_state_id' => $inProgressId, 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 1042 | $connection->insert('state_machine_transition', ['id' => Uuid::randomBytes(), 'state_machine_id' => $stateMachineId, 'action_name' => 'cancel', 'from_state_id' => $openId, 'to_state_id' => $canceledId, 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 1043 | |||
| 1044 | $connection->insert('state_machine_transition', ['id' => Uuid::randomBytes(), 'state_machine_id' => $stateMachineId, 'action_name' => 'cancel', 'from_state_id' => $inProgressId, 'to_state_id' => $canceledId, 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 1045 | $connection->insert('state_machine_transition', ['id' => Uuid::randomBytes(), 'state_machine_id' => $stateMachineId, 'action_name' => 'complete', 'from_state_id' => $inProgressId, 'to_state_id' => $completedId, 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 1046 | |||
| 1047 | $connection->insert('state_machine_transition', ['id' => Uuid::randomBytes(), 'state_machine_id' => $stateMachineId, 'action_name' => 'reopen', 'from_state_id' => $canceledId, 'to_state_id' => $openId, 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 1048 | // set initial state |
||
| 1049 | $connection->update('state_machine', ['initial_state_id' => $openId], ['id' => $stateMachineId]); |
||
| 1050 | } |
||
| 1051 | |||
| 1052 | private function createOrderDeliveryStateMachine(Connection $connection): void |
||
| 1053 | { |
||
| 1054 | $stateMachineId = Uuid::randomBytes(); |
||
| 1055 | $openId = Uuid::randomBytes(); |
||
| 1056 | $cancelledId = Uuid::randomBytes(); |
||
| 1057 | |||
| 1058 | $shippedId = Uuid::randomBytes(); |
||
| 1059 | $shippedPartiallyId = Uuid::randomBytes(); |
||
| 1060 | |||
| 1061 | $returnedId = Uuid::randomBytes(); |
||
| 1062 | $returnedPartiallyId = Uuid::randomBytes(); |
||
| 1063 | |||
| 1064 | $germanId = Uuid::fromHexToBytes(Defaults::LANGUAGE_SYSTEM_DE); |
||
| 1065 | $englishId = Uuid::fromHexToBytes(Defaults::LANGUAGE_SYSTEM); |
||
| 1066 | |||
| 1067 | $translationDE = ['language_id' => $germanId, 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]; |
||
| 1068 | $translationEN = ['language_id' => $englishId, 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]; |
||
| 1069 | |||
| 1070 | // state machine |
||
| 1071 | $connection->insert('state_machine', [ |
||
| 1072 | 'id' => $stateMachineId, |
||
| 1073 | 'technical_name' => OrderDeliveryStates::STATE_MACHINE, |
||
| 1074 | 'created_at' => date(Defaults::STORAGE_DATE_FORMAT), |
||
| 1075 | ]); |
||
| 1076 | |||
| 1077 | $connection->insert('state_machine_translation', array_merge($translationDE, [ |
||
| 1078 | 'state_machine_id' => $stateMachineId, |
||
| 1079 | 'name' => 'Bestellstatus', |
||
| 1080 | 'created_at' => date(Defaults::STORAGE_DATE_FORMAT), |
||
| 1081 | ])); |
||
| 1082 | |||
| 1083 | $connection->insert('state_machine_translation', array_merge($translationEN, [ |
||
| 1084 | 'state_machine_id' => $stateMachineId, |
||
| 1085 | 'name' => 'Order state', |
||
| 1086 | 'created_at' => date(Defaults::STORAGE_DATE_FORMAT), |
||
| 1087 | ])); |
||
| 1088 | |||
| 1089 | // states |
||
| 1090 | $connection->insert('state_machine_state', ['id' => $openId, 'state_machine_id' => $stateMachineId, 'technical_name' => OrderDeliveryStates::STATE_OPEN, 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 1091 | $connection->insert('state_machine_state_translation', array_merge($translationDE, ['state_machine_state_id' => $openId, 'name' => 'Offen'])); |
||
| 1092 | $connection->insert('state_machine_state_translation', array_merge($translationEN, ['state_machine_state_id' => $openId, 'name' => 'Open'])); |
||
| 1093 | |||
| 1094 | $connection->insert('state_machine_state', ['id' => $shippedId, 'state_machine_id' => $stateMachineId, 'technical_name' => OrderDeliveryStates::STATE_SHIPPED, 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 1095 | $connection->insert('state_machine_state_translation', array_merge($translationDE, ['state_machine_state_id' => $shippedId, 'name' => 'Versandt'])); |
||
| 1096 | $connection->insert('state_machine_state_translation', array_merge($translationEN, ['state_machine_state_id' => $shippedId, 'name' => 'Shipped'])); |
||
| 1097 | |||
| 1098 | $connection->insert('state_machine_state', ['id' => $shippedPartiallyId, 'state_machine_id' => $stateMachineId, 'technical_name' => OrderDeliveryStates::STATE_PARTIALLY_SHIPPED, 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 1099 | $connection->insert('state_machine_state_translation', array_merge($translationDE, ['state_machine_state_id' => $shippedPartiallyId, 'name' => 'Teilweise versandt'])); |
||
| 1100 | $connection->insert('state_machine_state_translation', array_merge($translationEN, ['state_machine_state_id' => $shippedPartiallyId, 'name' => 'Shipped (partially)'])); |
||
| 1101 | |||
| 1102 | $connection->insert('state_machine_state', ['id' => $returnedId, 'state_machine_id' => $stateMachineId, 'technical_name' => OrderDeliveryStates::STATE_RETURNED, 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 1103 | $connection->insert('state_machine_state_translation', array_merge($translationDE, ['state_machine_state_id' => $returnedId, 'name' => 'Retour'])); |
||
| 1104 | $connection->insert('state_machine_state_translation', array_merge($translationEN, ['state_machine_state_id' => $returnedId, 'name' => 'Returned'])); |
||
| 1105 | |||
| 1106 | $connection->insert('state_machine_state', ['id' => $returnedPartiallyId, 'state_machine_id' => $stateMachineId, 'technical_name' => OrderDeliveryStates::STATE_PARTIALLY_RETURNED, 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 1107 | $connection->insert('state_machine_state_translation', array_merge($translationDE, ['state_machine_state_id' => $returnedPartiallyId, 'name' => 'Teilretour'])); |
||
| 1108 | $connection->insert('state_machine_state_translation', array_merge($translationEN, ['state_machine_state_id' => $returnedPartiallyId, 'name' => 'Returned (partially)'])); |
||
| 1109 | |||
| 1110 | $connection->insert('state_machine_state', ['id' => $cancelledId, 'state_machine_id' => $stateMachineId, 'technical_name' => OrderDeliveryStates::STATE_CANCELLED, 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 1111 | $connection->insert('state_machine_state_translation', array_merge($translationDE, ['state_machine_state_id' => $cancelledId, 'name' => 'Abgebrochen'])); |
||
| 1112 | $connection->insert('state_machine_state_translation', array_merge($translationEN, ['state_machine_state_id' => $cancelledId, 'name' => 'Cancelled'])); |
||
| 1113 | |||
| 1114 | // transitions |
||
| 1115 | // from "open" to * |
||
| 1116 | $connection->insert('state_machine_transition', ['id' => Uuid::randomBytes(), 'state_machine_id' => $stateMachineId, 'action_name' => 'ship', 'from_state_id' => $openId, 'to_state_id' => $shippedId, 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 1117 | $connection->insert('state_machine_transition', ['id' => Uuid::randomBytes(), 'state_machine_id' => $stateMachineId, 'action_name' => 'ship_partially', 'from_state_id' => $openId, 'to_state_id' => $shippedPartiallyId, 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 1118 | $connection->insert('state_machine_transition', ['id' => Uuid::randomBytes(), 'state_machine_id' => $stateMachineId, 'action_name' => 'cancel', 'from_state_id' => $openId, 'to_state_id' => $cancelledId, 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 1119 | |||
| 1120 | // from "shipped" to * |
||
| 1121 | // $connection->insert('state_machine_transition', ['id' => Uuid::randomBytes(), 'state_machine_id' => $stateMachineId, 'action_name' => 'ship', 'from_state_id' => $shippedId, 'to_state_id' => $shippedId, 'created_at' => date(Defaults::DATE_FORMAT)]); |
||
| 1122 | $connection->insert('state_machine_transition', ['id' => Uuid::randomBytes(), 'state_machine_id' => $stateMachineId, 'action_name' => 'retour', 'from_state_id' => $shippedId, 'to_state_id' => $returnedId, 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 1123 | $connection->insert('state_machine_transition', ['id' => Uuid::randomBytes(), 'state_machine_id' => $stateMachineId, 'action_name' => 'retour_partially', 'from_state_id' => $shippedId, 'to_state_id' => $returnedPartiallyId, 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 1124 | $connection->insert('state_machine_transition', ['id' => Uuid::randomBytes(), 'state_machine_id' => $stateMachineId, 'action_name' => 'cancel', 'from_state_id' => $shippedId, 'to_state_id' => $cancelledId, 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 1125 | |||
| 1126 | // from shipped_partially |
||
| 1127 | $connection->insert('state_machine_transition', ['id' => Uuid::randomBytes(), 'state_machine_id' => $stateMachineId, 'action_name' => 'retour', 'from_state_id' => $shippedPartiallyId, 'to_state_id' => $returnedId, 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 1128 | $connection->insert('state_machine_transition', ['id' => Uuid::randomBytes(), 'state_machine_id' => $stateMachineId, 'action_name' => 'retour_partially', 'from_state_id' => $shippedPartiallyId, 'to_state_id' => $returnedPartiallyId, 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 1129 | $connection->insert('state_machine_transition', ['id' => Uuid::randomBytes(), 'state_machine_id' => $stateMachineId, 'action_name' => 'ship', 'from_state_id' => $shippedPartiallyId, 'to_state_id' => $shippedId, 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 1130 | $connection->insert('state_machine_transition', ['id' => Uuid::randomBytes(), 'state_machine_id' => $stateMachineId, 'action_name' => 'cancel', 'from_state_id' => $shippedPartiallyId, 'to_state_id' => $cancelledId, 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 1131 | |||
| 1132 | // set initial state |
||
| 1133 | $connection->update('state_machine', ['initial_state_id' => $openId], ['id' => $stateMachineId]); |
||
| 1134 | } |
||
| 1135 | |||
| 1136 | private function createOrderTransactionStateMachine(Connection $connection): void |
||
| 1137 | { |
||
| 1138 | $stateMachineId = Uuid::randomBytes(); |
||
| 1139 | |||
| 1140 | $openId = Uuid::randomBytes(); |
||
| 1141 | $paidId = Uuid::randomBytes(); |
||
| 1142 | $paidPartiallyId = Uuid::randomBytes(); |
||
| 1143 | $cancelledId = Uuid::randomBytes(); |
||
| 1144 | $remindedId = Uuid::randomBytes(); |
||
| 1145 | $refundedId = Uuid::randomBytes(); |
||
| 1146 | $refundedPartiallyId = Uuid::randomBytes(); |
||
| 1147 | |||
| 1148 | $germanId = Uuid::fromHexToBytes(Defaults::LANGUAGE_SYSTEM_DE); |
||
| 1149 | $englishId = Uuid::fromHexToBytes(Defaults::LANGUAGE_SYSTEM); |
||
| 1150 | |||
| 1151 | $translationDE = ['language_id' => $germanId, 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]; |
||
| 1152 | $translationEN = ['language_id' => $englishId, 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]; |
||
| 1153 | |||
| 1154 | // state machine |
||
| 1155 | $connection->insert('state_machine', [ |
||
| 1156 | 'id' => $stateMachineId, |
||
| 1157 | 'technical_name' => OrderTransactionStates::STATE_MACHINE, |
||
| 1158 | 'created_at' => date(Defaults::STORAGE_DATE_FORMAT), |
||
| 1159 | ]); |
||
| 1160 | |||
| 1161 | $connection->insert('state_machine_translation', array_merge($translationDE, [ |
||
| 1162 | 'state_machine_id' => $stateMachineId, |
||
| 1163 | 'name' => 'Zahlungsstatus', |
||
| 1164 | 'created_at' => date(Defaults::STORAGE_DATE_FORMAT), |
||
| 1165 | ])); |
||
| 1166 | |||
| 1167 | $connection->insert('state_machine_translation', array_merge($translationEN, [ |
||
| 1168 | 'state_machine_id' => $stateMachineId, |
||
| 1169 | 'name' => 'Payment state', |
||
| 1170 | 'created_at' => date(Defaults::STORAGE_DATE_FORMAT), |
||
| 1171 | ])); |
||
| 1172 | |||
| 1173 | // states |
||
| 1174 | $connection->insert('state_machine_state', ['id' => $openId, 'state_machine_id' => $stateMachineId, 'technical_name' => OrderTransactionStates::STATE_OPEN, 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 1175 | $connection->insert('state_machine_state_translation', array_merge($translationDE, ['state_machine_state_id' => $openId, 'name' => 'Offen'])); |
||
| 1176 | $connection->insert('state_machine_state_translation', array_merge($translationEN, ['state_machine_state_id' => $openId, 'name' => 'Open'])); |
||
| 1177 | |||
| 1178 | $connection->insert('state_machine_state', ['id' => $paidId, 'state_machine_id' => $stateMachineId, 'technical_name' => OrderTransactionStates::STATE_PAID, 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 1179 | $connection->insert('state_machine_state_translation', array_merge($translationDE, ['state_machine_state_id' => $paidId, 'name' => 'Bezahlt'])); |
||
| 1180 | $connection->insert('state_machine_state_translation', array_merge($translationEN, ['state_machine_state_id' => $paidId, 'name' => 'Paid'])); |
||
| 1181 | |||
| 1182 | $connection->insert('state_machine_state', ['id' => $paidPartiallyId, 'state_machine_id' => $stateMachineId, 'technical_name' => OrderTransactionStates::STATE_PARTIALLY_PAID, 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 1183 | $connection->insert('state_machine_state_translation', array_merge($translationDE, ['state_machine_state_id' => $paidPartiallyId, 'name' => 'Teilweise bezahlt'])); |
||
| 1184 | $connection->insert('state_machine_state_translation', array_merge($translationEN, ['state_machine_state_id' => $paidPartiallyId, 'name' => 'Paid (partially)'])); |
||
| 1185 | |||
| 1186 | $connection->insert('state_machine_state', ['id' => $refundedId, 'state_machine_id' => $stateMachineId, 'technical_name' => OrderTransactionStates::STATE_REFUNDED, 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 1187 | $connection->insert('state_machine_state_translation', array_merge($translationDE, ['state_machine_state_id' => $refundedId, 'name' => 'Erstattet'])); |
||
| 1188 | $connection->insert('state_machine_state_translation', array_merge($translationEN, ['state_machine_state_id' => $refundedId, 'name' => 'Refunded'])); |
||
| 1189 | |||
| 1190 | $connection->insert('state_machine_state', ['id' => $refundedPartiallyId, 'state_machine_id' => $stateMachineId, 'technical_name' => OrderTransactionStates::STATE_PARTIALLY_REFUNDED, 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 1191 | $connection->insert('state_machine_state_translation', array_merge($translationDE, ['state_machine_state_id' => $refundedPartiallyId, 'name' => 'Teilweise erstattet'])); |
||
| 1192 | $connection->insert('state_machine_state_translation', array_merge($translationEN, ['state_machine_state_id' => $refundedPartiallyId, 'name' => 'Refunded (partially)'])); |
||
| 1193 | |||
| 1194 | $connection->insert('state_machine_state', ['id' => $cancelledId, 'state_machine_id' => $stateMachineId, 'technical_name' => OrderTransactionStates::STATE_CANCELLED, 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 1195 | $connection->insert('state_machine_state_translation', array_merge($translationDE, ['state_machine_state_id' => $cancelledId, 'name' => 'Abgebrochen'])); |
||
| 1196 | $connection->insert('state_machine_state_translation', array_merge($translationEN, ['state_machine_state_id' => $cancelledId, 'name' => 'Cancelled'])); |
||
| 1197 | |||
| 1198 | $connection->insert('state_machine_state', ['id' => $remindedId, 'state_machine_id' => $stateMachineId, 'technical_name' => OrderTransactionStates::STATE_REMINDED, 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 1199 | $connection->insert('state_machine_state_translation', array_merge($translationDE, ['state_machine_state_id' => $remindedId, 'name' => 'Erinnert'])); |
||
| 1200 | $connection->insert('state_machine_state_translation', array_merge($translationEN, ['state_machine_state_id' => $remindedId, 'name' => 'Reminded'])); |
||
| 1201 | |||
| 1202 | // transitions |
||
| 1203 | // from "open" to * |
||
| 1204 | $connection->insert('state_machine_transition', ['id' => Uuid::randomBytes(), 'state_machine_id' => $stateMachineId, 'action_name' => 'pay', 'from_state_id' => $openId, 'to_state_id' => $paidId, 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 1205 | $connection->insert('state_machine_transition', ['id' => Uuid::randomBytes(), 'state_machine_id' => $stateMachineId, 'action_name' => 'pay_partially', 'from_state_id' => $openId, 'to_state_id' => $paidPartiallyId, 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 1206 | $connection->insert('state_machine_transition', ['id' => Uuid::randomBytes(), 'state_machine_id' => $stateMachineId, 'action_name' => 'cancel', 'from_state_id' => $openId, 'to_state_id' => $cancelledId, 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 1207 | $connection->insert('state_machine_transition', ['id' => Uuid::randomBytes(), 'state_machine_id' => $stateMachineId, 'action_name' => 'remind', 'from_state_id' => $openId, 'to_state_id' => $remindedId, 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 1208 | |||
| 1209 | // from "reminded" to * |
||
| 1210 | $connection->insert('state_machine_transition', ['id' => Uuid::randomBytes(), 'state_machine_id' => $stateMachineId, 'action_name' => 'pay', 'from_state_id' => $remindedId, 'to_state_id' => $paidId, 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 1211 | $connection->insert('state_machine_transition', ['id' => Uuid::randomBytes(), 'state_machine_id' => $stateMachineId, 'action_name' => 'pay_partially', 'from_state_id' => $remindedId, 'to_state_id' => $paidPartiallyId, 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 1212 | |||
| 1213 | // from "paid_partially" to * |
||
| 1214 | $connection->insert('state_machine_transition', ['id' => Uuid::randomBytes(), 'state_machine_id' => $stateMachineId, 'action_name' => 'remind', 'from_state_id' => $paidPartiallyId, 'to_state_id' => $remindedId, 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 1215 | $connection->insert('state_machine_transition', ['id' => Uuid::randomBytes(), 'state_machine_id' => $stateMachineId, 'action_name' => 'pay', 'from_state_id' => $paidPartiallyId, 'to_state_id' => $paidId, 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 1216 | $connection->insert('state_machine_transition', ['id' => Uuid::randomBytes(), 'state_machine_id' => $stateMachineId, 'action_name' => 'refund_partially', 'from_state_id' => $paidPartiallyId, 'to_state_id' => $refundedPartiallyId, 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 1217 | $connection->insert('state_machine_transition', ['id' => Uuid::randomBytes(), 'state_machine_id' => $stateMachineId, 'action_name' => 'refund', 'from_state_id' => $paidPartiallyId, 'to_state_id' => $refundedId, 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 1218 | |||
| 1219 | // from "paid" to * |
||
| 1220 | $connection->insert('state_machine_transition', ['id' => Uuid::randomBytes(), 'state_machine_id' => $stateMachineId, 'action_name' => 'refund_partially', 'from_state_id' => $paidId, 'to_state_id' => $refundedPartiallyId, 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 1221 | $connection->insert('state_machine_transition', ['id' => Uuid::randomBytes(), 'state_machine_id' => $stateMachineId, 'action_name' => 'refund', 'from_state_id' => $paidId, 'to_state_id' => $refundedId, 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 1222 | |||
| 1223 | // from "refunded_partially" to * |
||
| 1224 | $connection->insert('state_machine_transition', ['id' => Uuid::randomBytes(), 'state_machine_id' => $stateMachineId, 'action_name' => 'refund', 'from_state_id' => $refundedPartiallyId, 'to_state_id' => $refundedId, 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 1225 | |||
| 1226 | // set initial state |
||
| 1227 | $connection->update('state_machine', ['initial_state_id' => $openId], ['id' => $stateMachineId]); |
||
| 1228 | } |
||
| 1229 | |||
| 1230 | private function createRules(Connection $connection): void |
||
| 1231 | { |
||
| 1232 | $sundaySaleRuleId = Uuid::randomBytes(); |
||
| 1233 | $connection->insert('rule', ['id' => $sundaySaleRuleId, 'name' => 'Sunday sales', 'priority' => 2, 'invalid' => 0, 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 1234 | $connection->insert('rule_condition', ['id' => Uuid::randomBytes(), 'rule_id' => $sundaySaleRuleId, 'type' => 'dayOfWeek', 'value' => json_encode(['operator' => '=', 'dayOfWeek' => 7]), 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 1235 | |||
| 1236 | $allCustomersRuleId = Uuid::randomBytes(); |
||
| 1237 | $connection->insert('rule', ['id' => $allCustomersRuleId, 'name' => 'All customers', 'priority' => 1, 'invalid' => 0, 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 1238 | $connection->insert('rule_condition', ['id' => Uuid::randomBytes(), 'rule_id' => $allCustomersRuleId, 'type' => 'customerCustomerGroup', 'value' => json_encode(['operator' => '=', 'customerGroupIds' => [Defaults::FALLBACK_CUSTOMER_GROUP]]), 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 1239 | |||
| 1240 | $usaCountryId = $connection->executeQuery('SELECT LOWER(hex(id)) FROM country WHERE `iso3` = "USA"')->fetchColumn(); |
||
| 1241 | $usaRuleId = Uuid::randomBytes(); |
||
| 1242 | $connection->insert('rule', ['id' => $usaRuleId, 'name' => 'Customers from USA', 'priority' => 100, 'invalid' => 0, 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 1243 | $connection->insert('rule_condition', ['id' => Uuid::randomBytes(), 'rule_id' => $usaRuleId, 'type' => 'customerBillingCountry', 'value' => json_encode(['operator' => '=', 'countryIds' => [$usaCountryId]]), 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 1244 | } |
||
| 1245 | |||
| 1246 | private function createSalutation(Connection $connection): void |
||
| 1247 | { |
||
| 1248 | $languageEn = Uuid::fromHexToBytes(Defaults::LANGUAGE_SYSTEM); |
||
| 1249 | $languageDe = Uuid::fromHexToBytes(Defaults::LANGUAGE_SYSTEM_DE); |
||
| 1250 | |||
| 1251 | $mr = Uuid::randomBytes(); |
||
| 1252 | $connection->insert('salutation', [ |
||
| 1253 | 'id' => $mr, |
||
| 1254 | 'salutation_key' => 'mr', |
||
| 1255 | 'created_at' => date(Defaults::STORAGE_DATE_FORMAT), |
||
| 1256 | ]); |
||
| 1257 | $connection->insert('salutation_translation', [ |
||
| 1258 | 'salutation_id' => $mr, |
||
| 1259 | 'language_id' => $languageEn, |
||
| 1260 | 'display_name' => 'Mr.', |
||
| 1261 | 'letter_name' => 'Dear Mr.', |
||
| 1262 | 'created_at' => date(Defaults::STORAGE_DATE_FORMAT), |
||
| 1263 | ]); |
||
| 1264 | $connection->insert('salutation_translation', [ |
||
| 1265 | 'salutation_id' => $mr, |
||
| 1266 | 'language_id' => $languageDe, |
||
| 1267 | 'display_name' => 'Herr', |
||
| 1268 | 'letter_name' => 'Sehr geehrter Herr', |
||
| 1269 | 'created_at' => date(Defaults::STORAGE_DATE_FORMAT), |
||
| 1270 | ]); |
||
| 1271 | |||
| 1272 | $mrs = Uuid::randomBytes(); |
||
| 1273 | $connection->insert('salutation', [ |
||
| 1274 | 'id' => $mrs, |
||
| 1275 | 'salutation_key' => 'mrs', |
||
| 1276 | 'created_at' => date(Defaults::STORAGE_DATE_FORMAT), |
||
| 1277 | ]); |
||
| 1278 | $connection->insert('salutation_translation', [ |
||
| 1279 | 'salutation_id' => $mrs, |
||
| 1280 | 'language_id' => $languageEn, |
||
| 1281 | 'display_name' => 'Mrs.', |
||
| 1282 | 'letter_name' => 'Dear Mrs.', |
||
| 1283 | 'created_at' => date(Defaults::STORAGE_DATE_FORMAT), |
||
| 1284 | ]); |
||
| 1285 | $connection->insert('salutation_translation', [ |
||
| 1286 | 'salutation_id' => $mrs, |
||
| 1287 | 'language_id' => $languageDe, |
||
| 1288 | 'display_name' => 'Frau', |
||
| 1289 | 'letter_name' => 'Sehr geehrte Frau', |
||
| 1290 | 'created_at' => date(Defaults::STORAGE_DATE_FORMAT), |
||
| 1291 | ]); |
||
| 1292 | |||
| 1293 | $notSpecified = Uuid::randomBytes(); |
||
| 1294 | $connection->insert('salutation', [ |
||
| 1295 | 'id' => $notSpecified, |
||
| 1296 | 'salutation_key' => 'not_specified', |
||
| 1297 | 'created_at' => date(Defaults::STORAGE_DATE_FORMAT), |
||
| 1298 | ]); |
||
| 1299 | $connection->insert('salutation_translation', [ |
||
| 1300 | 'salutation_id' => $notSpecified, |
||
| 1301 | 'language_id' => $languageEn, |
||
| 1302 | 'display_name' => 'Not specified', |
||
| 1303 | 'letter_name' => ' ', |
||
| 1304 | 'created_at' => date(Defaults::STORAGE_DATE_FORMAT), |
||
| 1305 | ]); |
||
| 1306 | $connection->insert('salutation_translation', [ |
||
| 1307 | 'salutation_id' => $notSpecified, |
||
| 1308 | 'language_id' => $languageDe, |
||
| 1309 | 'display_name' => 'Keine Angabe', |
||
| 1310 | 'letter_name' => ' ', |
||
| 1311 | 'created_at' => date(Defaults::STORAGE_DATE_FORMAT), |
||
| 1312 | ]); |
||
| 1313 | } |
||
| 1314 | |||
| 1315 | private function createDeliveryTimes(Connection $connection): string |
||
| 1316 | { |
||
| 1317 | $languageEn = Uuid::fromHexToBytes(Defaults::LANGUAGE_SYSTEM); |
||
| 1318 | $languageDe = Uuid::fromHexToBytes(Defaults::LANGUAGE_SYSTEM_DE); |
||
| 1319 | |||
| 1320 | $oneToThree = Uuid::randomBytes(); |
||
| 1321 | $twoToFive = Uuid::randomBytes(); |
||
| 1322 | $oneToTwoWeeks = Uuid::randomBytes(); |
||
| 1323 | $threeToFourWeeks = Uuid::randomBytes(); |
||
| 1324 | |||
| 1325 | $connection->insert('delivery_time', ['id' => $oneToThree, 'min' => 1, 'max' => 3, 'unit' => DeliveryTimeEntity::DELIVERY_TIME_DAY, 'created_at' => (new \DateTime())->format('Y-m-d H:i:s')]); |
||
| 1326 | $connection->insert('delivery_time_translation', ['delivery_time_id' => $oneToThree, 'language_id' => $languageEn, 'name' => '1-3 days', 'created_at' => (new \DateTime())->format('Y-m-d H:i:s')]); |
||
| 1327 | $connection->insert('delivery_time_translation', ['delivery_time_id' => $oneToThree, 'language_id' => $languageDe, 'name' => '1-3 Tage', 'created_at' => (new \DateTime())->format('Y-m-d H:i:s')]); |
||
| 1328 | $connection->insert('delivery_time', ['id' => $twoToFive, 'min' => 2, 'max' => 5, 'unit' => DeliveryTimeEntity::DELIVERY_TIME_DAY, 'created_at' => (new \DateTime())->format('Y-m-d H:i:s')]); |
||
| 1329 | $connection->insert('delivery_time_translation', ['delivery_time_id' => $twoToFive, 'language_id' => $languageEn, 'name' => '2-5 days', 'created_at' => (new \DateTime())->format('Y-m-d H:i:s')]); |
||
| 1330 | $connection->insert('delivery_time_translation', ['delivery_time_id' => $twoToFive, 'language_id' => $languageDe, 'name' => '2-5 Tage', 'created_at' => (new \DateTime())->format('Y-m-d H:i:s')]); |
||
| 1331 | $connection->insert('delivery_time', ['id' => $oneToTwoWeeks, 'min' => 1, 'max' => 2, 'unit' => DeliveryTimeEntity::DELIVERY_TIME_WEEK, 'created_at' => (new \DateTime())->format('Y-m-d H:i:s')]); |
||
| 1332 | $connection->insert('delivery_time_translation', ['delivery_time_id' => $oneToTwoWeeks, 'language_id' => $languageEn, 'name' => '1-2 weeks', 'created_at' => (new \DateTime())->format('Y-m-d H:i:s')]); |
||
| 1333 | $connection->insert('delivery_time_translation', ['delivery_time_id' => $oneToTwoWeeks, 'language_id' => $languageDe, 'name' => '1-2 Wochen', 'created_at' => (new \DateTime())->format('Y-m-d H:i:s')]); |
||
| 1334 | $connection->insert('delivery_time', ['id' => $threeToFourWeeks, 'min' => 3, 'max' => 4, 'unit' => DeliveryTimeEntity::DELIVERY_TIME_WEEK, 'created_at' => (new \DateTime())->format('Y-m-d H:i:s')]); |
||
| 1335 | $connection->insert('delivery_time_translation', ['delivery_time_id' => $threeToFourWeeks, 'language_id' => $languageEn, 'name' => '3-4 weeks', 'created_at' => (new \DateTime())->format('Y-m-d H:i:s')]); |
||
| 1336 | $connection->insert('delivery_time_translation', ['delivery_time_id' => $threeToFourWeeks, 'language_id' => $languageDe, 'name' => '3-4 Wochen', 'created_at' => (new \DateTime())->format('Y-m-d H:i:s')]); |
||
| 1337 | |||
| 1338 | return $oneToThree; |
||
| 1339 | } |
||
| 1340 | |||
| 1341 | private function createSystemConfigOptions(Connection $connection): void |
||
| 1342 | { |
||
| 1343 | $connection->insert('system_config', [ |
||
| 1344 | 'id' => Uuid::randomBytes(), |
||
| 1345 | 'configuration_key' => 'core.privacy.doiNewsletter', |
||
| 1346 | 'configuration_value' => '{"_value": true}', |
||
| 1347 | 'created_at' => date(Defaults::STORAGE_DATE_FORMAT), |
||
| 1348 | ]); |
||
| 1349 | |||
| 1350 | $connection->insert('system_config', [ |
||
| 1351 | 'id' => Uuid::randomBytes(), |
||
| 1352 | 'configuration_key' => 'core.store.apiUri', |
||
| 1353 | 'configuration_value' => '{"_value": "https://api.shopware.com"}', |
||
| 1354 | 'created_at' => date(Defaults::STORAGE_DATE_FORMAT), |
||
| 1355 | ]); |
||
| 1356 | |||
| 1357 | $connection->insert('system_config', [ |
||
| 1358 | 'id' => Uuid::randomBytes(), |
||
| 1359 | 'configuration_key' => 'core.basicInformation.email', |
||
| 1360 | 'configuration_value' => '{"_value": "doNotReply@localhost"}', |
||
| 1361 | 'created_at' => date(Defaults::STORAGE_DATE_FORMAT), |
||
| 1362 | ]); |
||
| 1363 | } |
||
| 1364 | |||
| 1365 | private function createDocumentTypes(Connection $connection) |
||
| 1366 | { |
||
| 1367 | $invoiceId = Uuid::randomBytes(); |
||
| 1368 | $deliveryNoteId = Uuid::randomBytes(); |
||
| 1369 | $creditNoteId = Uuid::randomBytes(); |
||
| 1370 | |||
| 1371 | $connection->insert('document_type', ['id' => $invoiceId, 'technical_name' => InvoiceGenerator::INVOICE, 'created_at' => (new \DateTime())->format(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 1372 | $connection->insert('document_type', ['id' => $deliveryNoteId, 'technical_name' => DeliveryNoteGenerator::DELIVERY_NOTE, 'created_at' => (new \DateTime())->format(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 1373 | $connection->insert('document_type', ['id' => $creditNoteId, 'technical_name' => CreditNoteGenerator::CREDIT_NOTE, 'created_at' => (new \DateTime())->format(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 1374 | |||
| 1375 | $connection->insert('document_type_translation', ['document_type_id' => $invoiceId, 'language_id' => Uuid::fromHexToBytes(Defaults::LANGUAGE_SYSTEM_DE), 'name' => 'Rechnung', 'created_at' => (new \DateTime())->format(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 1376 | $connection->insert('document_type_translation', ['document_type_id' => $invoiceId, 'language_id' => Uuid::fromHexToBytes(Defaults::LANGUAGE_SYSTEM), 'name' => 'Invoice', 'created_at' => (new \DateTime())->format(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 1377 | |||
| 1378 | $connection->insert('document_type_translation', ['document_type_id' => $deliveryNoteId, 'language_id' => Uuid::fromHexToBytes(Defaults::LANGUAGE_SYSTEM_DE), 'name' => 'Lieferschein', 'created_at' => (new \DateTime())->format(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 1379 | $connection->insert('document_type_translation', ['document_type_id' => $deliveryNoteId, 'language_id' => Uuid::fromHexToBytes(Defaults::LANGUAGE_SYSTEM), 'name' => 'Delivery note', 'created_at' => (new \DateTime())->format(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 1380 | |||
| 1381 | $connection->insert('document_type_translation', ['document_type_id' => $creditNoteId, 'language_id' => Uuid::fromHexToBytes(Defaults::LANGUAGE_SYSTEM_DE), 'name' => 'Gutschrift', 'created_at' => (new \DateTime())->format(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 1382 | $connection->insert('document_type_translation', ['document_type_id' => $creditNoteId, 'language_id' => Uuid::fromHexToBytes(Defaults::LANGUAGE_SYSTEM), 'name' => 'Credit note', 'created_at' => (new \DateTime())->format(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 1383 | } |
||
| 1384 | |||
| 1385 | private function createNewsletterMailTemplate(Connection $connection) |
||
| 1386 | { |
||
| 1387 | $registerMailId = Uuid::randomBytes(); |
||
| 1388 | $confirmMailId = Uuid::randomBytes(); |
||
| 1389 | |||
| 1390 | $languageEn = Uuid::fromHexToBytes(Defaults::LANGUAGE_SYSTEM); |
||
| 1391 | $languageDe = Uuid::fromHexToBytes(Defaults::LANGUAGE_SYSTEM_DE); |
||
| 1392 | |||
| 1393 | $connection->insert( |
||
| 1394 | 'mail_template', |
||
| 1395 | [ |
||
| 1396 | 'id' => $registerMailId, |
||
| 1397 | 'mail_template_type_id' => Uuid::fromHexToBytes($this->getMailTypeMapping()[NewsletterSubscriptionServiceInterface::MAIL_TYPE_OPT_IN]['id']), |
||
| 1398 | 'system_default' => true, |
||
| 1399 | 'created_at' => date(Defaults::STORAGE_DATE_FORMAT), |
||
| 1400 | ] |
||
| 1401 | ); |
||
| 1402 | |||
| 1403 | $connection->insert( |
||
| 1404 | 'mail_template_translation', |
||
| 1405 | [ |
||
| 1406 | 'mail_template_id' => $registerMailId, |
||
| 1407 | 'language_id' => $languageEn, |
||
| 1408 | 'subject' => 'Newsletter', |
||
| 1409 | 'description' => '', |
||
| 1410 | 'content_html' => $this->getOptInTemplate_HTML_EN(), |
||
| 1411 | 'content_plain' => $this->getOptInTemplate_PLAIN_EN(), |
||
| 1412 | 'created_at' => date(Defaults::STORAGE_DATE_FORMAT), |
||
| 1413 | ] |
||
| 1414 | ); |
||
| 1415 | |||
| 1416 | $connection->insert( |
||
| 1417 | 'mail_template_translation', |
||
| 1418 | [ |
||
| 1419 | 'mail_template_id' => $registerMailId, |
||
| 1420 | 'language_id' => $languageDe, |
||
| 1421 | 'subject' => 'Newsletter', |
||
| 1422 | 'description' => '', |
||
| 1423 | 'content_html' => $this->getOptInTemplate_HTML_DE(), |
||
| 1424 | 'content_plain' => $this->getOptInTemplate_PLAIN_DE(), |
||
| 1425 | 'created_at' => date(Defaults::STORAGE_DATE_FORMAT), |
||
| 1426 | ] |
||
| 1427 | ); |
||
| 1428 | |||
| 1429 | $connection->insert( |
||
| 1430 | 'mail_template', |
||
| 1431 | [ |
||
| 1432 | 'id' => $confirmMailId, |
||
| 1433 | 'mail_template_type_id' => Uuid::fromHexToBytes($this->getMailTypeMapping()[NewsletterSubscriptionServiceInterface::MAIL_TYPE_REGISTER]['id']), |
||
| 1434 | 'system_default' => true, |
||
| 1435 | 'created_at' => date(Defaults::STORAGE_DATE_FORMAT), |
||
| 1436 | ] |
||
| 1437 | ); |
||
| 1438 | |||
| 1439 | $connection->insert( |
||
| 1440 | 'mail_template_translation', |
||
| 1441 | [ |
||
| 1442 | 'mail_template_id' => $confirmMailId, |
||
| 1443 | 'language_id' => $languageEn, |
||
| 1444 | 'subject' => 'Register', |
||
| 1445 | 'description' => '', |
||
| 1446 | 'content_html' => $this->getRegisterTemplate_HTML_EN(), |
||
| 1447 | 'content_plain' => $this->getRegisterTemplate_PLAIN_EN(), |
||
| 1448 | 'created_at' => date(Defaults::STORAGE_DATE_FORMAT), |
||
| 1449 | ] |
||
| 1450 | ); |
||
| 1451 | |||
| 1452 | $connection->insert( |
||
| 1453 | 'mail_template_translation', |
||
| 1454 | [ |
||
| 1455 | 'mail_template_id' => $confirmMailId, |
||
| 1456 | 'language_id' => $languageDe, |
||
| 1457 | 'subject' => 'Register', |
||
| 1458 | 'description' => '', |
||
| 1459 | 'content_html' => $this->getRegisterTemplate_HTML_DE(), |
||
| 1460 | 'content_plain' => $this->getRegisterTemplate_PLAIN_DE(), |
||
| 1461 | 'created_at' => date(Defaults::STORAGE_DATE_FORMAT), |
||
| 1462 | ] |
||
| 1463 | ); |
||
| 1464 | } |
||
| 1465 | |||
| 1466 | private function getRegisterTemplate_HTML_EN() |
||
| 1467 | { |
||
| 1468 | return '<h3>Hello {{ firstName }} {{ lastName }}</h3> |
||
| 1469 | <p>thank you very much for your registration.</p> |
||
| 1470 | <p>You have successfully subscribed to our newsletter.</p> |
||
| 1471 | '; |
||
| 1472 | } |
||
| 1473 | |||
| 1474 | private function getRegisterTemplate_PLAIN_EN() |
||
| 1475 | { |
||
| 1476 | return 'Hello {{ firstName }} {{ lastName }} |
||
| 1477 | |||
| 1478 | thank you very much for your registration. |
||
| 1479 | |||
| 1480 | You have successfully subscribed to our newsletter. |
||
| 1481 | '; |
||
| 1482 | } |
||
| 1483 | |||
| 1484 | private function getRegisterTemplate_HTML_DE() |
||
| 1485 | { |
||
| 1486 | return '<h3>Hallo {{ firstName }} {{ lastName }}</h3> |
||
| 1487 | <p>vielen Dank für Ihre Anmeldung.</p> |
||
| 1488 | <p>Sie haben sich erfolgreich zu unserem Newsletter angemeldet.</p> |
||
| 1489 | '; |
||
| 1490 | } |
||
| 1491 | |||
| 1492 | private function getRegisterTemplate_PLAIN_DE() |
||
| 1493 | { |
||
| 1494 | return 'Hallo {{ firstName }} {{ lastName }} |
||
| 1495 | |||
| 1496 | vielen Dank für Ihre Anmeldung. |
||
| 1497 | |||
| 1498 | Sie haben sich erfolgreich zu unserem Newsletter angemeldet. |
||
| 1499 | '; |
||
| 1500 | } |
||
| 1501 | |||
| 1502 | private function getOptInTemplate_HTML_EN() |
||
| 1503 | { |
||
| 1504 | return '<h3>Hello {{ firstName }} {{ lastName }}</h3> |
||
| 1505 | <p>Thank you for your interest in our newsletter!</p> |
||
| 1506 | <p>In order to prevent misuse of your email address, we have sent you this confirmation email. Confirm that you wish to receive the newsletter regularly by clicking <a href="{{ url }}">here</a>.</p> |
||
| 1507 | <p>If you have not subscribed to the newsletter, please ignore this email.</p> |
||
| 1508 | '; |
||
| 1509 | } |
||
| 1510 | |||
| 1511 | private function getOptInTemplate_PLAIN_EN() |
||
| 1512 | { |
||
| 1513 | return 'Hello {{ firstName }} {{ lastName }} |
||
| 1514 | |||
| 1515 | Thank you for your interest in our newsletter! |
||
| 1516 | |||
| 1517 | In order to prevent misuse of your email address, we have sent you this confirmation email. Confirm that you wish to receive the newsletter regularly by clicking on the link: {{ url }} |
||
| 1518 | |||
| 1519 | If you have not subscribed to the newsletter, please ignore this email. |
||
| 1520 | '; |
||
| 1521 | } |
||
| 1522 | |||
| 1523 | private function getOptInTemplate_HTML_DE() |
||
| 1524 | { |
||
| 1525 | return '<h3>Hallo {{ firstName }} {{ lastName }}</h3> |
||
| 1526 | <p>Schön, dass Sie sich für unseren Newsletter interessieren!</p> |
||
| 1527 | <p>Um einem Missbrauch Ihrer E-Mail-Adresse vorzubeugen, haben wir Ihnen diese Bestätigungsmail gesendet. Bestätigen Sie, dass Sie den Newsletter regelmäßig erhalten wollen, indem Sie <a href="{{ url }}">hier</a> klicken.</p> |
||
| 1528 | <p>Sollten Sie den Newsletter nicht angefordert haben, ignorieren Sie diese E-Mail.</p> |
||
| 1529 | '; |
||
| 1530 | } |
||
| 1531 | |||
| 1532 | private function getOptInTemplate_PLAIN_DE() |
||
| 1533 | { |
||
| 1534 | return 'Hallo {{ firstName }} {{ lastName }} |
||
| 1535 | |||
| 1536 | Schön, dass Sie sich für unseren Newsletter interessieren! |
||
| 1537 | |||
| 1538 | Um einem Missbrauch Ihrer E-Mail-Adresse vorzubeugen, haben wir Ihnen diese Bestätigungsmail gesendet. Bestätigen Sie, dass Sie den Newsletter regelmäßig erhalten wollen, indem Sie auf den folgenden Link klicken: {{ url }} |
||
| 1539 | |||
| 1540 | Sollten Sie den Newsletter nicht angefordert haben, ignorieren Sie diese E-Mail. |
||
| 1541 | '; |
||
| 1542 | } |
||
| 1543 | |||
| 1544 | private function getMailTypeMapping(): array |
||
| 1545 | { |
||
| 1546 | return $this->mailTypes ?? $this->mailTypes = [ |
||
| 1547 | MailTemplateTypes::MAILTYPE_CUSTOMER_REGISTER => [ |
||
| 1548 | 'id' => Uuid::randomHex(), |
||
| 1549 | 'name' => 'Customer registration', |
||
| 1550 | 'nameDe' => 'Kunden-Registrierung', |
||
| 1551 | ], |
||
| 1552 | NewsletterSubscriptionServiceInterface::MAIL_TYPE_OPT_IN => [ |
||
| 1553 | 'id' => Uuid::randomHex(), |
||
| 1554 | 'name' => 'Newsletter double opt-in', |
||
| 1555 | 'nameDe' => 'Newsletter Double-Opt-In', |
||
| 1556 | ], |
||
| 1557 | NewsletterSubscriptionServiceInterface::MAIL_TYPE_REGISTER => [ |
||
| 1558 | 'id' => Uuid::randomHex(), |
||
| 1559 | 'name' => 'Newsletter registration', |
||
| 1560 | 'nameDe' => 'Newsletter-Registrierung', |
||
| 1561 | ], |
||
| 1562 | MailTemplateTypes::MAILTYPE_ORDER_CONFIRM => [ |
||
| 1563 | 'id' => Uuid::randomHex(), |
||
| 1564 | 'name' => 'Order confirmation', |
||
| 1565 | 'nameDe' => 'Bestellbestätigung', |
||
| 1566 | ], |
||
| 1567 | MailTemplateTypes::MAILTYPE_CUSTOMER_GROUP_CHANGE_ACCEPT => [ |
||
| 1568 | 'id' => Uuid::randomHex(), |
||
| 1569 | 'name' => 'Customer group change accepted', |
||
| 1570 | 'nameDe' => 'Kundengruppenwechsel akzeptiert', |
||
| 1571 | ], |
||
| 1572 | MailTemplateTypes::MAILTYPE_CUSTOMER_GROUP_CHANGE_REJECT => [ |
||
| 1573 | 'id' => Uuid::randomHex(), |
||
| 1574 | 'name' => 'Customer group change rejected', |
||
| 1575 | 'nameDe' => 'Kundengruppenwechsel abgelehnt', |
||
| 1576 | ], |
||
| 1577 | MailTemplateTypes::MAILTYPE_PASSWORD_CHANGE => [ |
||
| 1578 | 'id' => Uuid::randomHex(), |
||
| 1579 | 'name' => 'Password changed', |
||
| 1580 | 'nameDe' => 'Passwort geändert', |
||
| 1581 | ], |
||
| 1582 | MailTemplateTypes::MAILTYPE_SEPA_CONFIRMATION => [ |
||
| 1583 | 'id' => Uuid::randomHex(), |
||
| 1584 | 'name' => 'SEPA authorization', |
||
| 1585 | 'nameDe' => 'SEPA-Autorisierung', |
||
| 1586 | ], |
||
| 1587 | MailTemplateTypes::MAILTYPE_STOCK_WARNING => [ |
||
| 1588 | 'id' => Uuid::randomHex(), |
||
| 1589 | 'name' => 'Product stock warning', |
||
| 1590 | 'nameDe' => 'Lagerbestandshinweis', |
||
| 1591 | ], |
||
| 1592 | MailTemplateTypes::MAILTYPE_STATE_ENTER_ORDER_DELIVERY_STATE_RETURNED_PARTIALLY => [ |
||
| 1593 | 'id' => Uuid::randomHex(), |
||
| 1594 | 'name' => 'Enter order state: Open', |
||
| 1595 | 'nameDe' => 'Eintritt Bestellstatus: Offen', |
||
| 1596 | ], |
||
| 1597 | |||
| 1598 | MailTemplateTypes::MAILTYPE_STATE_ENTER_ORDER_DELIVERY_STATE_SHIPPED_PARTIALLY => [ |
||
| 1599 | 'id' => Uuid::randomHex(), |
||
| 1600 | 'name' => 'Enter order state: Shipped (partially)', |
||
| 1601 | 'nameDe' => 'Eintritt Bestellstatus: Teilweise versandt', |
||
| 1602 | ], |
||
| 1603 | |||
| 1604 | MailTemplateTypes::MAILTYPE_STATE_ENTER_ORDER_DELIVERY_STATE_RETURNED => [ |
||
| 1605 | 'id' => Uuid::randomHex(), |
||
| 1606 | 'name' => 'Enter order state: Returned', |
||
| 1607 | 'nameDe' => 'Eintritt Bestellstatus: Retour', |
||
| 1608 | ], |
||
| 1609 | |||
| 1610 | MailTemplateTypes::MAILTYPE_STATE_ENTER_ORDER_DELIVERY_STATE_SHIPPED => [ |
||
| 1611 | 'id' => Uuid::randomHex(), |
||
| 1612 | 'name' => 'Enter order state: Shipped', |
||
| 1613 | 'nameDe' => 'Eintritt Bestellstatus: Versandt', |
||
| 1614 | ], |
||
| 1615 | |||
| 1616 | MailTemplateTypes::MAILTYPE_STATE_ENTER_ORDER_DELIVERY_STATE_CANCELLED => [ |
||
| 1617 | 'id' => Uuid::randomHex(), |
||
| 1618 | 'name' => 'Enter order state: Cancelled', |
||
| 1619 | 'nameDe' => 'Eintritt Bestellstatus: Abgebrochen', |
||
| 1620 | ], |
||
| 1621 | |||
| 1622 | MailTemplateTypes::MAILTYPE_STATE_ENTER_ORDER_TRANSACTION_STATE_REMINDED => [ |
||
| 1623 | 'id' => Uuid::randomHex(), |
||
| 1624 | 'name' => 'Enter payment state: Reminded', |
||
| 1625 | 'nameDe' => 'Eintritt Zahlungsstatus: Erinnert', |
||
| 1626 | ], |
||
| 1627 | |||
| 1628 | MailTemplateTypes::MAILTYPE_STATE_ENTER_ORDER_TRANSACTION_STATE_REFUNDED_PARTIALLY => [ |
||
| 1629 | 'id' => Uuid::randomHex(), |
||
| 1630 | 'name' => 'Enter payment state: Refunded (partially)', |
||
| 1631 | 'nameDe' => 'Eintritt Zahlungsstatus: Teilweise erstattet', |
||
| 1632 | ], |
||
| 1633 | |||
| 1634 | MailTemplateTypes::MAILTYPE_STATE_ENTER_ORDER_TRANSACTION_STATE_CANCELLED => [ |
||
| 1635 | 'id' => Uuid::randomHex(), |
||
| 1636 | 'name' => 'Enter payment state: Cancelled', |
||
| 1637 | 'nameDe' => 'Eintritt Zahlungsstatus: Abgebrochen', |
||
| 1638 | ], |
||
| 1639 | |||
| 1640 | MailTemplateTypes::MAILTYPE_STATE_ENTER_ORDER_TRANSACTION_STATE_PAID => [ |
||
| 1641 | 'id' => Uuid::randomHex(), |
||
| 1642 | 'name' => 'Enter payment state: Paid', |
||
| 1643 | 'nameDe' => 'Eintritt Zahlungsstatus: Bezahlt', |
||
| 1644 | ], |
||
| 1645 | |||
| 1646 | MailTemplateTypes::MAILTYPE_STATE_ENTER_ORDER_TRANSACTION_STATE_REFUNDED => [ |
||
| 1647 | 'id' => Uuid::randomHex(), |
||
| 1648 | 'name' => 'Enter payment state: Refunded', |
||
| 1649 | 'nameDe' => 'Eintritt Zahlungsstatus: Erstattet', |
||
| 1650 | ], |
||
| 1651 | |||
| 1652 | MailTemplateTypes::MAILTYPE_STATE_ENTER_ORDER_TRANSACTION_STATE_PAID_PARTIALLY => [ |
||
| 1653 | 'id' => Uuid::randomHex(), |
||
| 1654 | 'name' => 'Enter payment state: Paid (partially)', |
||
| 1655 | 'nameDe' => 'Eintritt Zahlungsstatus: Teilweise bezahlt', |
||
| 1656 | ], |
||
| 1657 | |||
| 1658 | MailTemplateTypes::MAILTYPE_STATE_ENTER_ORDER_TRANSACTION_STATE_OPEN => [ |
||
| 1659 | 'id' => Uuid::randomHex(), |
||
| 1660 | 'name' => 'Enter payment state: Open', |
||
| 1661 | 'nameDe' => 'Eintritt Zahlungsstatus: Offen', |
||
| 1662 | ], |
||
| 1663 | |||
| 1664 | MailTemplateTypes::MAILTYPE_STATE_ENTER_ORDER_STATE_OPEN => [ |
||
| 1665 | 'id' => Uuid::randomHex(), |
||
| 1666 | 'name' => 'Enter order state: Open', |
||
| 1667 | 'nameDe' => 'Eintritt Bestellstatus: Offen', |
||
| 1668 | ], |
||
| 1669 | |||
| 1670 | MailTemplateTypes::MAILTYPE_STATE_ENTER_ORDER_STATE_IN_PROGRESS => [ |
||
| 1671 | 'id' => Uuid::randomHex(), |
||
| 1672 | 'name' => 'Enter order state: In progress', |
||
| 1673 | 'nameDe' => 'Eintritt Bestellstatus: In Bearbeitung', |
||
| 1674 | ], |
||
| 1675 | |||
| 1676 | MailTemplateTypes::MAILTYPE_STATE_ENTER_ORDER_STATE_CANCELLED => [ |
||
| 1677 | 'id' => Uuid::randomHex(), |
||
| 1678 | 'name' => 'Enter order state: Cancelled', |
||
| 1679 | 'nameDe' => 'Eintritt Bestellstatus: Abgebrochen', |
||
| 1680 | ], |
||
| 1681 | |||
| 1682 | MailTemplateTypes::MAILTYPE_STATE_ENTER_ORDER_STATE_COMPLETED => [ |
||
| 1683 | 'id' => Uuid::randomHex(), |
||
| 1684 | 'name' => 'Enter order state: Done', |
||
| 1685 | 'nameDe' => 'Eintritt Bestellstatus: Abgeschlossen', |
||
| 1686 | ], |
||
| 1687 | ]; |
||
| 1688 | } |
||
| 1689 | |||
| 1690 | private function createMailTemplateTypes(Connection $connection) |
||
| 1691 | { |
||
| 1692 | $definitionMailTypes = $this->getMailTypeMapping(); |
||
| 1693 | |||
| 1694 | $languageEn = Uuid::fromHexToBytes(Defaults::LANGUAGE_SYSTEM); |
||
| 1695 | $languageDe = Uuid::fromHexToBytes(Defaults::LANGUAGE_SYSTEM_DE); |
||
| 1696 | |||
| 1697 | foreach ($definitionMailTypes as $typeName => $mailType) { |
||
| 1698 | $connection->insert( |
||
| 1699 | 'mail_template_type', |
||
| 1700 | [ |
||
| 1701 | 'id' => Uuid::fromHexToBytes($mailType['id']), |
||
| 1702 | 'technical_name' => $typeName, |
||
| 1703 | 'created_at' => date(Defaults::STORAGE_DATE_FORMAT), |
||
| 1704 | ] |
||
| 1705 | ); |
||
| 1706 | $connection->insert( |
||
| 1707 | 'mail_template_type_translation', |
||
| 1708 | [ |
||
| 1709 | 'mail_template_type_id' => Uuid::fromHexToBytes($mailType['id']), |
||
| 1710 | 'name' => $mailType['name'], |
||
| 1711 | 'language_id' => $languageEn, |
||
| 1712 | 'created_at' => date(Defaults::STORAGE_DATE_FORMAT), |
||
| 1713 | ] |
||
| 1714 | ); |
||
| 1715 | $connection->insert( |
||
| 1716 | 'mail_template_type_translation', |
||
| 1717 | [ |
||
| 1718 | 'mail_template_type_id' => Uuid::fromHexToBytes($mailType['id']), |
||
| 1719 | 'name' => $mailType['nameDe'], |
||
| 1720 | 'language_id' => $languageDe, |
||
| 1721 | 'created_at' => date(Defaults::STORAGE_DATE_FORMAT), |
||
| 1722 | ] |
||
| 1723 | ); |
||
| 1724 | } |
||
| 1725 | } |
||
| 1726 | |||
| 1727 | private function createDocumentConfiguration(Connection $connection) |
||
| 1728 | { |
||
| 1729 | $stornoId = Uuid::randomBytes(); |
||
| 1730 | |||
| 1731 | $connection->insert('document_type', ['id' => $stornoId, 'technical_name' => StornoGenerator::STORNO, 'created_at' => (new \DateTime())->format(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 1732 | $connection->insert('document_type_translation', ['document_type_id' => $stornoId, 'language_id' => Uuid::fromHexToBytes(Defaults::LANGUAGE_SYSTEM_DE), 'name' => 'Stornorechnung', 'created_at' => (new \DateTime())->format(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 1733 | $connection->insert('document_type_translation', ['document_type_id' => $stornoId, 'language_id' => Uuid::fromHexToBytes(Defaults::LANGUAGE_SYSTEM), 'name' => 'Storno bill', 'created_at' => (new \DateTime())->format(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 1734 | |||
| 1735 | $stornoConfigId = Uuid::randomBytes(); |
||
| 1736 | $invoiceConfigId = Uuid::randomBytes(); |
||
| 1737 | $deliveryConfigId = Uuid::randomBytes(); |
||
| 1738 | $creditConfigId = Uuid::randomBytes(); |
||
| 1739 | |||
| 1740 | $invoiceId = $connection->fetchColumn('SELECT id FROM `document_type` WHERE `technical_name` = :technical_name', ['technical_name' => InvoiceGenerator::INVOICE]); |
||
| 1741 | $deliverNoteId = $connection->fetchColumn('SELECT id FROM `document_type` WHERE `technical_name` = :technical_name', ['technical_name' => DeliveryNoteGenerator::DELIVERY_NOTE]); |
||
| 1742 | $creditNoteId = $connection->fetchColumn('SELECT id FROM `document_type` WHERE `technical_name` = :technical_name', ['technical_name' => CreditNoteGenerator::CREDIT_NOTE]); |
||
| 1743 | |||
| 1744 | $defaultConfig = [ |
||
| 1745 | 'displayPrices' => true, |
||
| 1746 | 'displayFooter' => true, |
||
| 1747 | 'displayHeader' => true, |
||
| 1748 | 'displayLineItems' => true, |
||
| 1749 | 'diplayLineItemPosition' => true, |
||
| 1750 | 'displayPageCount' => true, |
||
| 1751 | 'displayCompanyAddress' => true, |
||
| 1752 | 'pageOrientation' => 'portrait', |
||
| 1753 | 'pageSize' => 'a4', |
||
| 1754 | 'itemsPerPage' => 10, |
||
| 1755 | 'companyName' => 'Muster AG', |
||
| 1756 | 'taxNumber' => '000111000', |
||
| 1757 | 'vatId' => 'XX 111 222 333', |
||
| 1758 | 'taxOffice' => 'Coesfeld', |
||
| 1759 | 'bankName' => 'Kreissparkasse Münster', |
||
| 1760 | 'bankIban' => 'DE11111222223333344444', |
||
| 1761 | 'bankBic' => 'SWSKKEFF', |
||
| 1762 | 'placeOfJurisdiction' => 'Coesfeld', |
||
| 1763 | 'placeOfFulfillment' => 'Coesfeld', |
||
| 1764 | 'executiveDirector' => 'Max Mustermann', |
||
| 1765 | 'companyAddress' => 'Muster AG - Ebbinghoff 10 - 48624 Schöppingen', |
||
| 1766 | ]; |
||
| 1767 | |||
| 1768 | $deliveryNoteConfig = $defaultConfig; |
||
| 1769 | $deliveryNoteConfig['displayPrices'] = false; |
||
| 1770 | |||
| 1771 | $stornoConfig = $defaultConfig; |
||
| 1772 | $stornoConfig['referencedDocumentType'] = InvoiceGenerator::INVOICE; |
||
| 1773 | |||
| 1774 | $configJson = json_encode($defaultConfig); |
||
| 1775 | $deliveryNoteConfigJson = json_encode($deliveryNoteConfig); |
||
| 1776 | $stornoConfigJson = json_encode($stornoConfig); |
||
| 1777 | |||
| 1778 | $connection->insert('document_base_config', ['id' => $stornoConfigId, 'name' => StornoGenerator::STORNO, 'global' => 1, 'filename_prefix' => StornoGenerator::STORNO . '_', 'document_type_id' => $stornoId, 'config' => $stornoConfigJson, 'created_at' => (new \DateTime())->format(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 1779 | $connection->insert('document_base_config', ['id' => $invoiceConfigId, 'name' => InvoiceGenerator::INVOICE, 'global' => 1, 'filename_prefix' => InvoiceGenerator::INVOICE . '_', 'document_type_id' => $invoiceId, 'config' => $configJson, 'created_at' => (new \DateTime())->format(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 1780 | $connection->insert('document_base_config', ['id' => $deliveryConfigId, 'name' => DeliveryNoteGenerator::DELIVERY_NOTE, 'global' => 1, 'filename_prefix' => DeliveryNoteGenerator::DELIVERY_NOTE . '_', 'document_type_id' => $deliverNoteId, 'config' => $deliveryNoteConfigJson, 'created_at' => (new \DateTime())->format(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 1781 | $connection->insert('document_base_config', ['id' => $creditConfigId, 'name' => CreditNoteGenerator::CREDIT_NOTE, 'global' => 1, 'filename_prefix' => CreditNoteGenerator::CREDIT_NOTE . '_', 'document_type_id' => $creditNoteId, 'config' => $configJson, 'created_at' => (new \DateTime())->format(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 1782 | |||
| 1783 | $connection->insert('document_base_config_sales_channel', ['id' => Uuid::randomBytes(), 'document_base_config_id' => $stornoConfigId, 'document_type_id' => $stornoId, 'created_at' => (new \DateTime())->format(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 1784 | $connection->insert('document_base_config_sales_channel', ['id' => Uuid::randomBytes(), 'document_base_config_id' => $invoiceConfigId, 'document_type_id' => $invoiceId, 'created_at' => (new \DateTime())->format(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 1785 | $connection->insert('document_base_config_sales_channel', ['id' => Uuid::randomBytes(), 'document_base_config_id' => $deliveryConfigId, 'document_type_id' => $deliverNoteId, 'created_at' => (new \DateTime())->format(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 1786 | $connection->insert('document_base_config_sales_channel', ['id' => Uuid::randomBytes(), 'document_base_config_id' => $creditConfigId, 'document_type_id' => $creditNoteId, 'created_at' => (new \DateTime())->format(Defaults::STORAGE_DATE_FORMAT)]); |
||
| 1787 | |||
| 1788 | // number ranges |
||
| 1789 | $definitionNumberRangeTypes = [ |
||
| 1790 | 'document_invoice' => [ |
||
| 1791 | 'id' => Uuid::randomHex(), |
||
| 1792 | 'global' => 0, |
||
| 1793 | 'nameDe' => 'Rechnung', |
||
| 1794 | ], |
||
| 1795 | 'document_storno' => [ |
||
| 1796 | 'id' => Uuid::randomHex(), |
||
| 1797 | 'global' => 0, |
||
| 1798 | 'nameDe' => 'Storno', |
||
| 1799 | ], |
||
| 1800 | 'document_delivery_note' => [ |
||
| 1801 | 'id' => Uuid::randomHex(), |
||
| 1802 | 'global' => 0, |
||
| 1803 | 'nameDe' => 'Lieferschein', |
||
| 1804 | ], |
||
| 1805 | 'document_credit_note' => [ |
||
| 1806 | 'id' => Uuid::randomHex(), |
||
| 1807 | 'global' => 0, |
||
| 1808 | 'nameDe' => 'Gutschrift', |
||
| 1809 | ], |
||
| 1810 | ]; |
||
| 1811 | |||
| 1812 | $definitionNumberRanges = [ |
||
| 1813 | 'document_invoice' => [ |
||
| 1814 | 'id' => Uuid::randomHex(), |
||
| 1815 | 'name' => 'Invoices', |
||
| 1816 | 'nameDe' => 'Rechnung', |
||
| 1817 | 'global' => 1, |
||
| 1818 | 'typeId' => $definitionNumberRangeTypes['document_invoice']['id'], |
||
| 1819 | 'pattern' => '{n}', |
||
| 1820 | 'start' => 1000, |
||
| 1821 | ], |
||
| 1822 | 'document_storno' => [ |
||
| 1823 | 'id' => Uuid::randomHex(), |
||
| 1824 | 'name' => 'Stornos', |
||
| 1825 | 'nameDe' => 'Storno', |
||
| 1826 | 'global' => 1, |
||
| 1827 | 'typeId' => $definitionNumberRangeTypes['document_storno']['id'], |
||
| 1828 | 'pattern' => '{n}', |
||
| 1829 | 'start' => 1000, |
||
| 1830 | ], |
||
| 1831 | 'document_delivery_note' => [ |
||
| 1832 | 'id' => Uuid::randomHex(), |
||
| 1833 | 'name' => 'DeliveryNotes', |
||
| 1834 | 'nameDe' => 'Lieferschein', |
||
| 1835 | 'global' => 1, |
||
| 1836 | 'typeId' => $definitionNumberRangeTypes['document_delivery_note']['id'], |
||
| 1837 | 'pattern' => '{n}', |
||
| 1838 | 'start' => 1000, |
||
| 1839 | ], |
||
| 1840 | 'document_credit_note' => [ |
||
| 1841 | 'id' => Uuid::randomHex(), |
||
| 1842 | 'name' => 'CreditNotes', |
||
| 1843 | 'nameDe' => 'Gutschrift', |
||
| 1844 | 'global' => 1, |
||
| 1845 | 'typeId' => $definitionNumberRangeTypes['document_credit_note']['id'], |
||
| 1846 | 'pattern' => '{n}', |
||
| 1847 | 'start' => 1000, |
||
| 1848 | ], |
||
| 1849 | ]; |
||
| 1850 | |||
| 1851 | $languageEn = Uuid::fromHexToBytes(Defaults::LANGUAGE_SYSTEM); |
||
| 1852 | $languageDe = Uuid::fromHexToBytes(Defaults::LANGUAGE_SYSTEM_DE); |
||
| 1853 | |||
| 1854 | foreach ($definitionNumberRangeTypes as $typeName => $numberRangeType) { |
||
| 1855 | $connection->insert( |
||
| 1856 | 'number_range_type', |
||
| 1857 | [ |
||
| 1858 | 'id' => Uuid::fromHexToBytes($numberRangeType['id']), |
||
| 1859 | 'global' => $numberRangeType['global'], |
||
| 1860 | 'technical_name' => $typeName, |
||
| 1861 | 'created_at' => date(Defaults::STORAGE_DATE_FORMAT), |
||
| 1862 | ] |
||
| 1863 | ); |
||
| 1864 | $connection->insert( |
||
| 1865 | 'number_range_type_translation', |
||
| 1866 | [ |
||
| 1867 | 'number_range_type_id' => Uuid::fromHexToBytes($numberRangeType['id']), |
||
| 1868 | 'type_name' => $typeName, |
||
| 1869 | 'language_id' => $languageEn, |
||
| 1870 | 'created_at' => date(Defaults::STORAGE_DATE_FORMAT), |
||
| 1871 | ] |
||
| 1872 | ); |
||
| 1873 | $connection->insert( |
||
| 1874 | 'number_range_type_translation', |
||
| 1875 | [ |
||
| 1876 | 'number_range_type_id' => Uuid::fromHexToBytes($numberRangeType['id']), |
||
| 1877 | 'type_name' => $numberRangeType['nameDe'], |
||
| 1878 | 'language_id' => $languageDe, |
||
| 1879 | 'created_at' => date(Defaults::STORAGE_DATE_FORMAT), |
||
| 1880 | ] |
||
| 1881 | ); |
||
| 1882 | } |
||
| 1883 | |||
| 1884 | foreach ($definitionNumberRanges as $typeName => $numberRange) { |
||
| 1885 | $connection->insert( |
||
| 1886 | 'number_range', |
||
| 1887 | [ |
||
| 1888 | 'id' => Uuid::fromHexToBytes($numberRange['id']), |
||
| 1889 | 'global' => $numberRange['global'], |
||
| 1890 | 'type_id' => Uuid::fromHexToBytes($numberRange['typeId']), |
||
| 1891 | 'pattern' => $numberRange['pattern'], |
||
| 1892 | 'start' => $numberRange['start'], |
||
| 1893 | 'created_at' => date(Defaults::STORAGE_DATE_FORMAT), |
||
| 1894 | ] |
||
| 1895 | ); |
||
| 1896 | $connection->insert( |
||
| 1897 | 'number_range_translation', |
||
| 1898 | [ |
||
| 1899 | 'number_range_id' => Uuid::fromHexToBytes($numberRange['id']), |
||
| 1900 | 'name' => $numberRange['name'], |
||
| 1901 | 'language_id' => $languageEn, |
||
| 1902 | 'created_at' => date(Defaults::STORAGE_DATE_FORMAT), |
||
| 1903 | ] |
||
| 1904 | ); |
||
| 1905 | $connection->insert( |
||
| 1906 | 'number_range_translation', |
||
| 1907 | [ |
||
| 1908 | 'number_range_id' => Uuid::fromHexToBytes($numberRange['id']), |
||
| 1909 | 'name' => $numberRange['nameDe'], |
||
| 1910 | 'language_id' => $languageDe, |
||
| 1911 | 'created_at' => date(Defaults::STORAGE_DATE_FORMAT), |
||
| 1912 | ] |
||
| 1913 | ); |
||
| 1914 | } |
||
| 1915 | } |
||
| 1916 | |||
| 1917 | private function createMailEvents(Connection $connection) |
||
| 1918 | { |
||
| 1919 | $orderCofirmationTemplateId = Uuid::randomBytes(); |
||
| 1920 | |||
| 1921 | $connection->insert( |
||
| 1922 | 'mail_template', |
||
| 1923 | [ |
||
| 1924 | 'id' => $orderCofirmationTemplateId, |
||
| 1925 | 'mail_template_type_id' => Uuid::fromHexToBytes($this->getMailTypeMapping()[MailTemplateTypes::MAILTYPE_ORDER_CONFIRM]['id']), |
||
| 1926 | 'system_default' => 1, |
||
| 1927 | 'created_at' => date(Defaults::STORAGE_DATE_FORMAT), |
||
| 1928 | ] |
||
| 1929 | ); |
||
| 1930 | |||
| 1931 | $connection->insert( |
||
| 1932 | 'mail_template_translation', |
||
| 1933 | [ |
||
| 1934 | 'mail_template_id' => $orderCofirmationTemplateId, |
||
| 1935 | 'language_id' => Uuid::fromHexToBytes(Defaults::LANGUAGE_SYSTEM), |
||
| 1936 | 'subject' => 'Order confirmation', |
||
| 1937 | 'description' => '', |
||
| 1938 | 'sender_name' => 'Shop', |
||
| 1939 | 'content_html' => $this->getHtmlTemplateEn(), |
||
| 1940 | 'content_plain' => $this->getPlainTemplateEn(), |
||
| 1941 | 'created_at' => date(Defaults::STORAGE_DATE_FORMAT), |
||
| 1942 | ] |
||
| 1943 | ); |
||
| 1944 | |||
| 1945 | $connection->insert( |
||
| 1946 | 'mail_template_translation', |
||
| 1947 | [ |
||
| 1948 | 'mail_template_id' => $orderCofirmationTemplateId, |
||
| 1949 | 'language_id' => Uuid::fromHexToBytes(Defaults::LANGUAGE_SYSTEM_DE), |
||
| 1950 | 'subject' => 'Bestellbestätigung', |
||
| 1951 | 'description' => '', |
||
| 1952 | 'sender_name' => 'Shop', |
||
| 1953 | 'content_html' => $this->getHtmlTemplateDe(), |
||
| 1954 | 'content_plain' => $this->getPlainTemplateDe(), |
||
| 1955 | 'created_at' => date(Defaults::STORAGE_DATE_FORMAT), |
||
| 1956 | ] |
||
| 1957 | ); |
||
| 1958 | |||
| 1959 | $connection->insert( |
||
| 1960 | 'event_action', |
||
| 1961 | [ |
||
| 1962 | 'id' => Uuid::randomBytes(), |
||
| 1963 | 'event_name' => CheckoutOrderPlacedEvent::EVENT_NAME, |
||
| 1964 | 'action_name' => MailSendSubscriber::ACTION_NAME, |
||
| 1965 | 'config' => json_encode([ |
||
| 1966 | 'mail_template_type_id' => $this->getMailTypeMapping()[MailTemplateTypes::MAILTYPE_ORDER_CONFIRM]['id'], |
||
| 1967 | ]), |
||
| 1968 | 'created_at' => date(Defaults::STORAGE_DATE_FORMAT), |
||
| 1969 | ] |
||
| 1970 | ); |
||
| 1971 | |||
| 1972 | $customerRegistrationTemplateId = Uuid::randomBytes(); |
||
| 1973 | |||
| 1974 | $connection->insert( |
||
| 1975 | 'mail_template', |
||
| 1976 | [ |
||
| 1977 | 'id' => $customerRegistrationTemplateId, |
||
| 1978 | 'mail_template_type_id' => Uuid::fromHexToBytes($this->getMailTypeMapping()[MailTemplateTypes::MAILTYPE_CUSTOMER_REGISTER]['id']), |
||
| 1979 | 'system_default' => 1, |
||
| 1980 | 'created_at' => date(Defaults::STORAGE_DATE_FORMAT), |
||
| 1981 | ] |
||
| 1982 | ); |
||
| 1983 | |||
| 1984 | $connection->insert( |
||
| 1985 | 'mail_template_translation', |
||
| 1986 | [ |
||
| 1987 | 'mail_template_id' => $customerRegistrationTemplateId, |
||
| 1988 | 'language_id' => Uuid::fromHexToBytes(Defaults::LANGUAGE_SYSTEM), |
||
| 1989 | 'subject' => 'Your Registration at {{ salesChannel.name }}', |
||
| 1990 | 'description' => 'Registration confirmation', |
||
| 1991 | 'sender_name' => '{{ salesChannel.name }}', |
||
| 1992 | 'content_html' => $this->getRegistrationHtmlTemplateEn(), |
||
| 1993 | 'content_plain' => $this->getRegistrationPlainTemplateEn(), |
||
| 1994 | 'created_at' => date(Defaults::STORAGE_DATE_FORMAT), |
||
| 1995 | ] |
||
| 1996 | ); |
||
| 1997 | |||
| 1998 | $connection->insert( |
||
| 1999 | 'mail_template_translation', |
||
| 2000 | [ |
||
| 2001 | 'mail_template_id' => $customerRegistrationTemplateId, |
||
| 2002 | 'language_id' => Uuid::fromHexToBytes(Defaults::LANGUAGE_SYSTEM_DE), |
||
| 2003 | 'subject' => 'Deine Registrierung bei {{ salesChannel.name }}', |
||
| 2004 | 'description' => 'Registrierungsbestätigung', |
||
| 2005 | 'sender_name' => '{{ salesChannel.name }}', |
||
| 2006 | 'content_html' => $this->getRegistrationHtmlTemplateDe(), |
||
| 2007 | 'content_plain' => $this->getRegistrationPlainTemplateDe(), |
||
| 2008 | 'created_at' => date(Defaults::STORAGE_DATE_FORMAT), |
||
| 2009 | ] |
||
| 2010 | ); |
||
| 2011 | |||
| 2012 | $passwordChangeTemplateId = Uuid::randomBytes(); |
||
| 2013 | |||
| 2014 | $connection->insert( |
||
| 2015 | 'mail_template', |
||
| 2016 | [ |
||
| 2017 | 'id' => $passwordChangeTemplateId, |
||
| 2018 | 'mail_template_type_id' => Uuid::fromHexToBytes($this->getMailTypeMapping()[MailTemplateTypes::MAILTYPE_PASSWORD_CHANGE]['id']), |
||
| 2019 | 'system_default' => 1, |
||
| 2020 | 'created_at' => date(Defaults::STORAGE_DATE_FORMAT), |
||
| 2021 | ] |
||
| 2022 | ); |
||
| 2023 | |||
| 2024 | $connection->insert( |
||
| 2025 | 'mail_template_translation', |
||
| 2026 | [ |
||
| 2027 | 'subject' => 'Password reset - {{ salesChannel.name }}', |
||
| 2028 | 'description' => 'Password reset request', |
||
| 2029 | 'sender_name' => '{{ salesChannel.name }}', |
||
| 2030 | 'content_html' => $this->getPasswordChangeHtmlTemplateEn(), |
||
| 2031 | 'content_plain' => $this->getPasswordChangePlainTemplateEn(), |
||
| 2032 | 'created_at' => date(Defaults::STORAGE_DATE_FORMAT), |
||
| 2033 | 'mail_template_id' => $passwordChangeTemplateId, |
||
| 2034 | 'language_id' => Uuid::fromHexToBytes(Defaults::LANGUAGE_SYSTEM), |
||
| 2035 | ] |
||
| 2036 | ); |
||
| 2037 | |||
| 2038 | $connection->insert( |
||
| 2039 | 'mail_template_translation', |
||
| 2040 | [ |
||
| 2041 | 'subject' => 'Password zurücksetzen - {{ salesChannel.name }}', |
||
| 2042 | 'description' => 'Passwort zurücksetzen Anfrage', |
||
| 2043 | 'sender_name' => '{{ salesChannel.name }}', |
||
| 2044 | 'content_html' => $this->getPasswordChangeHtmlTemplateDe(), |
||
| 2045 | 'content_plain' => $this->getPasswordChangePlainTemplateDe(), |
||
| 2046 | 'created_at' => date(Defaults::STORAGE_DATE_FORMAT), |
||
| 2047 | 'mail_template_id' => $passwordChangeTemplateId, |
||
| 2048 | 'language_id' => Uuid::fromHexToBytes(Defaults::LANGUAGE_SYSTEM_DE), |
||
| 2049 | ] |
||
| 2050 | ); |
||
| 2051 | |||
| 2052 | $customerGroupChangeAcceptedTemplateId = Uuid::randomBytes(); |
||
| 2053 | |||
| 2054 | $connection->insert( |
||
| 2055 | 'mail_template', |
||
| 2056 | [ |
||
| 2057 | 'id' => $customerGroupChangeAcceptedTemplateId, |
||
| 2058 | 'mail_template_type_id' => Uuid::fromHexToBytes($this->getMailTypeMapping()[MailTemplateTypes::MAILTYPE_CUSTOMER_GROUP_CHANGE_ACCEPT]['id']), |
||
| 2059 | 'system_default' => 1, |
||
| 2060 | 'created_at' => date(Defaults::STORAGE_DATE_FORMAT), |
||
| 2061 | ] |
||
| 2062 | ); |
||
| 2063 | |||
| 2064 | $connection->insert( |
||
| 2065 | 'mail_template_translation', |
||
| 2066 | [ |
||
| 2067 | 'subject' => 'Your merchant account has been unlocked - {{ salesChannel.name }}', |
||
| 2068 | 'description' => 'Customer Group Change accepted', |
||
| 2069 | 'sender_name' => '{{ salesChannel.name }}', |
||
| 2070 | 'content_html' => $this->getCustomerGroupChangeAcceptedHtmlTemplateEn(), |
||
| 2071 | 'content_plain' => $this->getCustomerGroupChangeAcceptedPlainTemplateEn(), |
||
| 2072 | 'created_at' => date(Defaults::STORAGE_DATE_FORMAT), |
||
| 2073 | 'mail_template_id' => $customerGroupChangeAcceptedTemplateId, |
||
| 2074 | 'language_id' => Uuid::fromHexToBytes(Defaults::LANGUAGE_SYSTEM), |
||
| 2075 | ] |
||
| 2076 | ); |
||
| 2077 | |||
| 2078 | $connection->insert( |
||
| 2079 | 'mail_template_translation', |
||
| 2080 | [ |
||
| 2081 | 'subject' => 'Ihr Händleraccount wurde freigeschaltet - {{ salesChannel.name }}', |
||
| 2082 | 'description' => 'Kundengruppenwechsel freigeschaltet', |
||
| 2083 | 'sender_name' => '{{ salesChannel.name }}', |
||
| 2084 | 'content_html' => $this->getCustomerGroupChangeAcceptedHtmlTemplateDe(), |
||
| 2085 | 'content_plain' => $this->getCustomerGroupChangeAcceptedPlainTemplateDe(), |
||
| 2086 | 'created_at' => date(Defaults::STORAGE_DATE_FORMAT), |
||
| 2087 | 'mail_template_id' => $customerGroupChangeAcceptedTemplateId, |
||
| 2088 | 'language_id' => Uuid::fromHexToBytes(Defaults::LANGUAGE_SYSTEM_DE), |
||
| 2089 | ] |
||
| 2090 | ); |
||
| 2091 | |||
| 2092 | $customerGroupChangeRejectedTemplateId = Uuid::randomBytes(); |
||
| 2093 | |||
| 2094 | $connection->insert( |
||
| 2095 | 'mail_template', |
||
| 2096 | [ |
||
| 2097 | 'id' => $customerGroupChangeRejectedTemplateId, |
||
| 2098 | 'mail_template_type_id' => Uuid::fromHexToBytes($this->getMailTypeMapping()[MailTemplateTypes::MAILTYPE_CUSTOMER_GROUP_CHANGE_REJECT]['id']), |
||
| 2099 | 'system_default' => 1, |
||
| 2100 | 'created_at' => date(Defaults::STORAGE_DATE_FORMAT), |
||
| 2101 | ] |
||
| 2102 | ); |
||
| 2103 | |||
| 2104 | $connection->insert( |
||
| 2105 | 'mail_template_translation', |
||
| 2106 | [ |
||
| 2107 | 'subject' => 'Your trader account has not been accepted - {{ salesChannel.name }}', |
||
| 2108 | 'description' => 'Customer Group Change rejected', |
||
| 2109 | 'sender_name' => '{{ salesChannel.name }}', |
||
| 2110 | 'content_html' => $this->getCustomerGroupChangeRejectedHtmlTemplateEn(), |
||
| 2111 | 'content_plain' => $this->getCustomerGroupChangeRejectedPlainTemplateEn(), |
||
| 2112 | 'created_at' => date(Defaults::STORAGE_DATE_FORMAT), |
||
| 2113 | 'mail_template_id' => $customerGroupChangeRejectedTemplateId, |
||
| 2114 | 'language_id' => Uuid::fromHexToBytes(Defaults::LANGUAGE_SYSTEM), |
||
| 2115 | ] |
||
| 2116 | ); |
||
| 2117 | |||
| 2118 | $connection->insert( |
||
| 2119 | 'mail_template_translation', |
||
| 2120 | [ |
||
| 2121 | 'subject' => 'Ihr Händleraccountantrag wurde abgelehnt - {{ salesChannel.name }}', |
||
| 2122 | 'description' => 'Kundengruppenwechsel abgelehnt', |
||
| 2123 | 'sender_name' => '{{ salesChannel.name }}', |
||
| 2124 | 'content_html' => $this->getCustomerGroupChangeRejectedHtmlTemplateDe(), |
||
| 2125 | 'content_plain' => $this->getCustomerGroupChangeRejectedPlainTemplateDe(), |
||
| 2126 | 'created_at' => date(Defaults::STORAGE_DATE_FORMAT), |
||
| 2127 | 'mail_template_id' => $customerGroupChangeRejectedTemplateId, |
||
| 2128 | 'language_id' => Uuid::fromHexToBytes(Defaults::LANGUAGE_SYSTEM_DE), |
||
| 2129 | ] |
||
| 2130 | ); |
||
| 2131 | |||
| 2132 | $connection->insert( |
||
| 2133 | 'event_action', |
||
| 2134 | [ |
||
| 2135 | 'id' => Uuid::randomBytes(), |
||
| 2136 | 'event_name' => CustomerRegisterEvent::EVENT_NAME, |
||
| 2137 | 'action_name' => MailSendSubscriber::ACTION_NAME, |
||
| 2138 | 'config' => json_encode([ |
||
| 2139 | 'mail_template_type_id' => $this->getMailTypeMapping()[MailTemplateTypes::MAILTYPE_CUSTOMER_REGISTER]['id'], |
||
| 2140 | ]), |
||
| 2141 | 'created_at' => date(Defaults::STORAGE_DATE_FORMAT), |
||
| 2142 | ] |
||
| 2143 | ); |
||
| 2144 | |||
| 2145 | $connection->insert( |
||
| 2146 | 'event_action', |
||
| 2147 | [ |
||
| 2148 | 'id' => Uuid::randomBytes(), |
||
| 2149 | 'event_name' => NewsletterRegisterEvent::EVENT_NAME, |
||
| 2150 | 'action_name' => MailSendSubscriber::ACTION_NAME, |
||
| 2151 | 'config' => json_encode([ |
||
| 2152 | 'mail_template_type_id' => $this->getMailTypeMapping()[NewsletterSubscriptionServiceInterface::MAIL_TYPE_OPT_IN]['id'], |
||
| 2153 | ]), |
||
| 2154 | 'created_at' => date(Defaults::STORAGE_DATE_FORMAT), |
||
| 2155 | ] |
||
| 2156 | ); |
||
| 2157 | |||
| 2158 | $connection->insert( |
||
| 2159 | 'event_action', |
||
| 2160 | [ |
||
| 2161 | 'id' => Uuid::randomBytes(), |
||
| 2162 | 'event_name' => NewsletterConfirmEvent::EVENT_NAME, |
||
| 2163 | 'action_name' => MailSendSubscriber::ACTION_NAME, |
||
| 2164 | 'config' => json_encode([ |
||
| 2165 | 'mail_template_type_id' => $this->getMailTypeMapping()[NewsletterSubscriptionServiceInterface::MAIL_TYPE_REGISTER]['id'], |
||
| 2166 | ]), |
||
| 2167 | 'created_at' => date(Defaults::STORAGE_DATE_FORMAT), |
||
| 2168 | ] |
||
| 2169 | ); |
||
| 2170 | } |
||
| 2171 | |||
| 2172 | private function getHtmlTemplateEn(): string |
||
| 2173 | { |
||
| 2174 | return '<div style="font-family:arial; font-size:12px;"> |
||
| 2175 | |||
| 2176 | {% set currencyIsoCode = order.currency.isoCode %} |
||
| 2177 | Dear {{order.orderCustomer.salutation.displayName }} {{order.orderCustomer.lastName}},<br> |
||
| 2178 | <br> |
||
| 2179 | Thank you for your order at {{ salesChannel.name }} (Number: {{order.orderNumber}}) on {{ order.orderDate|date }}.<br> |
||
| 2180 | <br> |
||
| 2181 | <strong>Information on your order:</strong><br> |
||
| 2182 | <br> |
||
| 2183 | |||
| 2184 | <table width="80%" border="0" style="font-family:Arial, Helvetica, sans-serif; font-size:12px;"> |
||
| 2185 | <tr> |
||
| 2186 | <td bgcolor="#F7F7F2" style="border-bottom:1px solid #cccccc;"><strong>Pos.</strong></td> |
||
| 2187 | <td bgcolor="#F7F7F2" style="border-bottom:1px solid #cccccc;"><strong>Description</strong></td> |
||
| 2188 | <td bgcolor="#F7F7F2" style="border-bottom:1px solid #cccccc;"><strong>Quantities</strong></td> |
||
| 2189 | <td bgcolor="#F7F7F2" style="border-bottom:1px solid #cccccc;"><strong>Price</strong></td> |
||
| 2190 | <td bgcolor="#F7F7F2" style="border-bottom:1px solid #cccccc;"><strong>Total</strong></td> |
||
| 2191 | </tr> |
||
| 2192 | |||
| 2193 | {% for lineItem in order.lineItems %} |
||
| 2194 | <tr> |
||
| 2195 | <td style="border-bottom:1px solid #cccccc;">{{ loop.index }} </td> |
||
| 2196 | <td style="border-bottom:1px solid #cccccc;"> |
||
| 2197 | {{ lineItem.label|wordwrap(80) }}<br> |
||
| 2198 | Art. No.: {{ lineItem.payload.productNumber|wordwrap(80) }} |
||
| 2199 | </td> |
||
| 2200 | <td style="border-bottom:1px solid #cccccc;">{{ lineItem.quantity }}</td> |
||
| 2201 | <td style="border-bottom:1px solid #cccccc;">{{ lineItem.unitPrice|currency(currencyIsoCode) }}</td> |
||
| 2202 | <td style="border-bottom:1px solid #cccccc;">{{ lineItem.totalPrice|currency(currencyIsoCode) }}</td> |
||
| 2203 | </tr> |
||
| 2204 | {% endfor %} |
||
| 2205 | </table> |
||
| 2206 | |||
| 2207 | {% set delivery =order.deliveries.first %} |
||
| 2208 | <p> |
||
| 2209 | <br> |
||
| 2210 | <br> |
||
| 2211 | Shipping costs: {{order.deliveries.first.shippingCosts.totalPrice|currency(currencyIsoCode) }}<br> |
||
| 2212 | Net total: {{ order.amountNet|currency(currencyIsoCode) }}<br> |
||
| 2213 | {% if order.taxStatus is same as(\'net\') %} |
||
| 2214 | {% for calculatedTax in order.cartPrice.calculatedTaxes %} |
||
| 2215 | plus {{ calculatedTax.taxRate }}% VAT. {{ calculatedTax.tax|currency(currencyIsoCode) }}<br> |
||
| 2216 | {% endfor %} |
||
| 2217 | <strong>Total gross: {{ order.amountTotal|currency(currencyIsoCode) }}</strong><br> |
||
| 2218 | {% endif %} |
||
| 2219 | <br> |
||
| 2220 | |||
| 2221 | <strong>Selected payment type:</strong> {{ order.transactions.first.paymentMethod.name }}<br> |
||
| 2222 | {{ order.transactions.first.paymentMethod.description }}<br> |
||
| 2223 | <br> |
||
| 2224 | |||
| 2225 | <strong>Selected shipping type:</strong> {{ delivery.shippingMethod.name }}<br> |
||
| 2226 | {{ delivery.shippingMethod.description }}<br> |
||
| 2227 | <br> |
||
| 2228 | |||
| 2229 | {% set billingAddress = order.addresses.get(order.billingAddressId) %} |
||
| 2230 | <strong>Billing address:</strong><br> |
||
| 2231 | {{ billingAddress.company }}<br> |
||
| 2232 | {{ billingAddress.firstName }} {{ billingAddress.lastName }}<br> |
||
| 2233 | {{ billingAddress.street }} <br> |
||
| 2234 | {{ billingAddress.zipcode }} {{ billingAddress.city }}<br> |
||
| 2235 | {{ billingAddress.country.name }}<br> |
||
| 2236 | <br> |
||
| 2237 | |||
| 2238 | <strong>Shipping address:</strong><br> |
||
| 2239 | {{ delivery.shippingOrderAddress.company }}<br> |
||
| 2240 | {{ delivery.shippingOrderAddress.firstName }} {{ delivery.shippingOrderAddress.lastName }}<br> |
||
| 2241 | {{ delivery.shippingOrderAddress.street }} <br> |
||
| 2242 | {{ delivery.shippingOrderAddress.zipcode}} {{ delivery.shippingOrderAddress.city }}<br> |
||
| 2243 | {{ delivery.shippingOrderAddress.country.name }}<br> |
||
| 2244 | <br> |
||
| 2245 | {% if billingAddress.vatId %} |
||
| 2246 | Your VAT-ID: {{ billingAddress.vatId }} |
||
| 2247 | In case of a successful order and if you are based in one of the EU countries, you will receive your goods exempt from turnover tax.<br> |
||
| 2248 | {% endif %} |
||
| 2249 | |||
| 2250 | If you have any questions, do not hesitate to contact us. |
||
| 2251 | |||
| 2252 | </p> |
||
| 2253 | <br> |
||
| 2254 | </div>'; |
||
| 2255 | } |
||
| 2256 | |||
| 2257 | private function getPlainTemplateEn(): string |
||
| 2258 | { |
||
| 2259 | return '{% set currencyIsoCode = order.currency.isoCode %} |
||
| 2260 | Dear {{order.orderCustomer.salutation.displayName }} {{order.orderCustomer.lastName}}, |
||
| 2261 | |||
| 2262 | Thank you for your order at {{ salesChannel.name }} (Number: {{order.orderNumber}}) on {{ order.orderDate|date }}. |
||
| 2263 | |||
| 2264 | Information on your order: |
||
| 2265 | |||
| 2266 | Pos. Art.No. Description Quantities Price Total |
||
| 2267 | |||
| 2268 | {% for lineItem in order.lineItems %} |
||
| 2269 | {{ loop.index }} {{ lineItem.payload.productNumber|wordwrap(80) }} {{ lineItem.label|wordwrap(80) }} {{ lineItem.quantity }} {{ lineItem.unitPrice|currency(currencyIsoCode) }} {{ lineItem.totalPrice|currency(currencyIsoCode) }} |
||
| 2270 | {% endfor %} |
||
| 2271 | |||
| 2272 | {% set delivery =order.deliveries.first %} |
||
| 2273 | |||
| 2274 | Shipping costs: {{order.deliveries.first.shippingCosts.totalPrice|currency(currencyIsoCode) }} |
||
| 2275 | Net total: {{ order.amountNet|currency(currencyIsoCode) }} |
||
| 2276 | {% if order.taxStatus is same as(\'net\') %} |
||
| 2277 | {% for calculatedTax in order.cartPrice.calculatedTaxes %} |
||
| 2278 | plus {{ calculatedTax.taxRate }}% VAT. {{ calculatedTax.tax|currency(currencyIsoCode) }} |
||
| 2279 | {% endfor %} |
||
| 2280 | Total gross: {{ order.amountTotal|currency(currencyIsoCode) }} |
||
| 2281 | {% endif %} |
||
| 2282 | |||
| 2283 | Selected payment type: {{ order.transactions.first.paymentMethod.name }} |
||
| 2284 | {{ order.transactions.first.paymentMethod.description }} |
||
| 2285 | |||
| 2286 | Selected shipping type: {{ delivery.shippingMethod.name }} |
||
| 2287 | {{ delivery.shippingMethod.description }} |
||
| 2288 | |||
| 2289 | {% set billingAddress = order.addresses.get(order.billingAddressId) %} |
||
| 2290 | Billing address: |
||
| 2291 | {{ billingAddress.company }} |
||
| 2292 | {{ billingAddress.firstName }} {{ billingAddress.lastName }} |
||
| 2293 | {{ billingAddress.street }} |
||
| 2294 | {{ billingAddress.zipcode }} {{ billingAddress.city }} |
||
| 2295 | {{ billingAddress.country.name }} |
||
| 2296 | |||
| 2297 | Shipping address: |
||
| 2298 | {{ delivery.shippingOrderAddress.company }} |
||
| 2299 | {{ delivery.shippingOrderAddress.firstName }} {{ delivery.shippingOrderAddress.lastName }} |
||
| 2300 | {{ delivery.shippingOrderAddress.street }} |
||
| 2301 | {{ delivery.shippingOrderAddress.zipcode}} {{ delivery.shippingOrderAddress.city }} |
||
| 2302 | {{ delivery.shippingOrderAddress.country.name }} |
||
| 2303 | |||
| 2304 | {% if billingAddress.vatId %} |
||
| 2305 | Your VAT-ID: {{ billingAddress.vatId }} |
||
| 2306 | In case of a successful order and if you are based in one of the EU countries, you will receive your goods exempt from turnover tax. |
||
| 2307 | {% endif %} |
||
| 2308 | |||
| 2309 | If you have any questions, do not hesitate to contact us. |
||
| 2310 | |||
| 2311 | '; |
||
| 2312 | } |
||
| 2313 | |||
| 2314 | private function getHtmlTemplateDe(): string |
||
| 2315 | { |
||
| 2316 | return '<div style="font-family:arial; font-size:12px;"> |
||
| 2317 | |||
| 2318 | {% set currencyIsoCode = order.currency.isoCode %} |
||
| 2319 | Hallo {{order.orderCustomer.salutation.displayName }} {{order.orderCustomer.lastName}},<br> |
||
| 2320 | <br> |
||
| 2321 | vielen Dank für Ihre Bestellung im {{ salesChannel.name }} (Nummer: {{order.orderNumber}}) am {{ order.orderDate|date }}.<br> |
||
| 2322 | <br> |
||
| 2323 | <strong>Informationen zu Ihrer Bestellung:</strong><br> |
||
| 2324 | <br> |
||
| 2325 | |||
| 2326 | <table width="80%" border="0" style="font-family:Arial, Helvetica, sans-serif; font-size:12px;"> |
||
| 2327 | <tr> |
||
| 2328 | <td bgcolor="#F7F7F2" style="border-bottom:1px solid #cccccc;"><strong>Pos.</strong></td> |
||
| 2329 | <td bgcolor="#F7F7F2" style="border-bottom:1px solid #cccccc;"><strong>Bezeichnung</strong></td> |
||
| 2330 | <td bgcolor="#F7F7F2" style="border-bottom:1px solid #cccccc;"><strong>Menge</strong></td> |
||
| 2331 | <td bgcolor="#F7F7F2" style="border-bottom:1px solid #cccccc;"><strong>Preis</strong></td> |
||
| 2332 | <td bgcolor="#F7F7F2" style="border-bottom:1px solid #cccccc;"><strong>Summe</strong></td> |
||
| 2333 | </tr> |
||
| 2334 | |||
| 2335 | {% for lineItem in order.lineItems %} |
||
| 2336 | <tr> |
||
| 2337 | <td style="border-bottom:1px solid #cccccc;">{{ loop.index }} </td> |
||
| 2338 | <td style="border-bottom:1px solid #cccccc;"> |
||
| 2339 | {{ lineItem.label|wordwrap(80) }}<br> |
||
| 2340 | Artikel-Nr: {{ lineItem.payload.productNumber|wordwrap(80) }} |
||
| 2341 | </td> |
||
| 2342 | <td style="border-bottom:1px solid #cccccc;">{{ lineItem.quantity }}</td> |
||
| 2343 | <td style="border-bottom:1px solid #cccccc;">{{ lineItem.unitPrice|currency(currencyIsoCode) }}</td> |
||
| 2344 | <td style="border-bottom:1px solid #cccccc;">{{ lineItem.totalPrice|currency(currencyIsoCode) }}</td> |
||
| 2345 | </tr> |
||
| 2346 | {% endfor %} |
||
| 2347 | </table> |
||
| 2348 | |||
| 2349 | {% set delivery =order.deliveries.first %} |
||
| 2350 | <p> |
||
| 2351 | <br> |
||
| 2352 | <br> |
||
| 2353 | Versandkosten: {{order.deliveries.first.shippingCosts.totalPrice|currency(currencyIsoCode) }}<br> |
||
| 2354 | Gesamtkosten Netto: {{ order.amountNet|currency(currencyIsoCode) }}<br> |
||
| 2355 | {% if order.taxStatus is same as(\'net\') %} |
||
| 2356 | {% for calculatedTax in order.cartPrice.calculatedTaxes %} |
||
| 2357 | zzgl. {{ calculatedTax.taxRate }}% MwSt. {{ calculatedTax.tax|currency(currencyIsoCode) }}<br> |
||
| 2358 | {% endfor %} |
||
| 2359 | <strong>Gesamtkosten Brutto: {{ order.amountTotal|currency(currencyIsoCode) }}</strong><br> |
||
| 2360 | {% endif %} |
||
| 2361 | <br> |
||
| 2362 | |||
| 2363 | <strong>Gewählte Zahlungsart:</strong> {{ order.transactions.first.paymentMethod.name }}<br> |
||
| 2364 | {{ order.transactions.first.paymentMethod.description }}<br> |
||
| 2365 | <br> |
||
| 2366 | |||
| 2367 | <strong>Gewählte Versandtart:</strong> {{ delivery.shippingMethod.name }}<br> |
||
| 2368 | {{ delivery.shippingMethod.description }}<br> |
||
| 2369 | <br> |
||
| 2370 | |||
| 2371 | {% set billingAddress = order.addresses.get(order.billingAddressId) %} |
||
| 2372 | <strong>Rechnungsaddresse:</strong><br> |
||
| 2373 | {{ billingAddress.company }}<br> |
||
| 2374 | {{ billingAddress.firstName }} {{ billingAddress.lastName }}<br> |
||
| 2375 | {{ billingAddress.street }} <br> |
||
| 2376 | {{ billingAddress.zipcode }} {{ billingAddress.city }}<br> |
||
| 2377 | {{ billingAddress.country.name }}<br> |
||
| 2378 | <br> |
||
| 2379 | |||
| 2380 | <strong>Lieferadresse:</strong><br> |
||
| 2381 | {{ delivery.shippingOrderAddress.company }}<br> |
||
| 2382 | {{ delivery.shippingOrderAddress.firstName }} {{ delivery.shippingOrderAddress.lastName }}<br> |
||
| 2383 | {{ delivery.shippingOrderAddress.street }} <br> |
||
| 2384 | {{ delivery.shippingOrderAddress.zipcode}} {{ delivery.shippingOrderAddress.city }}<br> |
||
| 2385 | {{ delivery.shippingOrderAddress.country.name }}<br> |
||
| 2386 | <br> |
||
| 2387 | {% if billingAddress.vatId %} |
||
| 2388 | Ihre Umsatzsteuer-ID: {{ billingAddress.vatId }} |
||
| 2389 | Bei erfolgreicher Prüfung und sofern Sie aus dem EU-Ausland |
||
| 2390 | bestellen, erhalten Sie Ihre Ware umsatzsteuerbefreit. <br> |
||
| 2391 | {% endif %} |
||
| 2392 | |||
| 2393 | Für Rückfragen stehen wir Ihnen jederzeit gerne zur Verfügung. |
||
| 2394 | |||
| 2395 | </p> |
||
| 2396 | <br> |
||
| 2397 | </div>'; |
||
| 2398 | } |
||
| 2399 | |||
| 2400 | private function getPlainTemplateDe(): string |
||
| 2401 | { |
||
| 2402 | return '{% set currencyIsoCode = order.currency.isoCode %} |
||
| 2403 | Hallo {{order.orderCustomer.salutation.displayName }} {{order.orderCustomer.lastName}}, |
||
| 2404 | |||
| 2405 | vielen Dank für Ihre Bestellung im {{ salesChannel.name }} (Nummer: {{order.orderNumber}}) am {{ order.orderDate|date }}. |
||
| 2406 | |||
| 2407 | Informationen zu Ihrer Bestellung: |
||
| 2408 | |||
| 2409 | Pos. Artikel-Nr. Beschreibung Menge Preis Summe |
||
| 2410 | {% for lineItem in order.lineItems %} |
||
| 2411 | {{ loop.index }} {{ lineItem.payload.productNumber|wordwrap(80) }} {{ lineItem.label|wordwrap(80) }} {{ lineItem.quantity }} {{ lineItem.unitPrice|currency(currencyIsoCode) }} {{ lineItem.totalPrice|currency(currencyIsoCode) }} |
||
| 2412 | {% endfor %} |
||
| 2413 | |||
| 2414 | {% set delivery =order.deliveries.first %} |
||
| 2415 | |||
| 2416 | Versandtkosten: {{order.deliveries.first.shippingCosts.totalPrice|currency(currencyIsoCode) }} |
||
| 2417 | Gesamtkosten Netto: {{ order.amountNet|currency(currencyIsoCode) }} |
||
| 2418 | {% if order.taxStatus is same as(\'net\') %} |
||
| 2419 | {% for calculatedTax in order.cartPrice.calculatedTaxes %} |
||
| 2420 | zzgl. {{ calculatedTax.taxRate }}% MwSt. {{ calculatedTax.tax|currency(currencyIsoCode) }} |
||
| 2421 | {% endfor %} |
||
| 2422 | Gesamtkosten Brutto: {{ order.amountTotal|currency(currencyIsoCode) }} |
||
| 2423 | {% endif %} |
||
| 2424 | |||
| 2425 | Gewählte Zahlungsart: {{ order.transactions.first.paymentMethod.name }} |
||
| 2426 | {{ order.transactions.first.paymentMethod.description }} |
||
| 2427 | |||
| 2428 | Gewählte Versandtart: {{ delivery.shippingMethod.name }} |
||
| 2429 | {{ delivery.shippingMethod.description }} |
||
| 2430 | |||
| 2431 | {% set billingAddress = order.addresses.get(order.billingAddressId) %} |
||
| 2432 | Rechnungsadresse: |
||
| 2433 | {{ billingAddress.company }} |
||
| 2434 | {{ billingAddress.firstName }} {{ billingAddress.lastName }} |
||
| 2435 | {{ billingAddress.street }} |
||
| 2436 | {{ billingAddress.zipcode }} {{ billingAddress.city }} |
||
| 2437 | {{ billingAddress.country.name }} |
||
| 2438 | |||
| 2439 | Lieferadresse: |
||
| 2440 | {{ delivery.shippingOrderAddress.company }} |
||
| 2441 | {{ delivery.shippingOrderAddress.firstName }} {{ delivery.shippingOrderAddress.lastName }} |
||
| 2442 | {{ delivery.shippingOrderAddress.street }} |
||
| 2443 | {{ delivery.shippingOrderAddress.zipcode}} {{ delivery.shippingOrderAddress.city }} |
||
| 2444 | {{ delivery.shippingOrderAddress.country.name }} |
||
| 2445 | |||
| 2446 | {% if billingAddress.vatId %} |
||
| 2447 | Ihre Umsatzsteuer-ID: {{ billingAddress.vatId }} |
||
| 2448 | Bei erfolgreicher Prüfung und sofern Sie aus dem EU-Ausland |
||
| 2449 | bestellen, erhalten Sie Ihre Ware umsatzsteuerbefreit. |
||
| 2450 | {% endif %} |
||
| 2451 | |||
| 2452 | Für Rückfragen stehen wir Ihnen jederzeit gerne zur Verfügung. |
||
| 2453 | |||
| 2454 | '; |
||
| 2455 | } |
||
| 2456 | |||
| 2457 | private function getRegistrationHtmlTemplateEn(): string |
||
| 2458 | { |
||
| 2459 | return '<div style="font-family:arial; font-size:12px;"> |
||
| 2460 | <p> |
||
| 2461 | Dear {{ customer.salutation.displayName }} {{ customer.lastName }},<br/> |
||
| 2462 | <br/> |
||
| 2463 | thank you for your registration with our Shop.<br/> |
||
| 2464 | You will gain access via the email address <strong>{{ customer.email }}</strong> and the password you have chosen.<br/> |
||
| 2465 | You can change your password anytime. |
||
| 2466 | </p> |
||
| 2467 | </div>'; |
||
| 2468 | } |
||
| 2469 | |||
| 2470 | private function getRegistrationPlainTemplateEn(): string |
||
| 2471 | { |
||
| 2472 | return 'Dear {{ customer.salutation.displayName }} {{ customer.lastName }}, |
||
| 2473 | |||
| 2474 | thank you for your registration with our Shop. |
||
| 2475 | You will gain access via the email address {{ customer.email }} and the password you have chosen. |
||
| 2476 | You can change your password anytime. |
||
| 2477 | '; |
||
| 2478 | } |
||
| 2479 | |||
| 2480 | private function getRegistrationHtmlTemplateDe(): string |
||
| 2481 | { |
||
| 2482 | return '<div style="font-family:arial; font-size:12px;"> |
||
| 2483 | <p> |
||
| 2484 | Hallo {{ customer.salutation.displayName }} {{ customer.lastName }},<br/> |
||
| 2485 | <br/> |
||
| 2486 | vielen Dank für Ihre Anmeldung in unserem Shop.<br/> |
||
| 2487 | Sie erhalten Zugriff über Ihre E-Mail-Adresse <strong>{{ customer.email }}</strong> und dem von Ihnen gewählten Kennwort.<br/> |
||
| 2488 | Sie können Ihr Kennwort jederzeit nachträglich ändern. |
||
| 2489 | </p> |
||
| 2490 | </div>'; |
||
| 2491 | } |
||
| 2492 | |||
| 2493 | private function getRegistrationPlainTemplateDe(): string |
||
| 2494 | { |
||
| 2495 | return 'Hallo {{ customer.salutation.displayName }} {{ customer.lastName }}, |
||
| 2496 | |||
| 2497 | vielen Dank für Ihre Anmeldung in unserem Shop. |
||
| 2498 | Sie erhalten Zugriff über Ihre E-Mail-Adresse {{ customer.email }} und dem von Ihnen gewählten Kennwort. |
||
| 2499 | Sie können Ihr Kennwort jederzeit nachträglich ändern. |
||
| 2500 | '; |
||
| 2501 | } |
||
| 2502 | |||
| 2503 | private function getPasswordChangeHtmlTemplateEn(): string |
||
| 2504 | { |
||
| 2505 | return '<div style="font-family:arial; font-size:12px;"> |
||
| 2506 | <p> |
||
| 2507 | Dear {{ customer.salutation.displayName }} {{ customer.lastName }},<br/> |
||
| 2508 | <br/> |
||
| 2509 | there has been a request to reset you Password in the Shop {{ salesChannel.name }} |
||
| 2510 | Please confirm the link below to specify a new password.<br/> |
||
| 2511 | <br/> |
||
| 2512 | <a href="{{ urlResetPassword }}">Reset passwort</a><br/> |
||
| 2513 | <br/> |
||
| 2514 | This link is valid for the next 2 hours. After that you have to request a new confirmation link.<br/> |
||
| 2515 | If you do not want to reset your password, please ignore this email. No changes will be made. |
||
| 2516 | </p> |
||
| 2517 | </div>'; |
||
| 2518 | } |
||
| 2519 | |||
| 2520 | private function getPasswordChangePlainTemplateEn(): string |
||
| 2521 | { |
||
| 2522 | return ' |
||
| 2523 | Dear {{ customer.salutation.displayName }} {{ customer.lastName }}, |
||
| 2524 | |||
| 2525 | there has been a request to reset you Password in the Shop {{ salesChannel.name }} |
||
| 2526 | Please confirm the link below to specify a new password. |
||
| 2527 | |||
| 2528 | Reset password: {{ urlResetPassword }} |
||
| 2529 | |||
| 2530 | This link is valid for the next 2 hours. After that you have to request a new confirmation link. |
||
| 2531 | If you do not want to reset your password, please ignore this email. No changes will be made. |
||
| 2532 | '; |
||
| 2533 | } |
||
| 2534 | |||
| 2535 | private function getPasswordChangeHtmlTemplateDe(): string |
||
| 2536 | { |
||
| 2537 | return '<div style="font-family:arial; font-size:12px;"> |
||
| 2538 | <p> |
||
| 2539 | Hallo {{ customer.salutation.displayName }} {{ customer.lastName }},<br/> |
||
| 2540 | <br/> |
||
| 2541 | im Shop {{ salesChannel.name }} wurde eine Anfrage gestellt, um Ihr Passwort zurück zu setzen. |
||
| 2542 | Bitte bestätigen Sie den unten stehenden Link, um ein neues Passwort zu definieren.<br/> |
||
| 2543 | <br/> |
||
| 2544 | <a href="{{ urlResetPassword }}">Passwort zurücksetzen</a><br/> |
||
| 2545 | <br/> |
||
| 2546 | Dieser Link ist nur für die nächsten 2 Stunden gültig. Danach muss das Zurücksetzen des Passwortes erneut beantragt werden. |
||
| 2547 | Falls Sie Ihr Passwort nicht zurücksetzen möchten, ignorieren Sie diese E-Mail - es wird dann keine Änderung vorgenommen. |
||
| 2548 | </p> |
||
| 2549 | </div>'; |
||
| 2550 | } |
||
| 2551 | |||
| 2552 | private function getPasswordChangePlainTemplateDe(): string |
||
| 2553 | { |
||
| 2554 | return ' |
||
| 2555 | Hallo {{ customer.salutation.displayName }} {{ customer.lastName }}, |
||
| 2556 | |||
| 2557 | im Shop {{ salesChannel.name }} wurde eine Anfrage gestellt, um Ihr Passwort zurück zu setzen. |
||
| 2558 | Bitte bestätigen Sie den unten stehenden Link, um ein neues Passwort zu definieren. |
||
| 2559 | |||
| 2560 | Passwort zurücksetzen: {{ urlResetPassword }} |
||
| 2561 | |||
| 2562 | Dieser Link ist nur für die nächsten 2 Stunden gültig. Danach muss das Zurücksetzen des Passwortes erneut beantragt werden. |
||
| 2563 | Falls Sie Ihr Passwort nicht zurücksetzen möchten, ignorieren Sie diese E-Mail - es wird dann keine Änderung vorgenommen. |
||
| 2564 | '; |
||
| 2565 | } |
||
| 2566 | |||
| 2567 | private function getCustomerGroupChangeAcceptedHtmlTemplateEn(): string |
||
| 2568 | { |
||
| 2569 | return '<div style="font-family:arial; font-size:12px;"> |
||
| 2570 | <p> |
||
| 2571 | Hello,<br/> |
||
| 2572 | <br/> |
||
| 2573 | your merchant account at {{ salesChannel.name }} has been unlocked.<br/> |
||
| 2574 | From now on, we will charge you the net purchase price. |
||
| 2575 | </p> |
||
| 2576 | </div>'; |
||
| 2577 | } |
||
| 2578 | |||
| 2579 | private function getCustomerGroupChangeAcceptedPlainTemplateEn(): string |
||
| 2580 | { |
||
| 2581 | return ' |
||
| 2582 | Hello, |
||
| 2583 | |||
| 2584 | your merchant account at {{ salesChannel.name }} has been unlocked. |
||
| 2585 | From now on, we will charge you the net purchase price. |
||
| 2586 | '; |
||
| 2587 | } |
||
| 2588 | |||
| 2589 | private function getCustomerGroupChangeAcceptedHtmlTemplateDe(): string |
||
| 2590 | { |
||
| 2591 | return '<div style="font-family:arial; font-size:12px;"> |
||
| 2592 | <p> |
||
| 2593 | Hallo,<br/> |
||
| 2594 | <br/> |
||
| 2595 | ihr Händlerkonto bei {{ salesChannel.name }} wurde freigeschaltet.<br/> |
||
| 2596 | Von nun an werden wir Ihnen den Netto-Preis berechnen. |
||
| 2597 | </p> |
||
| 2598 | </div>'; |
||
| 2599 | } |
||
| 2600 | |||
| 2601 | private function getCustomerGroupChangeAcceptedPlainTemplateDe(): string |
||
| 2602 | { |
||
| 2603 | return ' |
||
| 2604 | Hallo, |
||
| 2605 | |||
| 2606 | ihr Händlerkonto bei {{ salesChannel.name }} wurde freigeschaltet. |
||
| 2607 | Von nun an werden wir Ihnen den Netto-Preis berechnen. |
||
| 2608 | '; |
||
| 2609 | } |
||
| 2610 | |||
| 2611 | private function getCustomerGroupChangeRejectedHtmlTemplateEn(): string |
||
| 2612 | { |
||
| 2613 | return '<div style="font-family:arial; font-size:12px;"> |
||
| 2614 | <p> |
||
| 2615 | Hello,<br/> |
||
| 2616 | <br/> |
||
| 2617 | thank you for your interest in our trade prices. |
||
| 2618 | Unfortunately, we do not have a trading license yet so that we cannot accept you as a merchant.<br/> |
||
| 2619 | In case of further questions please do not hesitate to contact us via telephone, fax or email. |
||
| 2620 | </p> |
||
| 2621 | </div>'; |
||
| 2622 | } |
||
| 2623 | |||
| 2624 | private function getCustomerGroupChangeRejectedPlainTemplateEn(): string |
||
| 2625 | { |
||
| 2626 | return ' |
||
| 2627 | Hello, |
||
| 2628 | |||
| 2629 | thank you for your interest in our trade prices. Unfortunately, |
||
| 2630 | we do not have a trading license yet so that we cannot accept you as a merchant. |
||
| 2631 | In case of further questions please do not hesitate to contact us via telephone, fax or email. |
||
| 2632 | '; |
||
| 2633 | } |
||
| 2634 | |||
| 2635 | private function getCustomerGroupChangeRejectedHtmlTemplateDe(): string |
||
| 2636 | { |
||
| 2637 | return '<div style="font-family:arial; font-size:12px;"> |
||
| 2638 | <p> |
||
| 2639 | Hallo,<br/> |
||
| 2640 | <br/> |
||
| 2641 | elen Dank für ihr Interesse an unseren Großhandelspreisen. Leider liegt uns bisher keine <br/> |
||
| 2642 | Händlerauthentifizierung vor, und daher können wir Ihre Anfrage nicht bestätigen. <br/> |
||
| 2643 | Bei weiteren Fragen kontaktieren Sie uns gerne per Telefon, Fax oder E-Mail. <br/> |
||
| 2644 | </p> |
||
| 2645 | </div>'; |
||
| 2646 | } |
||
| 2647 | |||
| 2648 | private function getCustomerGroupChangeRejectedPlainTemplateDe(): string |
||
| 2649 | { |
||
| 2650 | return ' |
||
| 2651 | Hallo, |
||
| 2652 | |||
| 2653 | vielen Dank für ihr Interesse an unseren Großhandelspreisen. Leider liegt uns bisher keine |
||
| 2654 | Händlerauthentifizierung vor, und daher können wir Ihre Anfrage nicht bestätigen. |
||
| 2655 | Bei weiteren Fragen kontaktieren Sie uns gerne per Telefon, Fax oder E-Mail. |
||
| 2656 | '; |
||
| 2657 | } |
||
| 2658 | |||
| 2659 | private function createNumberRanges(Connection $connection): void |
||
| 2660 | { |
||
| 2661 | $definitionNumberRangeTypes = [ |
||
| 2662 | 'product' => [ |
||
| 2663 | 'id' => Uuid::randomHex(), |
||
| 2664 | 'global' => 1, |
||
| 2665 | 'nameDe' => 'Produkt', |
||
| 2666 | ], |
||
| 2667 | 'order' => [ |
||
| 2668 | 'id' => Uuid::randomHex(), |
||
| 2669 | 'global' => 0, |
||
| 2670 | 'nameDe' => 'Bestellung', |
||
| 2671 | ], |
||
| 2672 | 'customer' => [ |
||
| 2673 | 'id' => Uuid::randomHex(), |
||
| 2674 | 'global' => 0, |
||
| 2675 | 'nameDe' => 'Kunde', |
||
| 2676 | ], |
||
| 2677 | ]; |
||
| 2678 | |||
| 2679 | $definitionNumberRanges = [ |
||
| 2680 | 'product' => [ |
||
| 2681 | 'id' => Uuid::randomHex(), |
||
| 2682 | 'name' => 'Products', |
||
| 2683 | 'nameDe' => 'Produkte', |
||
| 2684 | 'global' => 1, |
||
| 2685 | 'typeId' => $definitionNumberRangeTypes['product']['id'], |
||
| 2686 | 'pattern' => 'SW{n}', |
||
| 2687 | 'start' => 10000, |
||
| 2688 | ], |
||
| 2689 | 'order' => [ |
||
| 2690 | 'id' => Uuid::randomHex(), |
||
| 2691 | 'name' => 'Orders', |
||
| 2692 | 'nameDe' => 'Bestellungen', |
||
| 2693 | 'global' => 1, |
||
| 2694 | 'typeId' => $definitionNumberRangeTypes['order']['id'], |
||
| 2695 | 'pattern' => '{n}', |
||
| 2696 | 'start' => 10000, |
||
| 2697 | ], |
||
| 2698 | 'customer' => [ |
||
| 2699 | 'id' => Uuid::randomHex(), |
||
| 2700 | 'name' => 'Customers', |
||
| 2701 | 'nameDe' => 'Kunden', |
||
| 2702 | 'global' => 1, |
||
| 2703 | 'typeId' => $definitionNumberRangeTypes['customer']['id'], |
||
| 2704 | 'pattern' => '{n}', |
||
| 2705 | 'start' => 10000, |
||
| 2706 | ], |
||
| 2707 | ]; |
||
| 2708 | |||
| 2709 | $languageEn = Uuid::fromHexToBytes(Defaults::LANGUAGE_SYSTEM); |
||
| 2710 | $languageDe = Uuid::fromHexToBytes(Defaults::LANGUAGE_SYSTEM_DE); |
||
| 2711 | |||
| 2712 | foreach ($definitionNumberRangeTypes as $typeName => $numberRangeType) { |
||
| 2713 | $connection->insert( |
||
| 2714 | 'number_range_type', |
||
| 2715 | [ |
||
| 2716 | 'id' => Uuid::fromHexToBytes($numberRangeType['id']), |
||
| 2717 | 'global' => $numberRangeType['global'], |
||
| 2718 | 'technical_name' => $typeName, |
||
| 2719 | 'created_at' => date(Defaults::STORAGE_DATE_FORMAT), |
||
| 2720 | ] |
||
| 2721 | ); |
||
| 2722 | $connection->insert( |
||
| 2723 | 'number_range_type_translation', |
||
| 2724 | [ |
||
| 2725 | 'number_range_type_id' => Uuid::fromHexToBytes($numberRangeType['id']), |
||
| 2726 | 'type_name' => $typeName, |
||
| 2727 | 'language_id' => $languageEn, |
||
| 2728 | 'created_at' => date(Defaults::STORAGE_DATE_FORMAT), |
||
| 2729 | ] |
||
| 2730 | ); |
||
| 2731 | $connection->insert( |
||
| 2732 | 'number_range_type_translation', |
||
| 2733 | [ |
||
| 2734 | 'number_range_type_id' => Uuid::fromHexToBytes($numberRangeType['id']), |
||
| 2735 | 'type_name' => $numberRangeType['nameDe'], |
||
| 2736 | 'language_id' => $languageDe, |
||
| 2737 | 'created_at' => date(Defaults::STORAGE_DATE_FORMAT), |
||
| 2738 | ] |
||
| 2739 | ); |
||
| 2740 | } |
||
| 2741 | |||
| 2742 | foreach ($definitionNumberRanges as $typeName => $numberRange) { |
||
| 2743 | $connection->insert( |
||
| 2744 | 'number_range', |
||
| 2745 | [ |
||
| 2746 | 'id' => Uuid::fromHexToBytes($numberRange['id']), |
||
| 2747 | 'global' => $numberRange['global'], |
||
| 2748 | 'type_id' => Uuid::fromHexToBytes($numberRange['typeId']), |
||
| 2749 | 'pattern' => $numberRange['pattern'], |
||
| 2750 | 'start' => $numberRange['start'], |
||
| 2751 | 'created_at' => date(Defaults::STORAGE_DATE_FORMAT), |
||
| 2752 | ] |
||
| 2753 | ); |
||
| 2754 | $connection->insert( |
||
| 2755 | 'number_range_translation', |
||
| 2756 | [ |
||
| 2757 | 'number_range_id' => Uuid::fromHexToBytes($numberRange['id']), |
||
| 2758 | 'name' => $numberRange['name'], |
||
| 2759 | 'language_id' => $languageEn, |
||
| 2760 | 'created_at' => date(Defaults::STORAGE_DATE_FORMAT), |
||
| 2761 | ] |
||
| 2762 | ); |
||
| 2763 | $connection->insert( |
||
| 2764 | 'number_range_translation', |
||
| 2765 | [ |
||
| 2766 | 'number_range_id' => Uuid::fromHexToBytes($numberRange['id']), |
||
| 2767 | 'name' => $numberRange['nameDe'], |
||
| 2768 | 'language_id' => $languageDe, |
||
| 2769 | 'created_at' => date(Defaults::STORAGE_DATE_FORMAT), |
||
| 2770 | ] |
||
| 2771 | ); |
||
| 2772 | } |
||
| 2773 | } |
||
| 2774 | |||
| 2775 | private function createCmsPages(Connection $connection): void |
||
| 2776 | { |
||
| 2777 | $languageEn = Uuid::fromHexToBytes(Defaults::LANGUAGE_SYSTEM); |
||
| 2778 | $versionId = Uuid::fromHexToBytes(Defaults::LIVE_VERSION); |
||
| 2779 | |||
| 2780 | // cms page |
||
| 2781 | $page = ['id' => Uuid::randomBytes(), 'type' => 'product_list', 'locked' => 1, 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]; |
||
| 2782 | $pageEng = ['cms_page_id' => $page['id'], 'language_id' => $languageEn, 'name' => 'Default category layout', 'created_at' => date(Defaults::STORAGE_DATE_FORMAT)]; |
||
| 2783 | |||
| 2784 | $connection->insert('cms_page', $page); |
||
| 2785 | $connection->insert('cms_page_translation', $pageEng); |
||
| 2786 | |||
| 2787 | // cms blocks |
||
| 2788 | $blocks = [ |
||
| 2789 | [ |
||
| 2790 | 'id' => Uuid::randomBytes(), |
||
| 2791 | 'created_at' => date(Defaults::STORAGE_DATE_FORMAT), |
||
| 2792 | 'cms_page_id' => $page['id'], |
||
| 2793 | 'locked' => 1, |
||
| 2794 | 'position' => 1, |
||
| 2795 | 'type' => 'product-listing', |
||
| 2796 | 'name' => 'Category listing', |
||
| 2797 | 'sizing_mode' => 'boxed', |
||
| 2798 | 'margin_top' => '20px', |
||
| 2799 | 'margin_bottom' => '20px', |
||
| 2800 | 'margin_left' => '20px', |
||
| 2801 | 'margin_right' => '20px', |
||
| 2802 | 'background_media_mode' => 'cover', |
||
| 2803 | ], |
||
| 2804 | [ |
||
| 2805 | 'id' => Uuid::randomBytes(), |
||
| 2806 | 'created_at' => date(Defaults::STORAGE_DATE_FORMAT), |
||
| 2807 | 'cms_page_id' => $page['id'], |
||
| 2808 | 'locked' => 1, |
||
| 2809 | 'position' => 0, |
||
| 2810 | 'type' => 'image-text', |
||
| 2811 | 'name' => 'Category info', |
||
| 2812 | 'sizing_mode' => 'boxed', |
||
| 2813 | 'margin_top' => '20px', |
||
| 2814 | 'margin_bottom' => '20px', |
||
| 2815 | 'margin_left' => '20px', |
||
| 2816 | 'margin_right' => '20px', |
||
| 2817 | 'background_media_mode' => 'cover', |
||
| 2818 | ], |
||
| 2819 | ]; |
||
| 2820 | |||
| 2821 | foreach ($blocks as $block) { |
||
| 2822 | $connection->insert('cms_block', $block); |
||
| 2823 | } |
||
| 2824 | |||
| 2825 | // cms slots |
||
| 2826 | $slots = [ |
||
| 2827 | ['id' => Uuid::randomBytes(), 'locked' => 1, 'cms_block_id' => $blocks[0]['id'], 'type' => 'product-listing', 'slot' => 'content', 'created_at' => date(Defaults::STORAGE_DATE_FORMAT), 'version_id' => $versionId], |
||
| 2828 | ['id' => Uuid::randomBytes(), 'locked' => 1, 'cms_block_id' => $blocks[1]['id'], 'type' => 'image', 'slot' => 'left', 'created_at' => date(Defaults::STORAGE_DATE_FORMAT), 'version_id' => $versionId], |
||
| 2829 | ['id' => Uuid::randomBytes(), 'locked' => 1, 'cms_block_id' => $blocks[1]['id'], 'type' => 'text', 'slot' => 'right', 'created_at' => date(Defaults::STORAGE_DATE_FORMAT), 'version_id' => $versionId], |
||
| 2830 | ]; |
||
| 2831 | |||
| 2832 | $slotTranslations = [ |
||
| 2833 | [ |
||
| 2834 | 'cms_slot_id' => $slots[0]['id'], |
||
| 2835 | 'cms_slot_version_id' => $versionId, |
||
| 2836 | 'language_id' => $languageEn, |
||
| 2837 | 'created_at' => date(Defaults::STORAGE_DATE_FORMAT), |
||
| 2838 | 'config' => json_encode([ |
||
| 2839 | 'boxLayout' => ['source' => 'static', 'value' => 'standard'], |
||
| 2840 | ]), |
||
| 2841 | ], |
||
| 2842 | [ |
||
| 2843 | 'cms_slot_id' => $slots[1]['id'], |
||
| 2844 | 'cms_slot_version_id' => $versionId, |
||
| 2845 | 'language_id' => $languageEn, |
||
| 2846 | 'created_at' => date(Defaults::STORAGE_DATE_FORMAT), |
||
| 2847 | 'config' => json_encode([ |
||
| 2848 | 'media' => ['source' => 'mapped', 'value' => 'category.media'], |
||
| 2849 | 'displayMode' => ['source' => 'static', 'value' => 'cover'], |
||
| 2850 | 'url' => ['source' => 'static', 'value' => null], |
||
| 2851 | 'newTab' => ['source' => 'static', 'value' => false], |
||
| 2852 | 'minHeight' => ['source' => 'static', 'value' => '320px'], |
||
| 2853 | ]), |
||
| 2854 | ], |
||
| 2855 | [ |
||
| 2856 | 'cms_slot_id' => $slots[2]['id'], |
||
| 2857 | 'cms_slot_version_id' => $versionId, |
||
| 2858 | 'language_id' => $languageEn, |
||
| 2859 | 'created_at' => date(Defaults::STORAGE_DATE_FORMAT), |
||
| 2860 | 'config' => json_encode([ |
||
| 2861 | 'content' => ['source' => 'mapped', 'value' => 'category.description'], |
||
| 2862 | ]), |
||
| 2863 | ], |
||
| 2864 | ]; |
||
| 2865 | |||
| 2866 | foreach ($slots as $slot) { |
||
| 2867 | $connection->insert('cms_slot', $slot); |
||
| 2868 | } |
||
| 2869 | |||
| 2870 | foreach ($slotTranslations as $translation) { |
||
| 2871 | $connection->insert('cms_slot_translation', $translation); |
||
| 2872 | } |
||
| 2873 | |||
| 2874 | $connection->executeUpdate('UPDATE `category` SET `cms_page_id` = :pageId', ['pageId' => $page['id']]); |
||
| 2875 | } |
||
| 2877 |