Clean code. Using 2 different key for a param is not more allowed.
This commit is contained in:
parent
806157ae40
commit
d7e10085b8
@ -337,7 +337,7 @@ if ($action == 'add')
|
||||
unset($_SESSION['assignedtouser']);
|
||||
|
||||
$moreparam='';
|
||||
if ($user->id != $object->userownerid) $moreparam="usertodo=-1"; // We force to remove filter so created record is visible when going back to per user view.
|
||||
if ($user->id != $object->userownerid) $moreparam="filtert=-1"; // We force to remove filter so created record is visible when going back to per user view.
|
||||
|
||||
$db->commit();
|
||||
if (! empty($backtopage))
|
||||
|
||||
@ -43,8 +43,8 @@ if (! isset($conf->global->AGENDA_MAX_EVENTS_DAY_VIEW)) $conf->global->AGENDA_MA
|
||||
if (empty($conf->global->AGENDA_EXT_NB)) $conf->global->AGENDA_EXT_NB=5;
|
||||
$MAXAGENDA=$conf->global->AGENDA_EXT_NB;
|
||||
|
||||
$filter=GETPOST("filter",'',3);
|
||||
$filtert = GETPOST("usertodo","int",3)?GETPOST("usertodo","int",3):GETPOST("filtert","int",3);
|
||||
$filter = GETPOST("filter",'',3);
|
||||
$filtert = GETPOST("filtert","int",3);
|
||||
$usergroup = GETPOST("usergroup","int",3);
|
||||
$showbirthday = empty($conf->use_javascript_ajax)?GETPOST("showbirthday","int"):1;
|
||||
|
||||
@ -1155,21 +1155,6 @@ else // View by day
|
||||
echo '</table>';
|
||||
}
|
||||
|
||||
|
||||
/* TODO Export
|
||||
print '
|
||||
<a href="" id="actionagenda_ical_link"><img src="'.DOL_URL_ROOT.'/theme/common/ical.gif" border="0"/></a>
|
||||
<a href="" id="actionagenda_vcal_link"><img src="'.DOL_URL_ROOT.'/theme/common/vcal.gif" border="0"/></a>
|
||||
<a href="" id="actionagenda_rss_link"><img src="'.DOL_URL_ROOT.'/theme/common/rss.gif" border="0"/></a>
|
||||
|
||||
<script>
|
||||
$("#actionagenda_rss_link").attr("href","/public/agenda/agendaexport.php?format=rss&type=ActionAgenda&exportkey=dolibarr&token="+getToken()+"&status="+getStatus()+"&userasked="+getUserasked()+"&usertodo="+getUsertodo()+"&userdone="+getUserdone()+"&year="+getYear()+"&month="+getMonth()+"&day="+getDay()+"&showbirthday="+getShowbirthday()+"&action="+getAction()+"&projectid="+getProjectid()+"");
|
||||
$("#actionagenda_ical_link").attr("href","/public/agenda/agendaexport.php?format=ical&type=ActionAgenda&exportkey=dolibarr&token="+getToken()+"&status="+getStatus()+"&userasked="+getUserasked()+"&usertodo="+getUsertodo()+"&userdone="+getUserdone()+"&year="+getYear()+"&month="+getMonth()+"&day="+getDay()+"&showbirthday="+getShowbirthday()+"&action="+getAction()+"&projectid="+getProjectid()+"");
|
||||
$("#actionagenda_vcal_link").attr("href","/public/agenda/agendaexport.php?format=vcal&type=ActionAgenda&exportkey=dolibarr&token="+getToken()+"&status="+getStatus()+"&userasked="+getUserasked()+"&usertodo="+getUsertodo()+"&userdone="+getUserdone()+"&year="+getYear()+"&month="+getMonth()+"&day="+getDay()+"&showbirthday="+getShowbirthday()+"&action="+getAction()+"&projectid="+getProjectid()+"");
|
||||
</script>
|
||||
';
|
||||
*/
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
|
||||
@ -64,8 +64,8 @@ $dateend=dol_mktime(0, 0, 0, GETPOST('dateendmonth'), GETPOST('dateendday'), GET
|
||||
if ($status == '' && ! isset($_GET['status']) && ! isset($_POST['status'])) $status=(empty($conf->global->AGENDA_DEFAULT_FILTER_STATUS)?'':$conf->global->AGENDA_DEFAULT_FILTER_STATUS);
|
||||
if (empty($action) && ! isset($_GET['action']) && ! isset($_POST['action'])) $action=(empty($conf->global->AGENDA_DEFAULT_VIEW)?'show_month':$conf->global->AGENDA_DEFAULT_VIEW);
|
||||
|
||||
$filter=GETPOST("filter",'',3);
|
||||
$filtert = GETPOST("usertodo","int",3)?GETPOST("usertodo","int",3):GETPOST("filtert","int",3);
|
||||
$filter = GETPOST("filter",'',3);
|
||||
$filtert = GETPOST("filtert","int",3);
|
||||
$usergroup = GETPOST("usergroup","int",3);
|
||||
$showbirthday = empty($conf->use_javascript_ajax)?GETPOST("showbirthday","int"):1;
|
||||
|
||||
|
||||
@ -38,8 +38,8 @@ if (! empty($conf->projet->enabled)) require_once DOL_DOCUMENT_ROOT.'/core/class
|
||||
|
||||
if (! isset($conf->global->AGENDA_MAX_EVENTS_DAY_VIEW)) $conf->global->AGENDA_MAX_EVENTS_DAY_VIEW=3;
|
||||
|
||||
$filter=GETPOST("filter",'',3);
|
||||
$filtert = GETPOST("usertodo","int",3)?GETPOST("usertodo","int",3):GETPOST("filtert","int",3);
|
||||
$filter = GETPOST("filter",'',3);
|
||||
$filtert = GETPOST("filtert","int",3);
|
||||
$usergroup = GETPOST("usergroup","int",3);
|
||||
//if (! ($usergroup > 0) && ! ($filtert > 0)) $filtert = $user->id;
|
||||
//$showbirthday = empty($conf->use_javascript_ajax)?GETPOST("showbirthday","int"):1;
|
||||
@ -250,7 +250,7 @@ $picto='calendarweek';
|
||||
$nav.=' <form name="dateselect" action="'.$_SERVER["PHP_SELF"].'?action=show_peruser'.$param.'">';
|
||||
$nav.='<input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '">';
|
||||
$nav.='<input type="hidden" name="action" value="' . $action . '">';
|
||||
$nav.='<input type="hidden" name="usertodo" value="' . $filtert . '">';
|
||||
$nav.='<input type="hidden" name="filtert" value="' . $filtert . '">';
|
||||
$nav.='<input type="hidden" name="usergroup" value="' . $usergroup . '">';
|
||||
$nav.='<input type="hidden" name="actioncode" value="' . $actioncode . '">';
|
||||
$nav.='<input type="hidden" name="resourceid" value="' . $resourceid . '">';
|
||||
@ -714,7 +714,7 @@ jQuery(document).ready(function() {
|
||||
else if (ids.indexOf(",") > -1) /* There is several events */
|
||||
{
|
||||
/* alert(\'several events\'); */
|
||||
url = "'.DOL_URL_ROOT.'/comm/action/listactions.php?usertodo="+userid+"&dateselectyear="+year+"&dateselectmonth="+month+"&dateselectday="+day;
|
||||
url = "'.DOL_URL_ROOT.'/comm/action/listactions.php?filtert="+userid+"&dateselectyear="+year+"&dateselectmonth="+month+"&dateselectday="+day;
|
||||
window.location.href = url;
|
||||
}
|
||||
else /* One event */
|
||||
|
||||
@ -38,8 +38,8 @@ if (! empty($conf->projet->enabled)) require_once DOL_DOCUMENT_ROOT.'/core/class
|
||||
|
||||
if (! isset($conf->global->AGENDA_MAX_EVENTS_DAY_VIEW)) $conf->global->AGENDA_MAX_EVENTS_DAY_VIEW=3;
|
||||
|
||||
$filter=GETPOST("filter",'',3);
|
||||
$filtert = GETPOST("usertodo","int",3)?GETPOST("usertodo","int",3):GETPOST("filtert","int",3);
|
||||
$filter = GETPOST("filter",'',3);
|
||||
$filtert = GETPOST("filtert","int",3);
|
||||
$usergroup = GETPOST("usergroup","int",3);
|
||||
//if (! ($usergroup > 0) && ! ($filtert > 0)) $filtert = $user->id;
|
||||
//$showbirthday = empty($conf->use_javascript_ajax)?GETPOST("showbirthday","int"):1;
|
||||
@ -252,7 +252,7 @@ $picto='calendarweek';
|
||||
$nav.=' <form name="dateselect" action="'.$_SERVER["PHP_SELF"].'?action=show_peruser'.$param.'">';
|
||||
$nav.='<input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '">';
|
||||
$nav.='<input type="hidden" name="action" value="' . $action . '">';
|
||||
$nav.='<input type="hidden" name="usertodo" value="' . $filtert . '">';
|
||||
$nav.='<input type="hidden" name="filtert" value="' . $filtert . '">';
|
||||
$nav.='<input type="hidden" name="usergroup" value="' . $usergroup . '">';
|
||||
$nav.='<input type="hidden" name="actioncode" value="' . $actioncode . '">';
|
||||
$nav.='<input type="hidden" name="resourceid" value="' . $resourceid . '">';
|
||||
@ -663,7 +663,6 @@ else
|
||||
if ($usergroup > 0) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."usergroup_user as ug ON u.rowid = ug.fk_user";
|
||||
$sql.= " WHERE u.statut = 1 AND u.entity IN (".getEntity('user',1).")";
|
||||
if ($usergroup > 0) $sql.= " AND ug.fk_usergroup = ".$usergroup;
|
||||
//if (GETPOST("usertodo","int",3) > 0) $sql.=" AND u.rowid = ".GETPOST("usertodo","int",3);
|
||||
//print $sql;
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
@ -816,7 +815,7 @@ jQuery(document).ready(function() {
|
||||
else if (ids.indexOf(",") > -1) /* There is several events */
|
||||
{
|
||||
/* alert(\'several events\'); */
|
||||
url = "'.DOL_URL_ROOT.'/comm/action/listactions.php?usertodo="+userid+"&dateselectyear="+year+"&dateselectmonth="+month+"&dateselectday="+day;
|
||||
url = "'.DOL_URL_ROOT.'/comm/action/listactions.php?filtert="+userid+"&dateselectyear="+year+"&dateselectmonth="+month+"&dateselectday="+day;
|
||||
window.location.href = url;
|
||||
}
|
||||
else /* One event */
|
||||
|
||||
@ -76,7 +76,7 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
|
||||
print '<td class="nowrap" style="padding-bottom: 2px; padding-right: 4px;">';
|
||||
print $langs->trans("ActionsToDoBy").' ';
|
||||
print '</td><td style="padding-bottom: 2px; padding-right: 4px;">';
|
||||
print $form->select_dolusers($filtert, 'usertodo', 1, '', ! $canedit, '', '', 0, 0, 0, '', 0, '', 'maxwidth300');
|
||||
print $form->select_dolusers($filtert, 'filtert', 1, '', ! $canedit, '', '', 0, 0, 0, '', 0, '', 'maxwidth300');
|
||||
if (empty($conf->dol_optimize_smallscreen)) print ' '.$langs->trans("or") . ' '.$langs->trans("ToUserOfGroup").' ';
|
||||
print $form->select_dolgroups($usergroupid, 'usergroup', 1, '', ! $canedit);
|
||||
print '</td></tr>';
|
||||
|
||||
@ -248,70 +248,72 @@ function dol_shutdown()
|
||||
*/
|
||||
function GETPOST($paramname, $check='', $method=0, $filter=NULL, $options=NULL)
|
||||
{
|
||||
if (empty($method))
|
||||
{
|
||||
$out = isset($_GET[$paramname])?$_GET[$paramname]:(isset($_POST[$paramname])?$_POST[$paramname]:'');
|
||||
|
||||
// Management of default values
|
||||
if (! isset($_GET['sortfield'])) // If we did a click on a field to sort, we do no apply default values
|
||||
{
|
||||
if (! empty($_GET['action']) && $_GET['action'] == 'create' && ! empty($paramname) && ! isset($_GET[$paramname]) && ! isset($_POST[$paramname]))
|
||||
{
|
||||
$relativepathstring = $_SERVER["PHP_SELF"];
|
||||
if (constant('DOL_URL_ROOT')) $relativepathstring = preg_replace('/^'.preg_quote(constant('DOL_URL_ROOT'),'/').'/', '', $relativepathstring);
|
||||
$relativepathstring = preg_replace('/^custom\//', '', $relativepathstring);
|
||||
$relativepathstring = preg_replace('/^\//', '', $relativepathstring);
|
||||
global $user;
|
||||
if (! empty($user->default_values)) // $user->default_values defined from menu default values, and values loaded not at first
|
||||
{
|
||||
//var_dump($user->default_values[$relativepathstring]['createform']);
|
||||
if (isset($user->default_values[$relativepathstring]['createform'][$paramname])) $out = $user->default_values[$relativepathstring]['createform'][$paramname];
|
||||
}
|
||||
}
|
||||
// Management of default search_filters and sort order
|
||||
elseif (preg_match('/list.php$/', $_SERVER["PHP_SELF"]) && ! empty($paramname) && ! isset($_GET[$paramname]) && ! isset($_POST[$paramname]))
|
||||
{
|
||||
$relativepathstring = $_SERVER["PHP_SELF"];
|
||||
if (constant('DOL_URL_ROOT')) $relativepathstring = preg_replace('/^'.preg_quote(constant('DOL_URL_ROOT'),'/').'/', '', $relativepathstring);
|
||||
$relativepathstring = preg_replace('/^custom\//', '', $relativepathstring);
|
||||
$relativepathstring = preg_replace('/^\//', '', $relativepathstring);
|
||||
global $user;
|
||||
if (! empty($user->default_values)) // $user->default_values defined from menu default values, and values loaded not at first
|
||||
{
|
||||
//var_dump($user->default_values[$relativepathstring]);
|
||||
if ($paramname == 'sortfield')
|
||||
{
|
||||
if (isset($user->default_values[$relativepathstring]['sortorder']))
|
||||
{
|
||||
foreach($user->default_values[$relativepathstring]['sortorder'] as $key => $val)
|
||||
{
|
||||
if ($out) $out.=', ';
|
||||
$out.=$key;
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif ($paramname == 'sortorder')
|
||||
{
|
||||
if (isset($user->default_values[$relativepathstring]['sortorder']))
|
||||
{
|
||||
foreach($user->default_values[$relativepathstring]['sortorder'] as $key => $val)
|
||||
{
|
||||
if ($out) $out.=', ';
|
||||
$out.=$val;
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif (isset($user->default_values[$relativepathstring]['filters'][$paramname])) $out = $user->default_values[$relativepathstring]['filters'][$paramname];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (empty($method)) $out = isset($_GET[$paramname])?$_GET[$paramname]:(isset($_POST[$paramname])?$_POST[$paramname]:'');
|
||||
elseif ($method==1) $out = isset($_GET[$paramname])?$_GET[$paramname]:'';
|
||||
elseif ($method==2) $out = isset($_POST[$paramname])?$_POST[$paramname]:'';
|
||||
elseif ($method==3) $out = isset($_POST[$paramname])?$_POST[$paramname]:(isset($_GET[$paramname])?$_GET[$paramname]:'');
|
||||
elseif ($method==4) $out = isset($_POST[$paramname])?$_POST[$paramname]:(isset($_GET[$paramname])?$_GET[$paramname]:(isset($_COOKIE[$paramname])?$_COOKIE[$paramname]:''));
|
||||
else return 'BadThirdParameterForGETPOST';
|
||||
|
||||
|
||||
if (empty($method) || $method == 3 || $method == 4)
|
||||
{
|
||||
// Management of default values
|
||||
if (! isset($_GET['sortfield'])) // If we did a click on a field to sort, we do no apply default values
|
||||
{
|
||||
if (! empty($_GET['action']) && $_GET['action'] == 'create' && ! empty($paramname) && ! isset($_GET[$paramname]) && ! isset($_POST[$paramname]))
|
||||
{
|
||||
$relativepathstring = $_SERVER["PHP_SELF"];
|
||||
if (constant('DOL_URL_ROOT')) $relativepathstring = preg_replace('/^'.preg_quote(constant('DOL_URL_ROOT'),'/').'/', '', $relativepathstring);
|
||||
$relativepathstring = preg_replace('/^custom\//', '', $relativepathstring);
|
||||
$relativepathstring = preg_replace('/^\//', '', $relativepathstring);
|
||||
global $user;
|
||||
if (! empty($user->default_values)) // $user->default_values defined from menu default values, and values loaded not at first
|
||||
{
|
||||
//var_dump($user->default_values[$relativepathstring]['createform']);
|
||||
if (isset($user->default_values[$relativepathstring]['createform'][$paramname])) $out = $user->default_values[$relativepathstring]['createform'][$paramname];
|
||||
}
|
||||
}
|
||||
// Management of default search_filters and sort order
|
||||
//elseif (preg_match('/list.php$/', $_SERVER["PHP_SELF"]) && ! empty($paramname) && ! isset($_GET[$paramname]) && ! isset($_POST[$paramname]))
|
||||
elseif (! empty($paramname) && ! isset($_GET[$paramname]) && ! isset($_POST[$paramname]))
|
||||
{
|
||||
$relativepathstring = $_SERVER["PHP_SELF"];
|
||||
if (constant('DOL_URL_ROOT')) $relativepathstring = preg_replace('/^'.preg_quote(constant('DOL_URL_ROOT'),'/').'/', '', $relativepathstring);
|
||||
$relativepathstring = preg_replace('/^custom\//', '', $relativepathstring);
|
||||
$relativepathstring = preg_replace('/^\//', '', $relativepathstring);
|
||||
global $user;
|
||||
if (! empty($user->default_values)) // $user->default_values defined from menu default values
|
||||
{
|
||||
//var_dump($user->default_values[$relativepathstring]);
|
||||
if ($paramname == 'sortfield')
|
||||
{
|
||||
if (isset($user->default_values[$relativepathstring]['sortorder']))
|
||||
{
|
||||
foreach($user->default_values[$relativepathstring]['sortorder'] as $key => $val)
|
||||
{
|
||||
if ($out) $out.=', ';
|
||||
$out.=dol_string_nospecial($key, '');
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif ($paramname == 'sortorder')
|
||||
{
|
||||
if (isset($user->default_values[$relativepathstring]['sortorder']))
|
||||
{
|
||||
foreach($user->default_values[$relativepathstring]['sortorder'] as $key => $val)
|
||||
{
|
||||
if ($out) $out.=', ';
|
||||
$out.=dol_string_nospecial($val, '');
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif (isset($user->default_values[$relativepathstring]['filters'][$paramname]))
|
||||
$out = dol_string_nospecial($user->default_values[$relativepathstring]['filters'][$paramname], '');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (! empty($check))
|
||||
{
|
||||
// Replace vars like __DAY__, __MONTH__, __YEAR__, __MYCOUNTRYID__, __USERID__, __ENTITYID__
|
||||
|
||||
@ -107,8 +107,7 @@ if ($action=='create')
|
||||
'projectid'=>'',
|
||||
'note'=>'This is note',
|
||||
'contactid'=>'',
|
||||
'usertodo'=>'1',
|
||||
'userdone'=>'1',
|
||||
'userownerod'=>'1',
|
||||
'label'=>'Ceci est les titre de l\'envenement',
|
||||
'percentage'=>'100',
|
||||
'location'=>'Location1'
|
||||
|
||||
@ -101,8 +101,7 @@ $actioncomm_fields= array(
|
||||
'percentage' => array('name'=>'percentage','type'=>'xsd:string'),
|
||||
'author' => array('name'=>'author','type'=>'xsd:string'),
|
||||
'usermod' => array('name'=>'usermod','type'=>'xsd:string'),
|
||||
'usertodo' => array('name'=>'usertodo','type'=>'xsd:string'),
|
||||
'userdone' => array('name'=>'userdone','type'=>'xsd:string'),
|
||||
'userownerid' => array('name'=>'userownerid','type'=>'xsd:string'),
|
||||
'priority' => array('name'=>'priority','type'=>'xsd:string'),
|
||||
'fulldayevent' => array('name'=>'fulldayevent','type'=>'xsd:string'),
|
||||
'location' => array('name'=>'location','type'=>'xsd:string'),
|
||||
@ -291,8 +290,7 @@ function getActionComm($authentication,$id)
|
||||
'percentage'=> $actioncomm->percentage,
|
||||
'author'=> $actioncomm->authorid,
|
||||
'usermod'=> $actioncomm->usermodid,
|
||||
'usertodo'=> $actioncomm->userownerid,
|
||||
'userdone'=> $actioncomm->userdoneid,
|
||||
'userownerid'=> $actioncomm->userownerid,
|
||||
'priority'=> $actioncomm->priority,
|
||||
'fulldayevent'=> $actioncomm->fulldayevent,
|
||||
'location'=> $actioncomm->location,
|
||||
@ -437,8 +435,7 @@ function createActionComm($authentication,$actioncomm)
|
||||
$newobject->fk_project=$actioncomm['projectid'];
|
||||
$newobject->note=$actioncomm['note'];
|
||||
$newobject->contactid=$actioncomm['contactid'];
|
||||
$newobject->userownerid=$actioncomm['usertodo'];
|
||||
$newobject->userdoneid=$actioncomm['userdone'];
|
||||
$newobject->userownerid=$actioncomm['userownerid'];
|
||||
$newobject->label=$actioncomm['label'];
|
||||
$newobject->percentage=$actioncomm['percentage'];
|
||||
$newobject->priority=$actioncomm['priority'];
|
||||
@ -532,8 +529,7 @@ function updateActionComm($authentication,$actioncomm)
|
||||
$object->contactid=$actioncomm['contactid'];
|
||||
$object->fk_project=$actioncomm['projectid'];
|
||||
$object->note=$actioncomm['note'];
|
||||
$object->userownerid=$actioncomm['usertodo'];
|
||||
$object->userdoneid=$actioncomm['userdone'];
|
||||
$object->userownerid=$actioncomm['userownerid'];
|
||||
$object->label=$actioncomm['label'];
|
||||
$object->percentage=$actioncomm['percentage'];
|
||||
$object->priority=$actioncomm['priority'];
|
||||
|
||||
Loading…
Reference in New Issue
Block a user