| @@ -71,8 +71,14 @@ | ||
| 71 | 71 | $settings['ticket_link_portal_migrated'] = 'yes'; |
| 72 | 72 | if (isset($settings['min_serial_number'])) { |
| 73 | 73 | $settings['min_serial_number'] = max(1, (int) $settings['min_serial_number']); |
| 74 | 74 | } |
| 75 | + // The frontend only ever offers 3/7/15 — reject anything else | |
| 76 | + // (a tampered request, or a stale/unexpected value) back to the | |
| 77 | + // 15-day default rather than trusting the submitted value as-is. | |
| 78 | + if (isset($settings['report_snapshot_retention']) && !in_array($settings['report_snapshot_retention'], ['3', '7', '15'], true)) { | |
| 79 | + $settings['report_snapshot_retention'] = '15'; | |
| 80 | + } | |
| 75 | 81 | } |
| 76 | 82 | |
| 77 | 83 | if ($settingsKey == 'global_business_settings' && !empty($settings['agent_time_tracking'])) { |
| 78 | 84 | if (class_exists(TimeTrackMigrator::class) && $settings['agent_time_tracking'] === 'yes') { |
| @@ -121,8 +127,9 @@ | ||
| 121 | 127 | 'enable_min_serial_number' => 'no', |
| 122 | 128 | 'ticket_prefix' => '', |
| 123 | 129 | 'min_serial_number' => 1, |
| 124 | 130 | 'enable_fluent_booking_integration' => 'no', |
| 131 | + 'report_snapshot_retention' => '15', | |
| 125 | 132 | ]; |
| 126 | 133 | |
| 127 | 134 | //Get default/existing settings from database using the key global_business_settings |
| 128 | 135 | $existingSettings = Helper::getOption('global_business_settings', []); |
| @@ -357,8 +364,19 @@ | ||
| 357 | 364 | 'depends_on' => 'enable_min_serial_number', |
| 358 | 365 | 'operator' => '=', |
| 359 | 366 | 'value' => 'yes' |
| 360 | 367 | ] |
| 368 | + ], | |
| 369 | + 'report_snapshot_retention' => [ | |
| 370 | + 'wrapper_class' => '', | |
| 371 | + 'type' => 'input-radio', | |
| 372 | + 'label' => __('Snapshot Retention', 'fluent-support'), | |
| 373 | + 'options' => [ | |
| 374 | + ['id' => '3', 'label' => __('3 days', 'fluent-support')], | |
| 375 | + ['id' => '7', 'label' => __('7 days', 'fluent-support')], | |
| 376 | + ['id' => '15', 'label' => __('15 days', 'fluent-support')], | |
| 377 | + ], | |
| 378 | + 'inline_help' => __('Advanced Reports saves a snapshot of each report every 6 hours. Snapshots older than this many days are automatically deleted.', 'fluent-support'), | |
| 361 | 379 | ] |
| 362 | 380 | ]; |
| 363 | 381 | if (defined('FLUENT_BOOKING_VERSION')) { |
| 364 | 382 | $fields['enable_fluent_booking_integration'] = [ |