PluginProbe ʕ •ᴥ•ʔ
Booking for Appointments and Events Calendar – Amelia / 1.2.11
Booking for Appointments and Events Calendar – Amelia v1.2.11
2.4.4 2.4.3 2.4.2 2.4.1 2.4 trunk 1.2.1 1.2.10 1.2.11 1.2.12 1.2.13 1.2.14 1.2.15 1.2.16 1.2.17 1.2.18 1.2.19 1.2.2 1.2.20 1.2.21 1.2.22 1.2.23 1.2.24 1.2.25 1.2.26 1.2.27 1.2.28 1.2.29 1.2.3 1.2.30 1.2.31 1.2.32 1.2.33 1.2.34 1.2.35 1.2.36 1.2.37 1.2.38 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 2.0 2.0.1 2.0.2 2.1 2.1.1 2.1.2 2.1.3 2.2 2.2.1 2.3
ameliabooking / src / Infrastructure / Licence / Lite / DataModifier.php
ameliabooking / src / Infrastructure / Licence / Lite Last commit date
ApplicationService.php 1 year ago DataModifier.php 2 years ago DomainService.php 2 years ago EventListener.php 1 year ago InfrastructureService.php 2 years ago Licence.php 1 year ago
DataModifier.php
410 lines
1 <?php
2
3 namespace AmeliaBooking\Infrastructure\Licence\Lite;
4
5 use AmeliaBooking\Infrastructure\WP\InstallActions\ActivationSettingsHook;
6
7 /**
8 * Class DataModifier
9 *
10 * @package AmeliaBooking\Infrastructure\Licence\Lite
11 */
12 class DataModifier
13 {
14 /**
15 * @param array $settings
16 * @param array $savedSettings
17 */
18 public static function restoreSettings(&$settings, $savedSettings)
19 {
20 self::commonRestoreSettings($settings, $savedSettings);
21
22 $settings['payments']['coupons'] = $savedSettings['payments']['coupons'];
23
24 $settings['roles']['customerCabinet']['enabled'] = $savedSettings['roles']['customerCabinet']['enabled'];
25
26 $settings['roles']['providerCabinet']['enabled'] = $savedSettings['roles']['providerCabinet']['enabled'];
27
28 $settings['general']['serviceDurationAsSlot'] = $savedSettings['general']['serviceDurationAsSlot'];
29
30 $settings['general']['bufferTimeInSlot'] = $savedSettings['general']['bufferTimeInSlot'];
31
32 $settings['general']['minimumTimeRequirementPriorToBooking'] = $savedSettings['general']['minimumTimeRequirementPriorToBooking'];
33
34 $settings['general']['minimumTimeRequirementPriorToCanceling'] = $savedSettings['general']['minimumTimeRequirementPriorToCanceling'];
35
36 $settings['general']['minimumTimeRequirementPriorToRescheduling'] = $savedSettings['general']['minimumTimeRequirementPriorToRescheduling'];
37 }
38
39 /**
40 * @param array $settings
41 * @param array $savedSettings
42 */
43 public static function commonRestoreSettings(&$settings, $savedSettings)
44 {
45 $settings['payments']['cart'] = $savedSettings['payments']['cart'];
46
47 $settings['payments']['stripe']['enabled'] = $savedSettings['payments']['stripe']['enabled'];
48
49 $settings['payments']['payPal']['enabled'] = $savedSettings['payments']['payPal']['enabled'];
50
51 $settings['payments']['razorpay']['enabled'] = $savedSettings['payments']['razorpay']['enabled'];
52
53 $settings['payments']['mollie']['enabled'] = $savedSettings['payments']['mollie']['enabled'];
54
55 $settings['payments']['wc']['enabled'] = $savedSettings['payments']['wc']['enabled'];
56
57 $settings['payments']['paymentLinks']['enabled'] = $savedSettings['payments']['paymentLinks']['enabled'];
58
59 $settings['roles']['limitPerCustomerService']['enabled'] = $savedSettings['roles']['limitPerCustomerService']['enabled'];
60
61 $settings['roles']['limitPerCustomerPackage']['enabled'] = $savedSettings['roles']['limitPerCustomerPackage']['enabled'];
62
63 $settings['roles']['limitPerCustomerEvent']['enabled'] = $savedSettings['roles']['limitPerCustomerEvent']['enabled'];
64
65 $settings['roles']['limitPerEmployee']['enabled'] = $savedSettings['roles']['limitPerEmployee']['enabled'];
66
67 $settings['roles']['allowCustomerCancelPackages'] = $savedSettings['roles']['allowCustomerCancelPackages'];
68
69 $settings['roles']['enableNoShowTag'] = $savedSettings['roles']['enableNoShowTag'];
70
71 $settings['notifications']['whatsAppEnabled'] = $savedSettings['notifications']['whatsAppEnabled'];
72
73 $settings['general']['usedLanguages'] = $savedSettings['general']['usedLanguages'];
74
75 $settings['appointments']['employeeSelection'] = $savedSettings['appointments']['employeeSelection'];
76 }
77
78 /**
79 * @param array $settings
80 */
81 public static function modifySettings(&$settings)
82 {
83 $generalSettings = ActivationSettingsHook::getDefaultGeneralSettings($settings);
84
85
86 self::commonModifySettings($settings);
87
88 if ($settings && isset($settings['payments'])) {
89 $settings['payments']['coupons'] = false;
90 }
91
92 if ($settings && isset($settings['activation'])) {
93 $settings['activation']['hideUnavailableFeatures'] = false;
94 }
95
96 if ($settings && isset($settings['roles'])) {
97 $settings['roles']['customerCabinet']['enabled'] = false;
98
99 $settings['roles']['providerCabinet']['enabled'] = false;
100 }
101
102 if ($settings && isset($settings['general'])) {
103 $settings['general']['serviceDurationAsSlot'] = $generalSettings['serviceDurationAsSlot'];
104
105 $settings['general']['bufferTimeInSlot'] = $generalSettings['bufferTimeInSlot'];
106
107 $settings['general']['minimumTimeRequirementPriorToBooking'] = $generalSettings['minimumTimeRequirementPriorToBooking'];
108
109 $settings['general']['minimumTimeRequirementPriorToCanceling'] = $generalSettings['minimumTimeRequirementPriorToCanceling'];
110
111 $settings['general']['minimumTimeRequirementPriorToRescheduling'] = $generalSettings['minimumTimeRequirementPriorToRescheduling'];
112 }
113 }
114
115 /**
116 * @param array $settings
117 */
118 public static function commonModifySettings(&$settings)
119 {
120 $rolesSettings = ActivationSettingsHook::getDefaultRolesSettings();
121
122 $generalSettings = ActivationSettingsHook::getDefaultGeneralSettings($settings);
123
124 $notificationSettings = ActivationSettingsHook::getDefaultNotificationsSettings($settings);
125
126 $appointmentsSettings = ActivationSettingsHook::getDefaultAppointmentsSettings();
127
128 $paymentSettings = ActivationSettingsHook::getDefaultPaymentsSettings($settings);
129
130
131 if ($settings && isset($settings['payments'])) {
132 $settings['payments']['cart'] = $paymentSettings['cart'];
133
134 $settings['payments']['stripe']['enabled'] = $paymentSettings['stripe']['enabled'];
135
136 $settings['payments']['payPal']['enabled'] = $paymentSettings['payPal']['enabled'];
137
138 $settings['payments']['razorpay']['enabled'] = $paymentSettings['razorpay']['enabled'];
139
140 $settings['payments']['mollie']['enabled'] = $paymentSettings['mollie']['enabled'];
141
142 $settings['payments']['wc']['enabled'] = $paymentSettings['wc']['enabled'];
143
144 $settings['payments']['paymentLinks']['enabled'] = $paymentSettings['paymentLinks']['enabled'];
145
146 $settings['payments']['taxes']['enabled'] = $paymentSettings['taxes']['enabled'];
147 }
148
149 if ($settings && isset($settings['roles'])) {
150 $settings['roles']['limitPerCustomerService']['enabled'] = $rolesSettings['limitPerCustomerService']['enabled'];
151
152 $settings['roles']['limitPerCustomerPackage']['enabled'] = $rolesSettings['limitPerCustomerPackage']['enabled'];
153
154 $settings['roles']['limitPerCustomerEvent']['enabled'] = $rolesSettings['limitPerCustomerEvent']['enabled'];
155
156 $settings['roles']['limitPerEmployee']['enabled'] = $rolesSettings['limitPerEmployee']['enabled'];
157
158 $settings['roles']['allowCustomerCancelPackages'] = false;
159
160 $settings['roles']['enableNoShowTag'] = false;
161 }
162
163 if ($settings && isset($settings['general'])) {
164 $settings['general']['usedLanguages'] = $generalSettings['usedLanguages'];
165 }
166
167 if ($settings && isset($settings['notifications'])) {
168 $settings['notifications']['whatsAppEnabled'] = $notificationSettings['whatsAppEnabled'];
169 }
170
171 if ($settings && isset($settings['appointments'])) {
172 $settings['appointments']['employeeSelection'] = $appointmentsSettings['employeeSelection'];
173 }
174 }
175
176 /**
177 * @param array $data
178 *
179 * @return array
180 */
181 public static function getUserRepositoryData($data)
182 {
183 return [
184 'values' =>
185 [
186 ],
187 'columns' =>
188 '',
189 'placeholders' =>
190 '',
191 'columnsPlaceholders' =>
192 '',
193 ];
194 }
195
196 /**
197 * @param array $data
198 *
199 * @return void
200 */
201 public static function userFactory(&$data)
202 {
203 $data['locationId'] = null;
204
205 $data['googleCalendar'] = null;
206
207 $data['outlookCalendar'] = null;
208
209 $data['badgeId'] = null;
210
211 $data['zoomUserId'] = null;
212
213 $data['translations'] = null;
214
215 $data['timeZone'] = null;
216
217 if (!empty($data['serviceList'])) {
218 foreach ($data['serviceList'] as $key => $value) {
219 $data['serviceList'][$key]['customPricing'] = null;
220 }
221 }
222 }
223
224 /**
225 * @param array $data
226 *
227 * @return array
228 */
229 public static function getProviderServiceRepositoryData($data)
230 {
231 return [
232 'values' =>
233 [
234 ],
235 'columns' =>
236 '',
237 'placeholders' =>
238 '',
239 'columnsPlaceholders' =>
240 '',
241 ];
242 }
243
244 /**
245 * @param array $data
246 *
247 * @return void
248 */
249 public static function providerServiceFactory(&$data)
250 {
251 }
252
253 /**
254 * @param array $data
255 *
256 * @return array
257 */
258 public static function getPeriodRepositoryData($data)
259 {
260 return [
261 'values' =>
262 [
263 ],
264 'columns' =>
265 '',
266 'placeholders' =>
267 '',
268 'columnsPlaceholders' =>
269 '',
270 ];
271 }
272
273 /**
274 * @param array $data
275 *
276 * @return void
277 */
278 public static function periodFactory(&$data)
279 {
280 $data['locationId'] = null;
281
282 $data['periodLocationList'] = [];
283 }
284
285 /**
286 * @param array $data
287 *
288 * @return array
289 */
290 public static function getServiceRepositoryData($data)
291 {
292 return [
293 'values' =>
294 [
295 ],
296 'columns' =>
297 '',
298 'placeholders' =>
299 '',
300 'columnsPlaceholders' =>
301 '',
302 ];
303 }
304
305 /**
306 * @param array $data
307 *
308 * @return void
309 */
310 public static function serviceFactory(&$data)
311 {
312 self::commonServiceFactory($data);
313
314 $data['extras'] = [];
315
316 $data['show'] = 1;
317
318 $data['timeAfter'] = 0;
319
320 $data['timeBefore'] = 0;
321
322 $data['minCapacity'] = 1;
323
324 $data['maxCapacity'] = 1;
325 }
326
327 /**
328 * @param array $data
329 *
330 * @return void
331 */
332 public static function commonServiceFactory(&$data)
333 {
334 $data['recurringCycle'] = 'disabled';
335
336 $data['recurringSub'] = 'future';
337
338 $data['recurringPayment'] = 0;
339
340 $data['customPricing'] = null;
341
342 $data['limitPerCustomer'] = null;
343
344 $data['deposit'] = 0;
345
346 $data['depositPayment'] = 'disabled';
347
348 $data['depositPerPerson'] = 1;
349
350 $data['fullPayment'] = 0;
351 }
352
353 /**
354 * @param array $data
355 *
356 * @return array
357 */
358 public static function getEventRepositoryData($data)
359 {
360 return [
361 'values' =>
362 [
363 ],
364 'addValues' =>
365 [
366 ],
367 'columns' =>
368 '',
369 'placeholders' =>
370 '',
371 'columnsPlaceholders' =>
372 '',
373 ];
374 }
375
376 /**
377 * @param array $data
378 *
379 * @return void
380 */
381 public static function eventFactory(&$data)
382 {
383 self::commonEventFactory($data);
384
385 $data['tags'] = [];
386 }
387
388 /**
389 * @param array $data
390 *
391 * @return void
392 */
393 public static function commonEventFactory(&$data)
394 {
395 $data['ticketRangeRec'] = 'calculate';
396
397 $data['deposit'] = 0;
398
399 $data['depositPayment'] = 'disabled';
400
401 $data['fullPayment'] = 0;
402
403 $data['customPricing'] = 0;
404
405 $data['depositPerPerson'] = 1;
406
407 $data['locationId'] = null;
408 }
409 }
410