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