PluginProbe ʕ •ᴥ•ʔ
Booking for Appointments and Events Calendar – Amelia / 1.2.32
Booking for Appointments and Events Calendar – Amelia v1.2.32
2.4.9 2.4.8 2.4.7 2.4.6 2.4.5 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 1 year ago DomainService.php 2 years ago EventListener.php 1 year ago InfrastructureService.php 11 months ago Licence.php 11 months ago
DataModifier.php
414 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['appleCalendarId'] = null;
214
215 $data['translations'] = null;
216
217 $data['timeZone'] = null;
218
219 $data['employeeAppleCalendar'] = null;
220
221 if (!empty($data['serviceList'])) {
222 foreach ($data['serviceList'] as $key => $value) {
223 $data['serviceList'][$key]['customPricing'] = null;
224 }
225 }
226 }
227
228 /**
229 * @param array $data
230 *
231 * @return array
232 */
233 public static function getProviderServiceRepositoryData($data)
234 {
235 return [
236 'values' =>
237 [
238 ],
239 'columns' =>
240 '',
241 'placeholders' =>
242 '',
243 'columnsPlaceholders' =>
244 '',
245 ];
246 }
247
248 /**
249 * @param array $data
250 *
251 * @return void
252 */
253 public static function providerServiceFactory(&$data)
254 {
255 }
256
257 /**
258 * @param array $data
259 *
260 * @return array
261 */
262 public static function getPeriodRepositoryData($data)
263 {
264 return [
265 'values' =>
266 [
267 ],
268 'columns' =>
269 '',
270 'placeholders' =>
271 '',
272 'columnsPlaceholders' =>
273 '',
274 ];
275 }
276
277 /**
278 * @param array $data
279 *
280 * @return void
281 */
282 public static function periodFactory(&$data)
283 {
284 $data['locationId'] = null;
285
286 $data['periodLocationList'] = [];
287 }
288
289 /**
290 * @param array $data
291 *
292 * @return array
293 */
294 public static function getServiceRepositoryData($data)
295 {
296 return [
297 'values' =>
298 [
299 ],
300 'columns' =>
301 '',
302 'placeholders' =>
303 '',
304 'columnsPlaceholders' =>
305 '',
306 ];
307 }
308
309 /**
310 * @param array $data
311 *
312 * @return void
313 */
314 public static function serviceFactory(&$data)
315 {
316 self::commonServiceFactory($data);
317
318 $data['extras'] = [];
319
320 $data['show'] = 1;
321
322 $data['timeAfter'] = 0;
323
324 $data['timeBefore'] = 0;
325
326 $data['minCapacity'] = 1;
327
328 $data['maxCapacity'] = 1;
329 }
330
331 /**
332 * @param array $data
333 *
334 * @return void
335 */
336 public static function commonServiceFactory(&$data)
337 {
338 $data['recurringCycle'] = 'disabled';
339
340 $data['recurringSub'] = 'future';
341
342 $data['recurringPayment'] = 0;
343
344 $data['customPricing'] = null;
345
346 $data['limitPerCustomer'] = null;
347
348 $data['deposit'] = 0;
349
350 $data['depositPayment'] = 'disabled';
351
352 $data['depositPerPerson'] = 1;
353
354 $data['fullPayment'] = 0;
355 }
356
357 /**
358 * @param array $data
359 *
360 * @return array
361 */
362 public static function getEventRepositoryData($data)
363 {
364 return [
365 'values' =>
366 [
367 ],
368 'addValues' =>
369 [
370 ],
371 'columns' =>
372 '',
373 'placeholders' =>
374 '',
375 'columnsPlaceholders' =>
376 '',
377 ];
378 }
379
380 /**
381 * @param array $data
382 *
383 * @return void
384 */
385 public static function eventFactory(&$data)
386 {
387 self::commonEventFactory($data);
388
389 $data['tags'] = [];
390 }
391
392 /**
393 * @param array $data
394 *
395 * @return void
396 */
397 public static function commonEventFactory(&$data)
398 {
399 $data['ticketRangeRec'] = 'calculate';
400
401 $data['deposit'] = 0;
402
403 $data['depositPayment'] = 'disabled';
404
405 $data['fullPayment'] = 0;
406
407 $data['customPricing'] = 0;
408
409 $data['depositPerPerson'] = 1;
410
411 $data['locationId'] = null;
412 }
413 }
414