Filter on agenda event are autoselected on "manual event".

This commit is contained in:
Laurent Destailleur 2013-04-21 12:26:44 +02:00
parent 01ec3d79ca
commit ab2709f684
6 changed files with 15 additions and 10 deletions

View File

@ -132,7 +132,7 @@ class CActionComm
$qualified=1; $qualified=1;
// $obj->type can be system, systemauto, module, moduleauto, xxx, xxxauto // $obj->type can be system, systemauto, module, moduleauto, xxx, xxxauto
if ($qualified && $onlyautoornot && preg_match('/^system/',$obj->type) && ! preg_match('/^AC_OTH/',$obj->code)) $qualified=0; // We discard detailed system events. We keep only the 2 generic lines (AC_OTH and AC_OTHER) if ($qualified && $onlyautoornot && preg_match('/^system/',$obj->type) && ! preg_match('/^AC_OTH/',$obj->code)) $qualified=0; // We discard detailed system events. We keep only the 2 generic lines (AC_OTH and AC_OTH_AUTO)
if ($qualified && $obj->module) if ($qualified && $obj->module)
{ {

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2003 Eric Seigne <erics@rycks.com> * Copyright (C) 2003 Eric Seigne <erics@rycks.com>
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
* *
@ -72,11 +72,11 @@ $year=GETPOST("year","int")?GETPOST("year","int"):date("Y");
$month=GETPOST("month","int")?GETPOST("month","int"):date("m"); $month=GETPOST("month","int")?GETPOST("month","int"):date("m");
$week=GETPOST("week","int")?GETPOST("week","int"):date("W"); $week=GETPOST("week","int")?GETPOST("week","int"):date("W");
$day=GETPOST("day","int")?GETPOST("day","int"):0; $day=GETPOST("day","int")?GETPOST("day","int"):0;
$actioncode=GETPOST("actioncode","alpha",3);
$pid=GETPOST("projectid","int",3); $pid=GETPOST("projectid","int",3);
$status=GETPOST("status"); $status=GETPOST("status");
$type=GETPOST("type"); $type=GETPOST("type");
$maxprint=(isset($_GET["maxprint"])?GETPOST("maxprint"):$conf->global->AGENDA_MAX_EVENTS_DAY_VIEW); $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"?'':(empty($conf->global->AGENDA_USE_EVENT_TYPE)?'AC_OTH':''));
if (GETPOST('viewcal')) { if (GETPOST('viewcal')) {
$action='show_month'; $day=''; $action='show_month'; $day='';
@ -271,7 +271,7 @@ $param.='&year='.$year.'&month='.$month.($day?'&day='.$day:'');
$head = calendars_prepare_head(''); $head = calendars_prepare_head('');
dol_fiche_head($head, 'card', $langs->trans('Events'), 0, $picto); dol_fiche_head($head, 'card', $langs->trans('Events'), 0, $picto);
print_actions_filter($form,$canedit,$status,$year,$month,$day,$showbirthday,$filtera,$filtert,$filterd,$pid,$socid,$listofextcals); print_actions_filter($form,$canedit,$status,$year,$month,$day,$showbirthday,$filtera,$filtert,$filterd,$pid,$socid,$listofextcals,$actioncode);
dol_fiche_end(); dol_fiche_end();
$link=''; $link='';

View File

@ -209,10 +209,10 @@ class FormActions
/** /**
* Output list of type of event * Output list of type of event
* *
* @param string $selected Type pre-selectionne * @param string $selected Type pre-selected (can be 'manual', 'auto' or 'AC_xxx'
* @param string $htmlname Nom champ formulaire * @param string $htmlname Nom champ formulaire
* @param string $excludetype Type to exclude * @param string $excludetype Type to exclude
* @param string $onlyautoornot Group list by auto events or not * @param string $onlyautoornot Group list by auto events or not: We keep only the 2 generic lines (AC_OTH and AC_OTH_AUTO)
* @return void * @return void
*/ */
function select_type_actions($selected='',$htmlname='actioncode',$excludetype='',$onlyautoornot=0) function select_type_actions($selected='',$htmlname='actioncode',$excludetype='',$onlyautoornot=0)
@ -224,11 +224,14 @@ class FormActions
$caction=new CActionComm($this->db); $caction=new CActionComm($this->db);
$form=new Form($this->db); $form=new Form($this->db);
// Suggest a list with manual event or all auto events // Suggest a list with manual events or all auto events
$arraylist=$caction->liste_array(1, 'code', $excludetype, $onlyautoornot); $arraylist=$caction->liste_array(1, 'code', $excludetype, $onlyautoornot);
array_unshift($arraylist,'&nbsp;'); // Add empty line at start array_unshift($arraylist,'&nbsp;'); // Add empty line at start
//asort($arraylist); //asort($arraylist);
if ($selected == 'manual') $selected='AC_OTH';
if ($selected == 'auto') $selected='AC_OTH_AUTO';
print $form->selectarray($htmlname, $arraylist, $selected); print $form->selectarray($htmlname, $arraylist, $selected);
if ($user->admin && empty($onlyautoornot)) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1); if ($user->admin && empty($onlyautoornot)) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1);
} }

View File

@ -40,9 +40,10 @@
* @param int $pid Product id * @param int $pid Product id
* @param int $socid Third party id * @param int $socid Third party id
* @param array $showextcals Array with list of external calendars, or -1 to show no legend * @param array $showextcals Array with list of external calendars, or -1 to show no legend
* @param string $actioncode Preselected value of actioncode for filter on type
* @return void * @return void
*/ */
function print_actions_filter($form,$canedit,$status,$year,$month,$day,$showbirthday,$filtera,$filtert,$filterd,$pid,$socid,$showextcals=array()) function print_actions_filter($form,$canedit,$status,$year,$month,$day,$showbirthday,$filtera,$filtert,$filterd,$pid,$socid,$showextcals=array(),$actioncode='')
{ {
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;
@ -94,8 +95,7 @@ function print_actions_filter($form,$canedit,$status,$year,$month,$day,$showbirt
print $langs->trans("Type"); print $langs->trans("Type");
print ' &nbsp;</td><td nowrap="nowrap">'; print ' &nbsp;</td><td nowrap="nowrap">';
// print $formactions->select_type_actions(GETPOST('actioncode'), "actioncode"); print $formactions->select_type_actions($actioncode, "actioncode", '', (empty($conf->global->AGENDA_USE_EVENT_TYPE)?1:0));
print $formactions->select_type_actions(GETPOST('actioncode')?GETPOST('actioncode'):'manual', "actioncode", '', (empty($conf->global->AGENDA_USE_EVENT_TYPE)?1:0));
print '</td></tr>'; print '</td></tr>';
} }

View File

@ -67,6 +67,7 @@ AgendaUrlOptions4=<b>logint=%s</b> to restrict output to actions assigned to use
AgendaUrlOptions5=<b>logind=%s</b> to restrict output to actions done by user <b>%s</b>. AgendaUrlOptions5=<b>logind=%s</b> to restrict output to actions done by user <b>%s</b>.
AgendaShowBirthdayEvents=Show birthday's contacts AgendaShowBirthdayEvents=Show birthday's contacts
AgendaHideBirthdayEvents=Hide birthday's contacts AgendaHideBirthdayEvents=Hide birthday's contacts
Busy=Busy
# External Sites ical # External Sites ical
ExportCal=Export calendar ExportCal=Export calendar

View File

@ -67,6 +67,7 @@ AgendaUrlOptions4=<b>logint=%s</b> pour limiter l'export aux actions affectées
AgendaUrlOptions5=<b>logind=%s</b> pour limiter l'export aux actions réalisées par l'utilisateur <b>%s</b>. AgendaUrlOptions5=<b>logind=%s</b> pour limiter l'export aux actions réalisées par l'utilisateur <b>%s</b>.
AgendaShowBirthdayEvents=Afficher anniversaires contacts AgendaShowBirthdayEvents=Afficher anniversaires contacts
AgendaHideBirthdayEvents=Cacher anniversaires contacts AgendaHideBirthdayEvents=Cacher anniversaires contacts
Busy=Occupé
# External Sites ical # External Sites ical
ExportCal=Export calendrier ExportCal=Export calendrier