Skip to content

Commit dcfcab6

Browse files
committed
added oldest year setting
1 parent 159b6dc commit dcfcab6

3 files changed

Lines changed: 10 additions & 5 deletions

File tree

src/Controllers/ConfigurationsController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public function index()
2828
'email.google_plus_link', 'email.facebook_link', 'email.twitter_link', 'email.footer', 'email.footer_link',
2929
'email.color_body_bg', 'email.color_header_bg', 'email.color_content_bg', 'email.color_footer_bg',
3030
'email.color_button_bg', 'email.account.name', 'email.account.mailbox' ];
31-
$tickets_section = ['default_status_id', 'default_close_status_id', 'default_reopen_status_id', 'subject_content_column', 'paginate_items', 'attachments_ticket_max_size', 'attachments_ticket_max_files_num', 'attachments_mimes', 'attachments_path', 'thumbnails_path', 'user_route'];
31+
$tickets_section = ['default_status_id', 'default_close_status_id', 'default_reopen_status_id', 'subject_content_column', 'paginate_items', 'attachments_ticket_max_size', 'attachments_ticket_max_files_num', 'attachments_mimes', 'attachments_path', 'thumbnails_path', 'oldest_year', 'user_route'];
3232
$perms_section = ['agent_restrict', 'close_ticket_perm', 'reopen_ticket_perm'];
3333
$editor_section = ['editor_enabled', 'include_font_awesome', 'editor_html_highlighter', 'codemirror_theme',
3434
'summernote_locale', 'summernote_options_json_file', 'summernote_options_user', 'purifier_config', ];

src/Controllers/TicketsController.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -758,12 +758,12 @@ protected function validation_common($request, $new_ticket = true)
758758

759759
$request->merge([
760760
// Avoid PDOException for example with year 1
761-
'start_date' => ($start_date->year < 2017 or $start_date->year > $plus_10_y) ? Carbon::now()->toDateTimeString() : $start_date->toDateTimeString(),
761+
'start_date' => ($start_date->year < Setting::grab('oldest_year') or $start_date->year > $plus_10_y) ? Carbon::now()->toDateTimeString() : $start_date->toDateTimeString(),
762762
'start_date_year' => $start_date->year
763763
]);
764764

765765
$fields['start_date'] = 'date';
766-
$fields['start_date_year'] = 'in:'.implode(',', range('2017', $plus_10_y));
766+
$fields['start_date_year'] = 'in:'.implode(',', range(Setting::grab('oldest_year'), $plus_10_y));
767767
}
768768
}
769769

@@ -784,12 +784,12 @@ protected function validation_common($request, $new_ticket = true)
784784

785785
$request->merge([
786786
// Avoid PDOException for example with year 1
787-
'limit_date' => ($limit_date->year < 2017 or $limit_date->year > $plus_10_y) ? Carbon::now()->toDateTimeString() : $limit_date->toDateTimeString(),
787+
'limit_date' => ($limit_date->year < Setting::grab('oldest_year') or $limit_date->year > $plus_10_y) ? Carbon::now()->toDateTimeString() : $limit_date->toDateTimeString(),
788788
'limit_date_year' => $limit_date->year
789789
]);
790790

791791
$fields['limit_date'] = 'date';
792-
$fields['limit_date_year'] = 'in:'.implode(',', range('2017', $plus_10_y));
792+
$fields['limit_date_year'] = 'in:'.implode(',', range(Setting::grab('oldest_year'), $plus_10_y));
793793
}
794794
}
795795

src/Seeds/SettingsTableSeeder.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,11 @@ public function getDefaults()
225225
'attachments_path' => 'panichd_attachments',
226226
'thumbnails_path' => 'panichd_thumbnails',
227227

228+
/*
229+
* Oldest year for ticket start date or limit date
230+
*/
231+
'oldest_year' => '2017',
232+
228233

229234
/*
230235
* Pagination length: For tickets table.

0 commit comments

Comments
 (0)