Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to set default state for planned task #18264

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
1 change: 1 addition & 0 deletions install/empty_data.php
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ public function getEmptyData(): array
'attach_ticket_documents_to_mail' => '0',
'backcreated' => '1',
'task_state' => '1',
'planned_task_state' => '1',
'palette' => 'auror',
'page_layout' => 'vertical',
'fold_menu' => '0',
Expand Down
7 changes: 7 additions & 0 deletions install/migrations/update_10.0.x_to_11.0.0/configs.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,17 @@
'set_followup_tech' => '0',
'set_solution_tech' => '0',
'is_demo_dashboards' => '0',
'planned_task_state' => Planning::TODO,
]);
$migration->addField('glpi_users', 'toast_location', 'string');

$migration->addField('glpi_users', 'set_followup_tech', 'tinyint DEFAULT NULL');
$migration->addField('glpi_users', 'set_solution_tech', 'tinyint DEFAULT NULL');
$migration->addField(
'glpi_users',
'planned_task_state',
'int DEFAULT NULL',
['value' => Planning::TODO]
);

$migration->removeConfig(['url_base_api']);
1 change: 1 addition & 0 deletions install/mysql/glpi-empty.sql
Original file line number Diff line number Diff line change
Expand Up @@ -7815,6 +7815,7 @@ CREATE TABLE `glpi_users` (
`privatebookmarkorder` longtext,
`backcreated` tinyint DEFAULT NULL,
`task_state` int DEFAULT NULL,
`planned_task_state` int DEFAULT NULL,
`palette` char(20) DEFAULT NULL,
`page_layout` char(20) DEFAULT NULL,
`fold_menu` tinyint DEFAULT NULL,
Expand Down
2 changes: 1 addition & 1 deletion src/autoload/CFG_GLPI.php
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@
'priority_6', 'refresh_views', 'set_default_tech',
'set_followup_tech', 'set_solution_tech',
'set_default_requester', 'show_count_on_tabs',
'show_jobs_at_login', 'task_private', 'task_state',
'show_jobs_at_login', 'task_private', 'task_state', 'planned_task_state',
'use_flat_dropdowntree', 'use_flat_dropdowntree_on_search_result', 'palette', 'page_layout',
'highcontrast_css', 'default_dashboard_central', 'default_dashboard_assets',
'default_dashboard_helpdesk', 'default_dashboard_mini_ticket', 'default_central_tab',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@
<script type="text/javascript">
function showPlanUpdate{{ rand }}(e) {
$('#plan{{ rand }}').hide();
$('#dropdown_state{{ rand }}').trigger('setValue', {{ session('glpiplanned_task_state') }});
$('#viewplan{{ rand }}').load('{{ path('/ajax/planning.php') }}', {
action: "add_event_classic_form",
form: "followups", // Was followups for tasks before. Can't find where this is used.
Expand Down
6 changes: 6 additions & 0 deletions templates/pages/setup/general/preferences_setup.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,12 @@
{% do call('Planning::dropdownState', ['task_state', config['task_state'], true]) %}
{% endset %}
{{ fields.htmlField('', task_state_dropdown, __('Tasks state by default'), field_options) }}

{% set planned_task_state_dropdown %}
{% do call('Planning::dropdownState', ['planned_task_state', config['planned_task_state'], true]) %}
{% endset %}
{{ fields.htmlField('', planned_task_state_dropdown, __('Planned tasks state by default'), field_options) }}

{{ fields.dropdownNumberField(
'refresh_views',
config['refresh_views'],
Expand Down