From 8d48058f2290e62a4546b66fba18adbae7595479 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Thu, 13 Feb 2014 12:50:29 +0000 Subject: [PATCH] historylog need to use $this->id as namespace for sel_options to NOT overwrite regular sel_options, fixes addressbook-selection in addressbook.edit contains all users instead of only ones user has rights for --- .../class.etemplate_widget_historylog.inc.php | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/etemplate/inc/class.etemplate_widget_historylog.inc.php b/etemplate/inc/class.etemplate_widget_historylog.inc.php index 3ae0ffa0b6..b39ae7a0ac 100644 --- a/etemplate/inc/class.etemplate_widget_historylog.inc.php +++ b/etemplate/inc/class.etemplate_widget_historylog.inc.php @@ -16,13 +16,18 @@ * The widget is encapsulated, and only needs the record's ID, and a map of * fields:widgets for display */ - class etemplate_widget_historylog extends etemplate_widget { /** * Fill type options in self::$request->sel_options to be used on the client * + * Historylog need to use $this->id as namespace, otherwise we overwrite + * sel_options of regular widgets with more general data for historylog! + * + * eg. owner in addressbook.edit contains only accounts user has rights to, + * while it uses select-account for owner in historylog (containing all users). + * * @param string $cname */ public function beforeSendToClient($cname) @@ -43,17 +48,19 @@ class etemplate_widget_historylog extends etemplate_widget if(method_exists($widget, 'beforeSendToClient')) { - $widget->beforeSendToClient($cname,array()); + // need to use $form_name as $cname see comment in header + $widget->beforeSendToClient($form_name, array()); } } else { - if (!is_array(self::$request->sel_options[$key])) self::$request->sel_options[$key] = array(); - self::$request->sel_options[$key] += $type; + // need to use self::form_name($form_name, $key) as index into sel_options see comment in header + $options =& self::get_array(self::$request->sel_options, self::form_name($form_name, $key), true); + if (!is_array($options)) $options = array(); + $options += $type; } - + } } } } -?>