PluginProbe ʕ •ᴥ•ʔ
Appointment Booking Plugin – LatePoint | Calendar & Scheduling for WordPress / 5.2.2
Appointment Booking Plugin – LatePoint | Calendar & Scheduling for WordPress v5.2.2
5.6.8 5.6.7 5.6.6 5.6.5 5.6.4 5.6.3 5.6.2 5.6.1 5.6.0 5.5.2 5.5.1 5.5.0 5.4.2 trunk 5.1.0 5.1.1 5.1.2 5.1.3 5.1.4 5.1.5 5.1.6 5.1.7 5.1.8 5.1.9 5.1.91 5.1.92 5.1.93 5.1.94 5.2.0 5.2.1 5.2.10 5.2.11 5.2.2 5.2.3 5.2.4 5.2.5 5.2.6 5.2.7 5.2.8 5.2.9 5.3.0 5.3.1 5.3.2 5.4.0 5.4.1
latepoint / lib / helpers / version_specific_updates_helper.php
latepoint / lib / helpers Last commit date
activities_helper.php 1 year ago agent_helper.php 1 year ago auth_helper.php 9 months ago blocks_helper.php 1 year ago booking_helper.php 1 year ago bricks_helper.php 1 year ago bundles_helper.php 1 year ago calendar_helper.php 9 months ago carts_helper.php 1 year ago connector_helper.php 1 year ago csv_helper.php 9 months ago customer_helper.php 9 months ago customer_import_helper.php 9 months ago database_helper.php 9 months ago debug_helper.php 1 year ago defaults_helper.php 1 year ago elementor_helper.php 1 year ago email_helper.php 9 months ago encrypt_helper.php 1 year ago events_helper.php 1 year ago form_helper.php 9 months ago icalendar_helper.php 1 year ago image_helper.php 1 year ago invoices_helper.php 9 months ago license_helper.php 1 year ago location_helper.php 1 year ago marketing_systems_helper.php 1 year ago meeting_systems_helper.php 1 year ago menu_helper.php 9 months ago meta_helper.php 1 year ago migrations_helper.php 1 year ago money_helper.php 1 year ago notifications_helper.php 9 months ago order_intent_helper.php 9 months ago orders_helper.php 1 year ago otp_helper.php 9 months ago pages_helper.php 1 year ago params_helper.php 1 year ago payments_helper.php 1 year ago price_breakdown_helper.php 1 year ago process_jobs_helper.php 1 year ago processes_helper.php 1 year ago replacer_helper.php 1 year ago resource_helper.php 1 year ago roles_helper.php 9 months ago router_helper.php 1 year ago service_helper.php 1 year ago sessions_helper.php 1 year ago settings_helper.php 9 months ago short_links_systems_helper.php 9 months ago shortcodes_helper.php 9 months ago sms_helper.php 1 year ago steps_helper.php 9 months ago stripe_connect_helper.php 9 months ago styles_helper.php 9 months ago support_topics_helper.php 1 year ago time_helper.php 9 months ago timeline_helper.php 9 months ago transaction_helper.php 1 year ago transaction_intent_helper.php 1 year ago util_helper.php 9 months ago version_specific_updates_helper.php 9 months ago whatsapp_helper.php 1 year ago work_periods_helper.php 1 year ago wp_datetime.php 1 year ago wp_user_helper.php 1 year ago
version_specific_updates_helper.php
482 lines
1 <?php
2
3 class OsVersionSpecificUpdatesHelper {
4
5
6 /**
7 *
8 * Used to target a specific version during an update
9 *
10 * @return bool
11 */
12 public static function run_version_specific_updates() {
13 $current_db_version = OsSettingsHelper::get_db_version();
14 if (!$current_db_version) return false;
15 $sqls = [];
16 if (version_compare('1.0.2', $current_db_version) > 0) {
17 // lower than 1.0.2
18 $sqls = self::get_queries_for_nullable_columns();
19 OsDatabaseHelper::run_queries($sqls);
20 }
21 if (version_compare('1.1.0', $current_db_version) > 0) {
22 // lower than 1.1.0
23 $sqls = self::set_end_date_for_bookings();
24 OsDatabaseHelper::run_queries($sqls);
25 }
26 if (version_compare('1.3.0', $current_db_version) > 0) {
27 // lower than 1.3.0
28 $sqls = [];
29 $sqls[] = "UPDATE " . LATEPOINT_TABLE_BOOKINGS . " SET total_attendees = 1 WHERE total_attendees IS NULL;";
30 $sqls[] = "UPDATE " . LATEPOINT_TABLE_SERVICES . " SET visibility = '" . LATEPOINT_SERVICE_VISIBILITY_VISIBLE . "' WHERE visibility IS NULL OR visibility = '';";
31 $sqls[] = "UPDATE " . LATEPOINT_TABLE_SERVICES . " SET capacity_min = 1 WHERE capacity_min IS NULL;";
32 $sqls[] = "UPDATE " . LATEPOINT_TABLE_SERVICES . " SET capacity_max = 1 WHERE capacity_max IS NULL;";
33 OsDatabaseHelper::run_queries($sqls);
34 }
35 if (version_compare('1.3.1', $current_db_version) > 0) {
36 $sqls = [];
37 $sqls[] = "ALTER TABLE " . LATEPOINT_TABLE_CUSTOMERS . " MODIFY COLUMN first_name varchar(255)";
38 OsDatabaseHelper::run_queries($sqls);
39 }
40 if (version_compare('1.3.7', $current_db_version) > 0) {
41 $sqls = [];
42 $sqls[] = "ALTER TABLE " . LATEPOINT_TABLE_AGENTS . " MODIFY COLUMN wp_user_id int(11)";
43 OsDatabaseHelper::run_queries($sqls);
44 }
45 if (version_compare('1.4.8', $current_db_version) > 0) {
46 update_option('latepoint_db_seeded', true);
47 OsSettingsHelper::save_setting_by_name('timeslot_blocking_statuses', LATEPOINT_BOOKING_STATUS_APPROVED);
48 OsSettingsHelper::save_setting_by_name('calendar_hidden_statuses', LATEPOINT_BOOKING_STATUS_CANCELLED);
49 OsSettingsHelper::save_setting_by_name('need_action_statuses', implode(',', [LATEPOINT_BOOKING_STATUS_PENDING, LATEPOINT_BOOKING_STATUS_PAYMENT_PENDING]));
50 $tile_info = OsSettingsHelper::get_booking_template_for_calendar();
51 $tile_info = OsUtilHelper::replace_single_curly_with_double($tile_info);
52 OsSettingsHelper::save_setting_by_name('booking_template_for_calendar', $tile_info);
53
54 // -------
55 // Update {var} to {{var}}
56 // -------
57
58 // password reset message
59 $content_to_replace = OsUtilHelper::replace_single_curly_with_double(OsSettingsHelper::get_settings_value('email_customer_password_reset_request_content', ''));
60 OsSettingsHelper::save_setting_by_name('email_customer_password_reset_request_content', $content_to_replace);
61
62 // new message (chat)
63 $content_to_replace = OsUtilHelper::replace_single_curly_with_double(OsSettingsHelper::get_settings_value('email_notification_customer_has_new_message_content', ''));
64 OsSettingsHelper::save_setting_by_name('email_notification_customer_has_new_message_content', $content_to_replace);
65
66 // js tracking code
67 $content_to_replace = OsUtilHelper::replace_single_curly_with_double(OsSettingsHelper::get_settings_value('confirmation_step_tracking_code', ''));
68 OsSettingsHelper::save_setting_by_name('confirmation_step_tracking_code', $content_to_replace);
69
70 // Google calendar
71 $content_to_replace = OsUtilHelper::replace_single_curly_with_double(OsSettingsHelper::get_settings_value('google_calendar_event_summary_template', ''));
72 if (!empty($content_to_replace)) OsSettingsHelper::save_setting_by_name('google_calendar_event_summary_template', $content_to_replace);
73 $content_to_replace = OsUtilHelper::replace_single_curly_with_double(OsSettingsHelper::get_settings_value('google_calendar_event_description_template', ''));
74 if (!empty($content_to_replace)) OsSettingsHelper::save_setting_by_name('google_calendar_event_description_template', $content_to_replace);
75
76
77 // -------
78 // migrate old notification system to processes
79 // -------
80
81 $process_actions = [];
82 // STATUS CHANGE NOTIFICATION
83
84 if (OsSettingsHelper::is_on('notifications_email')) {
85 // email
86
87 foreach (['agent', 'customer'] as $user_type) {
88 $action = [];
89 if (OsSettingsHelper::is_on('notification_' . $user_type . '_booking_status_changed')) {
90 $action['type'] = 'send_email';
91 $action['settings']['to_email'] = '{{' . $user_type . '_full_name}} <{{' . $user_type . '_email}}>';
92 $action['settings']['subject'] = OsUtilHelper::replace_single_curly_with_double(OsSettingsHelper::get_settings_value('notification_' . $user_type . '_booking_status_changed_notification_subject', ''));
93 $action['settings']['content'] = OsUtilHelper::replace_single_curly_with_double(OsSettingsHelper::get_settings_value('notification_' . $user_type . '_booking_status_changed_notification_content', ''));
94 $process_actions[\LatePoint\Misc\ProcessAction::generate_id()] = $action;
95 }
96 }
97 if ($process_actions) {
98 // put all under single process with multiple actions
99 $process = new OsProcessModel();
100 $process->event_type = 'booking_updated';
101 $process->name = 'Booking status change notification';
102
103 $trigger_conditions[] = ['object' => 'old_booking', 'property' => 'old_booking__status', 'operator' => 'changed', 'value' => ''];
104 $process_actions = OsProcessesHelper::iterate_trigger_conditions($trigger_conditions, $process_actions);
105 $process_actions[0]['time_offset'] = [];
106 $process->actions_json = wp_json_encode($process_actions);
107 if (!OsProcessesHelper::check_if_process_exists($process)) $process->save();
108 }
109
110 }
111
112
113 $process_actions = [];
114 // NEW BOOKING NOTIFICATION
115 if (OsSettingsHelper::is_on('notifications_email')) {
116 OsSettingsHelper::save_setting_by_name('notifications_email_processor', 'wp_mail');
117 // email
118 foreach (['agent', 'customer'] as $user_type) {
119 $action = [];
120 if (OsSettingsHelper::is_on('notification_' . $user_type . '_confirmation')) {
121 $action['type'] = 'send_email';
122 $action['settings']['to_email'] = '{{' . $user_type . '_email}}';
123 $action['settings']['subject'] = OsUtilHelper::replace_single_curly_with_double(OsSettingsHelper::get_settings_value((($user_type == 'agent') ? 'notification_agent_new_booking_notification_subject' : 'notification_customer_booking_confirmation_subject'), ''));
124 $action['settings']['content'] = OsUtilHelper::replace_single_curly_with_double(OsSettingsHelper::get_settings_value((($user_type == 'agent') ? 'notification_agent_new_booking_notification_content' : 'notification_customer_booking_confirmation_content'), ''));
125 $process_actions[\LatePoint\Misc\ProcessAction::generate_id()] = $action;
126 }
127 }
128 }
129 if (OsSettingsHelper::is_on('notifications_sms')) {
130 OsSettingsHelper::save_setting_by_name('notifications_sms_processor', 'twilio');
131 // sms
132 foreach (['agent', 'customer'] as $user_type) {
133 $action = [];
134 if (OsSettingsHelper::is_on('notification_sms_' . $user_type . '_confirmation')) {
135 $action['type'] = 'send_sms';
136 $action['settings']['to_phone'] = '{{' . $user_type . '_phone}}';
137 $action['settings']['content'] = OsUtilHelper::replace_single_curly_with_double(OsSettingsHelper::get_settings_value((($user_type == 'agent') ? 'notification_sms_agent_new_booking_notification_message' : 'notification_sms_customer_booking_confirmation_message'), ''));
138 $process_actions[\LatePoint\Misc\ProcessAction::generate_id()] = $action;
139 }
140 }
141 }
142
143
144 // webhooks for new booking
145
146 // migrate webhooks for new booking into processes
147 $webhooks = json_decode(OsSettingsHelper::get_settings_value('webhooks', ''), true);
148 if ($webhooks) {
149 foreach ($webhooks as $webhook) {
150 // only process new booking
151 if ($webhook['status'] != 'active' || $webhook['trigger'] != 'new_booking') continue;
152 $action = [];
153 $action['type'] = 'trigger_webhook';
154 $action['settings']['url'] = $webhook['url'];
155 $process_actions[$webhook['id']] = $action;
156 }
157 }
158
159 // CREATE NEW BOOKING PROCESSES IF THERE ARE ANY ACTIONS
160 if ($process_actions) {
161 // put all under single process with multiple actions
162 $process = new OsProcessModel();
163 $process->event_type = 'booking_created';
164 $process->name = 'Booking created notification';
165
166 $process_actions = OsProcessesHelper::iterate_trigger_conditions([], $process_actions);
167 $process_actions[0]['time_offset'] = [];
168 $process->actions_json = wp_json_encode($process_actions);
169 if (!OsProcessesHelper::check_if_process_exists($process)) $process->save();
170 }
171
172 // migrate other webhooks (not new booking) into processes
173 if ($webhooks) {
174 $process_actions_for_triggers = ['updated_booking' => [], 'new_customer' => [], 'new_transaction' => []];
175 foreach ($webhooks as $webhook) {
176 if ($webhook['status'] != 'active' || !in_array($webhook['trigger'], ['updated_booking', 'new_customer', 'new_transaction'])) continue;
177 $process_actions_for_triggers[$webhook['trigger']][$webhook['id']] = ['type' => 'trigger_webhook', 'settings' => ['url' => $webhook['url']]];
178 }
179 foreach ($process_actions_for_triggers as $webhook_trigger => $actions) {
180 if ($actions) {
181 $process = new OsProcessModel();
182 switch ($webhook_trigger) {
183 case 'updated_booking':
184 $process->name = 'Booking updated notification';
185 $process->event_type = 'booking_updated';
186 break;
187 case 'new_customer':
188 $process->name = 'New customer notification';
189 $process->event_type = 'customer_created';
190 break;
191 case 'new_transaction':
192 $process->name = 'New transaction notification';
193 $process->event_type = 'transaction_created';
194 break;
195 }
196 $process_actions = OsProcessesHelper::iterate_trigger_conditions([], $actions);
197 $process_actions[0]['time_offset'] = [];
198 $process->actions_json = wp_json_encode($process_actions);
199 if (!OsProcessesHelper::check_if_process_exists($process)) $process->save();
200 }
201 }
202 }
203
204 // migrate reminders into processes
205 // old example: {"rem_0zMZzZVY":{"name":"Reminder to customer","medium":"email","receiver":"customer","value":"7","unit":"day","when":"before","subject":"Reminder","content":"<p>Testing<\/p>","id":"rem_0zMZzZVY"}}
206 // multiple: {"rem_POtZuDDd":{"name":"Sms Reminder before","medium":"sms","receiver":"customer","value":"7","unit":"day","when":"before","subject":"","content":"<p>Testing<\/p>","id":"rem_POtZuDDd"},"rem_q4kA6JwC":{"name":"Sms Reminder after","medium":"sms","receiver":"agent","value":"7","unit":"day","when":"after","subject":"test","content":"Testing","id":"rem_q4kA6JwC"},"rem_hR6YOF3w":{"name":"Email Reminder after","medium":"email","receiver":"agent","value":"7","unit":"day","when":"after","subject":"test","content":"Testing","id":"rem_hR6YOF3w"}}
207 $reminders = json_decode(OsSettingsHelper::get_settings_value('reminders', ''), true);
208 if ($reminders) {
209 $processes = [];
210 $actions = [];
211 foreach ($reminders as $reminder) {
212
213 // create action
214 $action = [];
215 $action_id = \LatePoint\Misc\ProcessAction::generate_id();
216 $action['settings']['content'] = OsUtilHelper::replace_single_curly_with_double($reminder['content'] ?? '');
217 switch ($reminder['medium']) {
218 case 'sms':
219 $action['type'] = 'send_sms';
220 $action['settings']['to_phone'] = ($reminder['receiver'] == 'customer') ? '{{customer_phone}}' : '{{agent_phone}}';
221 break;
222 case 'email':
223 $action['type'] = 'send_email';
224 $action['settings']['to_email'] = ($reminder['receiver'] == 'customer') ? '{{customer_email}}' : '{{agent_email}}';
225 $action['settings']['subject'] = OsUtilHelper::replace_single_curly_with_double($reminder['subject']);
226 break;
227 }
228
229 // generate time offset
230 $time_offset = ['value' => $reminder['value'], 'unit' => $reminder['unit'], 'before_after' => $reminder['when']];
231
232 // attach to process
233 if ($processes) {
234 $existing = false;
235 // try to find process that matches parameters
236 for ($i = 0; $i < count($processes); $i++) {
237 if ($processes[$i]['time_offset'] == $time_offset) {
238 $processes[$i]['actions'][$action_id] = $action;
239 $existing = true;
240 break;
241 }
242 }
243 // didn't find process with same time offset, create new
244 if (!$existing) {
245 $process = ['name' => $reminder['name'], 'event_type' => 'booking_start', 'time_offset' => $time_offset, 'actions' => []];
246 $process['actions'][$action_id] = $action;
247 $processes[] = $process;
248 }
249 } else {
250 $process = ['name' => $reminder['name'], 'event_type' => 'booking_start', 'time_offset' => $time_offset, 'actions' => []];
251 $process['actions'][$action_id] = $action;
252 $processes[] = $process;
253 }
254
255
256 }
257 if ($processes) {
258 foreach ($processes as $process_data) {
259 $process = new OsProcessModel();
260 $process->event_type = $process_data['event_type'];
261 $process->name = $process_data['name'];
262
263 $process_actions = OsProcessesHelper::iterate_trigger_conditions([], $process_data['actions']);
264 $process_actions[0]['time_offset'] = $process_data['time_offset'];
265 $process->actions_json = wp_json_encode($process_actions);
266 if (!OsProcessesHelper::check_if_process_exists($process)) $process->save();
267 }
268 }
269 }
270
271 // Update customer phone numbers to new E.164 format based on the country that was selected in settings
272 $customers = new OsCustomerModel();
273 $customers = $customers->get_results_as_models();
274 foreach ($customers as $customer) {
275 if (empty($customer->phone)) continue;
276 $formatted_phone = OsUtilHelper::sanitize_phone_number($customer->phone, OsSettingsHelper::get_settings_value('country_phone_code', ''));
277 if (!empty($formatted_phone)) $customer->update_attributes(['phone' => $formatted_phone]);
278 }
279 // update agent phone numbers
280 $agents = new OsAgentModel();
281 $agents = $agents->get_results_as_models();
282 foreach ($agents as $agent) {
283 if (empty($agent->phone)) continue;
284 $formatted_phone = OsUtilHelper::sanitize_phone_number($agent->phone, OsSettingsHelper::get_settings_value('country_phone_code', ''));
285 if (!empty($formatted_phone)) $agent->update_attributes(['phone' => $formatted_phone]);
286 }
287 }
288
289 if (version_compare('1.4.91', $current_db_version) > 0) {
290 $sqls = [];
291 $has_column = OsDatabaseHelper::run_query("SHOW COLUMNS FROM " . LATEPOINT_TABLE_BOOKINGS . " LIKE 'start_datetime_gmt'");
292 if ($has_column) $sqls[] = "ALTER TABLE " . LATEPOINT_TABLE_BOOKINGS . " DROP COLUMN start_datetime_gmt";
293
294 $has_column = OsDatabaseHelper::run_query("SHOW COLUMNS FROM " . LATEPOINT_TABLE_BOOKINGS . " LIKE 'end_datetime_gmt'");
295 if ($has_column) $sqls[] = "ALTER TABLE " . LATEPOINT_TABLE_BOOKINGS . " DROP COLUMN end_datetime_gmt";
296
297 if (!empty($sqls)) OsDatabaseHelper::run_queries($sqls);
298 }
299
300
301 if (version_compare('2.0.0', $current_db_version) > 0) {
302 // we used to have a typo in a column name, check if it still exists and assign its values to a correctly named column
303 $has_typo = OsDatabaseHelper::run_query("SHOW COLUMNS FROM " . LATEPOINT_TABLE_BOOKINGS . " LIKE 'total_attendies'");
304 if ($has_typo) {
305 $sqls = [];
306 $sqls[] = "UPDATE " . LATEPOINT_TABLE_BOOKINGS . " SET total_attendees = total_attendies WHERE total_attendees IS NULL";
307 OsDatabaseHelper::run_queries($sqls);
308 }
309
310 // deactivate old addons that are replaced by a PRO addon
311 $plugins_to_deactivate = [
312 'latepoint-custom-fields/latepoint-custom-fields.php',
313 'latepoint-locations/latepoint-locations.php',
314 'latepoint-webhooks/latepoint-webhooks.php',
315 'latepoint-qr-code/latepoint-qr-code.php',
316 'latepoint-reminders/latepoint-reminders.php',
317 'latepoint-role-manager/latepoint-role-manager.php',
318 'latepoint-timezone-selector/latepoint-timezone-selector.php',
319 'latepoint-group-bookings/latepoint-group-bookings.php',
320 'latepoint-taxes/latepoint-taxes.php',
321 'latepoint-service-durations/latepoint-service-durations.php',
322 'latepoint-service-extras/latepoint-service-extras.php',
323 'latepoint-messages/latepoint-messages.php',
324 'latepoint-coupons/latepoint-coupons.php',
325 ];
326 $deactivated_plugins = [];
327
328 foreach ($plugins_to_deactivate as $plugin) {
329 if (is_plugin_active($plugin)) {
330 $deactivated_plugins[] = OsUtilHelper::extract_plugin_name_from_path($plugin);
331 deactivate_plugins($plugin);
332 }
333 }
334
335 $report = OsMigrationsHelper::migrate_from_version_4();
336
337 if($deactivated_plugins) OsSettingsHelper::save_setting_by_name('migration_version_5_deactivated_plugins', implode(', ', $deactivated_plugins));
338
339 // if wizard has not been visited yet - redirect to it
340 add_option('latepoint_show_version_5_modal', true);
341 }
342 if (version_compare('2.2.5', $current_db_version) > 0) {
343 $sqls = [];
344 $sqls = "ALTER TABLE ".LATEPOINT_TABLE_CUSTOMERS." MODIFY COLUMN email VARCHAR(320) NULL";
345 OsDatabaseHelper::run_queries($sqls);
346
347
348 }
349
350 /**
351 * Hook your updates to database that need to be run for specific version of database
352 *
353 * @since 1.0.0
354 * @hook latepoint_run_version_specific_updates
355 *
356 * @param {string} version of database before the update
357 */
358 do_action('latepoint_run_version_specific_updates', $current_db_version);
359 return true;
360 }
361
362
363
364 public static function set_end_date_for_bookings() {
365 $sqls = [];
366
367 $sqls[] = "UPDATE " . LATEPOINT_TABLE_BOOKINGS . " SET end_date = start_date WHERE end_date IS NULL;";
368 return $sqls;
369 }
370
371 public static function get_queries_for_nullable_columns() {
372 $sqls = [];
373
374 $sqls[] = "ALTER TABLE " . LATEPOINT_TABLE_BOOKINGS . "
375 MODIFY COLUMN ip_address varchar(55),
376 MODIFY COLUMN created_at datetime,
377 MODIFY COLUMN updated_at datetime;";
378
379
380 $sqls[] = "ALTER TABLE " . LATEPOINT_TABLE_CUSTOMER_META . "
381 MODIFY COLUMN meta_value text,
382 MODIFY COLUMN created_at datetime,
383 MODIFY COLUMN updated_at datetime;";
384
385 $sqls[] = "ALTER TABLE " . LATEPOINT_TABLE_SETTINGS . "
386 MODIFY COLUMN value text,
387 MODIFY COLUMN created_at datetime,
388 MODIFY COLUMN updated_at datetime;";
389
390 $sqls[] = "ALTER TABLE " . LATEPOINT_TABLE_SERVICES . "
391 MODIFY COLUMN short_description text,
392 MODIFY COLUMN is_price_variable boolean,
393 MODIFY COLUMN price_min decimal(20,4),
394 MODIFY COLUMN price_max decimal(20,4),
395 MODIFY COLUMN charge_amount decimal(20,4),
396 MODIFY COLUMN is_deposit_required boolean,
397 MODIFY COLUMN buffer_before int(11),
398 MODIFY COLUMN buffer_after int(11),
399 MODIFY COLUMN category_id int(11),
400 MODIFY COLUMN order_number int(11),
401 MODIFY COLUMN selection_image_id int(11),
402 MODIFY COLUMN description_image_id int(11),
403 MODIFY COLUMN bg_color varchar(20),
404 MODIFY COLUMN created_at datetime,
405 MODIFY COLUMN updated_at datetime;";
406
407 $sqls[] = "ALTER TABLE " . LATEPOINT_TABLE_AGENTS . "
408 MODIFY COLUMN avatar_image_id int(11),
409 MODIFY COLUMN last_name varchar(255),
410 MODIFY COLUMN phone varchar(255),
411 MODIFY COLUMN password varchar(255),
412 MODIFY COLUMN custom_hours boolean,
413 MODIFY COLUMN created_at datetime,
414 MODIFY COLUMN updated_at datetime;";
415
416 $sqls[] = "ALTER TABLE " . LATEPOINT_TABLE_STEP_SETTINGS . "
417 MODIFY COLUMN value text,
418 MODIFY COLUMN step varchar(50),
419 MODIFY COLUMN created_at datetime,
420 MODIFY COLUMN updated_at datetime;";
421
422 $sqls[] = "ALTER TABLE " . LATEPOINT_TABLE_CUSTOMERS . "
423 MODIFY COLUMN last_name varchar(255),
424 MODIFY COLUMN phone varchar(255),
425 MODIFY COLUMN avatar_image_id int(11),
426 MODIFY COLUMN password varchar(255),
427 MODIFY COLUMN activation_key varchar(255),
428 MODIFY COLUMN account_nonse varchar(255),
429 MODIFY COLUMN google_user_id varchar(255),
430 MODIFY COLUMN facebook_user_id varchar(255),
431 MODIFY COLUMN is_guest boolean,
432 MODIFY COLUMN notes text,
433 MODIFY COLUMN created_at datetime,
434 MODIFY COLUMN updated_at datetime;";
435
436 $sqls[] = "ALTER TABLE " . LATEPOINT_TABLE_SERVICE_CATEGORIES . "
437 MODIFY COLUMN short_description text,
438 MODIFY COLUMN parent_id mediumint(9),
439 MODIFY COLUMN selection_image_id int(11),
440 MODIFY COLUMN order_number int(11),
441 MODIFY COLUMN created_at datetime,
442 MODIFY COLUMN updated_at datetime";
443
444 $sqls[] = "ALTER TABLE " . LATEPOINT_TABLE_CUSTOM_PRICES . "
445 MODIFY COLUMN is_price_variable boolean,
446 MODIFY COLUMN price_min decimal(20,4),
447 MODIFY COLUMN price_max decimal(20,4),
448 MODIFY COLUMN charge_amount decimal(20,4),
449 MODIFY COLUMN is_deposit_required boolean,
450 MODIFY COLUMN created_at datetime,
451 MODIFY COLUMN updated_at datetime";
452
453 $sqls[] = "ALTER TABLE " . LATEPOINT_TABLE_WORK_PERIODS . "
454 MODIFY COLUMN custom_date date,
455 MODIFY COLUMN created_at datetime,
456 MODIFY COLUMN updated_at datetime";
457
458 $sqls[] = "ALTER TABLE " . LATEPOINT_TABLE_AGENTS_SERVICES . "
459 MODIFY COLUMN is_custom_hours BOOLEAN,
460 MODIFY COLUMN is_custom_price BOOLEAN,
461 MODIFY COLUMN is_custom_duration BOOLEAN,
462 MODIFY COLUMN created_at datetime,
463 MODIFY COLUMN updated_at datetime";
464
465 $sqls[] = "ALTER TABLE " . LATEPOINT_TABLE_ACTIVITIES . "
466 MODIFY COLUMN agent_id int(11),
467 MODIFY COLUMN booking_id int(11),
468 MODIFY COLUMN service_id int(11),
469 MODIFY COLUMN customer_id int(11),
470 MODIFY COLUMN description text,
471 MODIFY COLUMN initiated_by varchar(100),
472 MODIFY COLUMN initiated_by_id int(11),
473 MODIFY COLUMN created_at datetime,
474 MODIFY COLUMN updated_at datetime";
475
476 $sqls[] = "ALTER TABLE " . LATEPOINT_TABLE_TRANSACTIONS . "
477 MODIFY COLUMN notes text,
478 MODIFY COLUMN created_at datetime,
479 MODIFY COLUMN updated_at datetime";
480 return $sqls;
481 }
482 }