diff --git a/htdocs/admin/agenda_other.php b/htdocs/admin/agenda_other.php index 364680757cf..b9051f6f33a 100644 --- a/htdocs/admin/agenda_other.php +++ b/htdocs/admin/agenda_other.php @@ -74,8 +74,9 @@ if (preg_match('/del_(.*)/',$action,$reg)) if ($action == 'set') { - dolibarr_set_const($db, 'AGENDA_DEFAULT_FILTER_TYPE', GETPOST('AGENDA_DEFAULT_FILTER_TYPE'), 'chaine', 0, '', $conf->entity); - dolibarr_set_const($db, 'AGENDA_DEFAULT_FILTER_STATUS', GETPOST('AGENDA_DEFAULT_FILTER_STATUS'), 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, 'AGENDA_USE_EVENT_TYPE_DEFAULT', GETPOST('AGENDA_USE_EVENT_TYPE_DEFAULT'), 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, 'AGENDA_DEFAULT_FILTER_TYPE', GETPOST('AGENDA_DEFAULT_FILTER_TYPE'), 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, 'AGENDA_DEFAULT_FILTER_STATUS', GETPOST('AGENDA_DEFAULT_FILTER_STATUS'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, 'AGENDA_DEFAULT_VIEW', GETPOST('AGENDA_DEFAULT_VIEW'), 'chaine', 0, '', $conf->entity); } @@ -127,6 +128,17 @@ else } print ''."\n"; +if (! empty($conf->global->AGENDA_USE_EVENT_TYPE)) +{ + $var=!$var; + print ''."\n"; + print ''.$langs->trans("AGENDA_USE_EVENT_TYPE_DEFAULT").''."\n"; + print ' '."\n"; + print ''."\n"; + $formactions->select_type_actions($conf->global->AGENDA_USE_EVENT_TYPE_DEFAULT, "AGENDA_USE_EVENT_TYPE_DEFAULT", '', 0, 1); + print ''."\n"; +} + // AGENDA_DEFAULT_FILTER_TYPE $var=!$var; print ''."\n"; diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 1e4b969644c..daeab2ba408 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -647,7 +647,8 @@ if ($action == 'create') if (! empty($conf->global->AGENDA_USE_EVENT_TYPE)) { print ''.$langs->trans("Type").''; - $formactions->select_type_actions(GETPOST("actioncode")?GETPOST("actioncode"):$object->type_code, "actioncode","systemauto"); + $default=(empty($conf->global->AGENDA_USE_EVENT_TYPE_DEFAULT)?'':$conf->global->AGENDA_USE_EVENT_TYPE_DEFAULT); + $formactions->select_type_actions(GETPOST("actioncode")?GETPOST("actioncode"):($object->type_code?$object->type_code:$default), "actioncode","systemauto"); print ''; } diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 062beed5760..984f5867e1b 100755 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1546,6 +1546,7 @@ AgendaSetup=Events and agenda module setup PasswordTogetVCalExport=Key to authorize export link PastDelayVCalExport=Do not export event older than AGENDA_USE_EVENT_TYPE=Use events types (managed into menu Setup -> Dictionary -> Type of agenda events) +AGENDA_USE_EVENT_TYPE_DEFAULT=Set automatically this default value for type of event into event create form AGENDA_DEFAULT_FILTER_TYPE=Set automatically this type of event into search filter of agenda view AGENDA_DEFAULT_FILTER_STATUS=Set automatically this status for events into search filter of agenda view AGENDA_DEFAULT_VIEW=Which tab do you want to open by default when selecting menu Agenda