From de65d91dc72fcd876b2497ea3af95ce8d18c0977 Mon Sep 17 00:00:00 2001 From: Hadi Nategh Date: Fri, 6 Oct 2017 16:27:37 +0200 Subject: [PATCH] Rmove fields for none private cutomfields when name refers to a single custom field --- api/src/Etemplate/Widget/Customfields.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/api/src/Etemplate/Widget/Customfields.php b/api/src/Etemplate/Widget/Customfields.php index 3aa65f9574..e551e52eb3 100644 --- a/api/src/Etemplate/Widget/Customfields.php +++ b/api/src/Etemplate/Widget/Customfields.php @@ -170,6 +170,14 @@ class Customfields extends Transformer { unset($fields[$key]); } + + // Rmove fields for none private cutomfields when name refers to a single custom field + $matches = null; + if (($pos=strpos($form_name,self::$prefix)) !== false && + preg_match($preg = '/'.self::$prefix.'([^\]]+)/',$form_name,$matches) && !isset($fields[$name=$matches[1]])) + { + unset($fields[$key]); + } } // check if name refers to a single custom field --> show only that $matches = null;