diff --git a/htdocs/admin/agenda_other.php b/htdocs/admin/agenda_other.php index 4a9c359f5c1..a069a0718c9 100644 --- a/htdocs/admin/agenda_other.php +++ b/htdocs/admin/agenda_other.php @@ -26,6 +26,7 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php'; +require_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php'; if (!$user->admin) accessforbidden(); @@ -70,11 +71,20 @@ 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_DEFAULT_VIEW', GETPOST('AGENDA_DEFAULT_VIEW'), 'chaine', 0, '', $conf->entity); +} + /** * View */ +$formactions=new FormActions($db); + llxHeader(); $linkback=''.$langs->trans("BackToModuleList").''; @@ -86,43 +96,71 @@ $head=agenda_prepare_head(); dol_fiche_head($head, 'other', $langs->trans("Agenda"), 0, 'action'); -print_titre($langs->trans("OtherOptions")); +//print_titre($langs->trans("OtherOptions")); $var=true; +print '
'; +print ''; + print ''."\n"; print ''."\n"; print ''."\n"; -print ''."\n"; -print ''."\n"; +print ''."\n"; +print ''."\n"; print ''."\n"; // Manual or automatic $var=!$var; print ''."\n"; print ''."\n"; -print ''."\n"; - -print ''."\n"; +print ''."\n"; +// AGENDA_DEFAULT_FILTER_TYPE +$var=!$var; +print ''."\n"; +print ''."\n"; +print ''."\n"; +print ''."\n"; + +// AGENDA_DEFAULT_FILTER_STATUS +$var=!$var; +print ''."\n"; +print ''."\n"; +print ''."\n"; +print ''."\n"; + +// AGENDA_DEFAULT_VIEW +$var=!$var; +print ''."\n"; +print ''."\n"; +print ''."\n"; +print ''."\n"; + print '
'.$langs->trans("Parameters").' '.$langs->trans("Value").' '.$langs->trans("Value").'
'.$langs->trans("AGENDA_USE_EVENT_TYPE").' '."\n"; -if ($conf->use_javascript_ajax) +print ' '."\n"; +//print ajax_constantonoff('AGENDA_USE_EVENT_TYPE'); Do not use ajax here, we need to reload page to change other combo list +if (empty($conf->global->AGENDA_USE_EVENT_TYPE)) { - print ajax_constantonoff('AGENDA_USE_EVENT_TYPE'); + print ''.img_picto($langs->trans("Disabled"),'switch_off').''; } else { - if($conf->global->AGENDA_USE_EVENT_TYPE == 0) - { - print ''.img_picto($langs->trans("Disabled"),'off').''; - } - else if($conf->global->BUSINESS_VISIBLE_TO_ALL_BY_DEFAULT == 1) - { - print ''.img_picto($langs->trans("Enabled"),'on').''; - } + print ''.img_picto($langs->trans("Enabled"),'switch_on').''; } print '
'.$langs->trans("AGENDA_DEFAULT_FILTER_TYPE").' '."\n"; +print $formactions->select_type_actions($conf->global->AGENDA_DEFAULT_FILTER_TYPE, "AGENDA_DEFAULT_FILTER_TYPE", '', (empty($conf->global->AGENDA_USE_EVENT_TYPE) ? 1 : 0), 1); +print '
'.$langs->trans("AGENDA_DEFAULT_FILTER_STATUS").' '."\n"; +$formactions->form_select_status_action('agenda',$conf->global->AGENDA_DEFAULT_FILTER_STATUS,1,'AGENDA_DEFAULT_FILTER_STATUS',1,2); +print '
'.$langs->trans("AGENDA_DEFAULT_VIEW").' '."\n"; +$tmplist=array('show_month'=>$langs->trans("ViewCal"), 'show_week'=>$langs->trans("ViewWeek"), 'show_day'=>$langs->trans("ViewDay"), 'show_list'=>$langs->trans("ViewList"), 'show_peruser'=>$langs->trans("ViewPerUser")); +print $form->selectarray('AGENDA_DEFAULT_VIEW', $tmplist, $conf->global->AGENDA_DEFAULT_VIEW); +print '
'; +print '
'; + +print '
'; + dol_fiche_end(); print "
"; diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index e7f277a116b..a50ee50dd14 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -81,7 +81,11 @@ $pid=GETPOST("projectid","int",3); $status=GETPOST("status"); $type=GETPOST("type"); $maxprint=(isset($_GET["maxprint"])?GETPOST("maxprint"):$conf->global->AGENDA_MAX_EVENTS_DAY_VIEW); -$actioncode=GETPOST("actioncode","alpha",3)?GETPOST("actioncode","alpha",3):(GETPOST("actioncode")=='0'?'0':(empty($conf->global->AGENDA_USE_EVENT_TYPE)?'AC_OTH':'')); +$actioncode=GETPOST("actioncode","alpha",3)?GETPOST("actioncode","alpha",3):(GETPOST("actioncode")=='0'?'0':''); + +if ($actioncode == '') $actioncode=(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE); +if ($status == '') $status=(empty($conf->global->AGENDA_DEFAULT_FILTER_STATUS)?'':$conf->global->AGENDA_DEFAULT_FILTER_STATUS); +if (empty($action)) $action=(empty($conf->global->AGENDA_DEFAULT_VIEW)?'show_month':$conf->global->AGENDA_DEFAULT_VIEW); if (GETPOST('viewcal') && $action != 'show_day' && $action != 'show_week') { $action='show_month'; $day=''; @@ -93,11 +97,6 @@ if (GETPOST('viewday') || $action == 'show_day') { $action='show_day'; $day=($day?$day:date("d")); } // View by day -if (empty($action)) -{ - if (empty($conf->global->AGENDA_DEFAULT_VIEW)) $action='show_month'; - else $action=$conf->global->AGENDA_DEFAULT_VIEW; -} $langs->load("agenda"); $langs->load("other"); @@ -110,7 +109,8 @@ $hookmanager->initHooks(array('agenda')); /* * Actions */ -if (GETPOST("viewlist")) + +if (GETPOST("viewlist") || $action == 'show_list') { $param=''; foreach($_POST as $key => $val) @@ -123,6 +123,19 @@ if (GETPOST("viewlist")) exit; } +if (GETPOST("viewperuser") || $action == 'show_peruser') +{ + $param=''; + foreach($_POST as $key => $val) + { + if ($key=='token') continue; + $param.='&'.$key.'='.urlencode($val); + } + //print $param; + header("Location: ".DOL_URL_ROOT.'/comm/action/peruser.php?'.$param); + exit; +} + if ($action=='delete_action') { $event = new ActionComm($db); diff --git a/htdocs/comm/action/listactions.php b/htdocs/comm/action/listactions.php index 0c220a89194..15e75e85661 100644 --- a/htdocs/comm/action/listactions.php +++ b/htdocs/comm/action/listactions.php @@ -44,11 +44,9 @@ $status=GETPOST("status",'alpha'); $type=GETPOST('type'); $actioncode=GETPOST("actioncode","alpha",3)?GETPOST("actioncode","alpha",3):(GETPOST("actioncode")=='0'?'0':(empty($conf->global->AGENDA_USE_EVENT_TYPE)?'AC_OTH':'')); -if (empty($action)) -{ - if (empty($conf->global->AGENDA_DEFAULT_VIEW)) $action='show_list'; - else $action=$conf->global->AGENDA_DEFAULT_VIEW; -} +if ($actioncode == '') $actioncode=(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE); +if ($status == '') $status=(empty($conf->global->AGENDA_DEFAULT_FILTER_STATUS)?'':$conf->global->AGENDA_DEFAULT_FILTER_STATUS); +if (empty($action)) $action=(empty($conf->global->AGENDA_DEFAULT_VIEW)?'show_list':$conf->global->AGENDA_DEFAULT_VIEW); $filter=GETPOST("filter",'',3); $filtera = GETPOST("userasked","int",3)?GETPOST("userasked","int",3):GETPOST("filtera","int",3); @@ -214,6 +212,7 @@ if ($resql) if ($action == 'show_week') $tabactive='cardweek'; if ($action == 'show_day') $tabactive='cardday'; if ($action == 'show_list') $tabactive='cardlist'; + if ($action == 'show_peruser') $tabactive='cardperuser'; $head = calendars_prepare_head($param); diff --git a/htdocs/core/class/html.formactions.class.php b/htdocs/core/class/html.formactions.class.php index 81a7ea1f048..ed32fcc9f0d 100644 --- a/htdocs/core/class/html.formactions.class.php +++ b/htdocs/core/class/html.formactions.class.php @@ -120,7 +120,7 @@ class FormActions { //var_dump($selected); if ($selected == 'done') $selected='100'; - print ''; if ($showempty) print ''; foreach($listofstatus as $key => $val) { @@ -230,9 +230,10 @@ class FormActions * @param string $htmlname Nom champ formulaire * @param string $excludetype Type to exclude * @param string $onlyautoornot Group list by auto events or not: We keep only the 2 generic lines (AC_OTH and AC_OTH_AUTO) + * @param int $hideinfohelp 1=Do not show info help * @return void */ - function select_type_actions($selected='',$htmlname='actioncode',$excludetype='',$onlyautoornot=0) + function select_type_actions($selected='',$htmlname='actioncode',$excludetype='',$onlyautoornot=0, $hideinfohelp=0) { global $langs,$user,$form; @@ -251,7 +252,7 @@ class FormActions if ($selected == 'auto') $selected='AC_OTH_AUTO'; print $form->selectarray($htmlname, $arraylist, $selected); - if ($user->admin && empty($onlyautoornot)) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); + if ($user->admin && empty($onlyautoornot) && empty($hideinfohelp)) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); } } diff --git a/htdocs/core/lib/agenda.lib.php b/htdocs/core/lib/agenda.lib.php index 3367d227dd8..8e09c9323b5 100644 --- a/htdocs/core/lib/agenda.lib.php +++ b/htdocs/core/lib/agenda.lib.php @@ -359,6 +359,11 @@ function agenda_prepare_head() $h = 0; $head = array(); + $head[$h][0] = DOL_URL_ROOT."/admin/agenda_other.php"; + $head[$h][1] = $langs->trans("Miscellaneous"); + $head[$h][2] = 'other'; + $h++; + $head[$h][0] = DOL_URL_ROOT."/admin/agenda.php"; $head[$h][1] = $langs->trans("AutoActions"); $head[$h][2] = 'autoactions'; @@ -374,11 +379,6 @@ function agenda_prepare_head() $head[$h][2] = 'extsites'; $h++; - $head[$h][0] = DOL_URL_ROOT."/admin/agenda_other.php"; - $head[$h][1] = $langs->trans("Other"); - $head[$h][2] = 'other'; - $h++; - complete_head_from_modules($conf,$langs,null,$head,$h,'agenda_admin'); $head[$h][0] = DOL_URL_ROOT."/admin/agenda_extrafields.php"; diff --git a/htdocs/core/lib/ajax.lib.php b/htdocs/core/lib/ajax.lib.php index f36dc59c43a..47363ac8d06 100644 --- a/htdocs/core/lib/ajax.lib.php +++ b/htdocs/core/lib/ajax.lib.php @@ -399,44 +399,52 @@ function ajax_constantonoff($code, $input=array(), $entity=null, $revertonoff=0) $entity = ((isset($entity) && is_numeric($entity) && $entity >= 0) ? $entity : $conf->entity); - $out= "\n".' - '."\n"; - // Del constant - $("#del_" + code).click(function() { - if (input.alert && input.alert.del) { - if (input.alert.del.yesButton) yesButton = input.alert.del.yesButton; - if (input.alert.del.noButton) noButton = input.alert.del.noButton; - confirmConstantAction("del", url, code, input, input.alert.del, entity, yesButton, noButton); - } else { - delConstant(url, code, input, entity); - } - }); - }); - '."\n"; - - $out.= ''; - $out.= ''.($revertonoff?img_picto($langs->trans("Enabled"),'switch_on'):img_picto($langs->trans("Disabled"),'switch_off')).''; - $out.= ''.($revertonoff?img_picto($langs->trans("Disabled"),'switch_off'):img_picto($langs->trans("Enabled"),'switch_on')).''; - $out.="\n"; + $out.= ''; + $out.= ''.($revertonoff?img_picto($langs->trans("Enabled"),'switch_on'):img_picto($langs->trans("Disabled"),'switch_off')).''; + $out.= ''.($revertonoff?img_picto($langs->trans("Disabled"),'switch_off'):img_picto($langs->trans("Enabled"),'switch_on')).''; + $out.="\n"; + } return $out; } diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 6782606b7c0..4bec9fed799 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1453,6 +1453,9 @@ 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_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 ##### ClickToDial ##### ClickToDialDesc=This module allows to add an icon after phone numbers. A click on this icon will call a server with a particular URL you define below. This can be used to call a call center system from Dolibarr that can call the phone number on a SIP system for example. ##### Point Of Sales (CashDesk) #####