From 37939e7cbd2a8be9d91c45a62d0f5a676dfa57ad Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 11 Apr 2017 02:17:47 +0200 Subject: [PATCH] NEW Add key __USERID__ and __ENTITYID__ as key for dynamic filters. --- htdocs/core/lib/functions.lib.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 1ca8c7758a8..ea348fb31d1 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -274,6 +274,8 @@ function GETPOST($paramname,$check='',$method=0,$filter=NULL,$options=NULL) if (! empty($check)) { + // Replace vars like __DAY__, __MONTH__, __YEAR__, __MYCOUNTRYID__, __USERID__, __ENTITYID__ + // TODO Add more var like __PREVIOUSDAY__, __PREVIOUSMONTH__, __PREVIOUSYEAR__ if (! is_array($out) && preg_match('/^__([a-z0-9]+)__$/i', $out, $reg)) { if ($reg[1] == 'DAY') @@ -296,6 +298,16 @@ function GETPOST($paramname,$check='',$method=0,$filter=NULL,$options=NULL) global $mysoc; $out = $mysoc->country_id; } + elseif ($reg[1] == 'USERID') + { + global $user; + $out = $user->id; + } + elseif ($reg[1] == 'ENTITYID') + { + global $conf; + $out = $conf->entity; + } } switch ($check)