From b7cf434ebd3e5870db32cfd90add74925cd8f2bc Mon Sep 17 00:00:00 2001 From: gauthier Date: Thu, 2 Nov 2017 14:58:33 +0100 Subject: [PATCH 1/5] FIX : Filter type on actioncomm with multiselect doesn't work --- htdocs/comm/action/index.php | 9 +++++++-- htdocs/comm/action/listactions.php | 9 +++++++-- htdocs/comm/action/peruser.php | 9 +++++++-- 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index bda7dd7a594..ea6c43b89c7 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -297,7 +297,11 @@ if ($status == 'done') $title=$langs->trans("DoneActions"); if ($status == 'todo') $title=$langs->trans("ToDoActions"); $param=''; -if ($actioncode || isset($_GET['actioncode']) || isset($_POST['actioncode'])) $param.="&actioncode=".$actioncode; +if ($actioncode || isset($_GET['actioncode']) || isset($_POST['actioncode'])) { + if(is_array($actioncode)) { + foreach($actioncode as $str_action) $param.="&actioncode[]=".$str_action; + } else $param.="&actioncode=".$actioncode; +} if ($resourceid > 0) $param.="&resourceid=".$resourceid; if ($status || isset($_GET['status']) || isset($_POST['status'])) $param.="&status=".$status; if ($filter) $param.="&filter=".$filter; @@ -482,7 +486,8 @@ if (! empty($actioncode)) elseif ($actioncode == 'AC_ALL_AUTO') $sql.= " AND ca.type = 'systemauto'"; else { - $sql.=" AND ca.code IN ('".implode("','", explode(',',$actioncode))."')"; + $TActionCode=(Array)$actioncode; + $sql.=" AND ca.code IN ('".implode("','", $TActionCode)."')"; } } } diff --git a/htdocs/comm/action/listactions.php b/htdocs/comm/action/listactions.php index c77c4279439..d247e78c188 100644 --- a/htdocs/comm/action/listactions.php +++ b/htdocs/comm/action/listactions.php @@ -169,7 +169,11 @@ $listofextcals=array(); $param=''; if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; -if ($actioncode != '') $param.="&actioncode=".$actioncode; +if ($actioncode != '') { + if(is_array($actioncode)) { + foreach($actioncode as $str_action) $param.="&actioncode[]=".$str_action; + } else $param.="&actioncode=".$actioncode; +} if ($resourceid > 0) $param.="&resourceid=".$resourceid; if ($status != '' && $status > -1) $param.="&status=".$status; if ($filter) $param.="&filter=".$filter; @@ -227,7 +231,8 @@ if (! empty($actioncode)) elseif ($actioncode == 'AC_ALL_AUTO') $sql.= " AND c.type = 'systemauto'"; else { - $sql.=" AND c.code IN ('".implode("','", explode(',',$actioncode))."')"; + $TActionCode=(Array)$actioncode; + $sql.=" AND c.code IN ('".implode("','", $TActionCode)."')"; } } } diff --git a/htdocs/comm/action/peruser.php b/htdocs/comm/action/peruser.php index 792d4f9760d..3d551b7779b 100644 --- a/htdocs/comm/action/peruser.php +++ b/htdocs/comm/action/peruser.php @@ -203,7 +203,11 @@ if ($status == 'done') $title=$langs->trans("DoneActions"); if ($status == 'todo') $title=$langs->trans("ToDoActions"); $param=''; -if ($actioncode || isset($_GET['actioncode']) || isset($_POST['actioncode'])) $param.="&actioncode=".$actioncode; +if ($actioncode || isset($_GET['actioncode']) || isset($_POST['actioncode'])) { + if(is_array($actioncode)) { + foreach($actioncode as $str_action) $param.="&actioncode[]=".$str_action; + } else $param.="&actioncode=".$actioncode; +} if ($resourceid > 0) $param.="&resourceid=".$resourceid; if ($status || isset($_GET['status']) || isset($_POST['status'])) $param.="&status=".$status; if ($filter) $param.="&filter=".$filter; @@ -394,7 +398,8 @@ if (! empty($actioncode)) elseif ($actioncode == 'AC_ALL_AUTO') $sql.= " AND ca.type = 'systemauto'"; else { - $sql.=" AND ca.code IN ('".implode("','", explode(',',$actioncode))."')"; + $TActionCode=(Array)$actioncode; + $sql.=" AND ca.code IN ('".implode("','", $TActionCode)."')"; } } } From 323a0d7d0d65d6afc5ae996bd8e24f0e5f867cb2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 2 Nov 2017 15:48:24 +0100 Subject: [PATCH 2/5] Update index.php --- htdocs/comm/action/index.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index ea6c43b89c7..87f0e2e6ccb 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -486,8 +486,14 @@ if (! empty($actioncode)) elseif ($actioncode == 'AC_ALL_AUTO') $sql.= " AND ca.type = 'systemauto'"; else { - $TActionCode=(Array)$actioncode; - $sql.=" AND ca.code IN ('".implode("','", $TActionCode)."')"; + if (is_array($actioncode)) + { + $sql.=" AND ca.code IN ('".implode("','", $TActionCode)."')"; + } + else + { + $sql.=" AND ca.code IN ('".implode("','", explode(',', $actioncode))."')"; + } } } } From 63a363080e9966415934ba8e13e93acd868f0822 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 2 Nov 2017 15:48:56 +0100 Subject: [PATCH 3/5] Update index.php --- htdocs/comm/action/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index 87f0e2e6ccb..e2bb57c3ce4 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -488,7 +488,7 @@ if (! empty($actioncode)) { if (is_array($actioncode)) { - $sql.=" AND ca.code IN ('".implode("','", $TActionCode)."')"; + $sql.=" AND ca.code IN ('".implode("','", $actioncode)."')"; } else { From ec3a07cd52dbd921f86c733b5412a561357a2be5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 2 Nov 2017 15:50:55 +0100 Subject: [PATCH 4/5] Try to restore compatibility when actioncode=CODE1,CODE2,... --- htdocs/comm/action/listactions.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/action/listactions.php b/htdocs/comm/action/listactions.php index d247e78c188..b3d92fc8a40 100644 --- a/htdocs/comm/action/listactions.php +++ b/htdocs/comm/action/listactions.php @@ -231,8 +231,14 @@ if (! empty($actioncode)) elseif ($actioncode == 'AC_ALL_AUTO') $sql.= " AND c.type = 'systemauto'"; else { - $TActionCode=(Array)$actioncode; - $sql.=" AND c.code IN ('".implode("','", $TActionCode)."')"; + if (is_array($actioncode)) + { + $sql.=" AND ca.code IN ('".implode("','", $actioncode)."')"; + } + else + { + $sql.=" AND ca.code IN ('".implode("','", explode(',', $actioncode))."')"; + } } } } From 310bf4bde4d96bb0a11d2403dbad217033cc0210 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 2 Nov 2017 15:51:35 +0100 Subject: [PATCH 5/5] Update peruser.php --- htdocs/comm/action/peruser.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/action/peruser.php b/htdocs/comm/action/peruser.php index 3d551b7779b..05eba093cfd 100644 --- a/htdocs/comm/action/peruser.php +++ b/htdocs/comm/action/peruser.php @@ -398,8 +398,14 @@ if (! empty($actioncode)) elseif ($actioncode == 'AC_ALL_AUTO') $sql.= " AND ca.type = 'systemauto'"; else { - $TActionCode=(Array)$actioncode; - $sql.=" AND ca.code IN ('".implode("','", $TActionCode)."')"; + if (is_array($actioncode)) + { + $sql.=" AND ca.code IN ('".implode("','", $actioncode)."')"; + } + else + { + $sql.=" AND ca.code IN ('".implode("','", explode(',', $actioncode))."')"; + } } } }