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

This commit is contained in:
Ralf Becker 2014-02-13 12:50:29 +00:00
parent 241db52e18
commit 8d48058f22

View File

@ -16,13 +16,18 @@
* The widget is encapsulated, and only needs the record's ID, and a map of * The widget is encapsulated, and only needs the record's ID, and a map of
* fields:widgets for display * fields:widgets for display
*/ */
class etemplate_widget_historylog extends etemplate_widget class etemplate_widget_historylog extends etemplate_widget
{ {
/** /**
* Fill type options in self::$request->sel_options to be used on the client * 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 * @param string $cname
*/ */
public function beforeSendToClient($cname) public function beforeSendToClient($cname)
@ -43,17 +48,19 @@ class etemplate_widget_historylog extends etemplate_widget
if(method_exists($widget, 'beforeSendToClient')) 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 else
{ {
if (!is_array(self::$request->sel_options[$key])) self::$request->sel_options[$key] = array(); // need to use self::form_name($form_name, $key) as index into sel_options see comment in header
self::$request->sel_options[$key] += $type; $options =& self::get_array(self::$request->sel_options, self::form_name($form_name, $key), true);
if (!is_array($options)) $options = array();
$options += $type;
} }
} }
} }
} }
} }
?>