From af04c9b2f6d9092025e92ff260a648d2b67b27df Mon Sep 17 00:00:00 2001
From: Yusei Tahara <yusei@nexedi.com>
Date: Wed, 8 Aug 2007 12:54:19 +0000
Subject: [PATCH] Fixed a proxy field problem.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@15559 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../erp5_core/Base_callDialogMethod.xml            | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_callDialogMethod.xml b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_callDialogMethod.xml
index 8302ccdfe0..30d5337988 100644
--- a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_callDialogMethod.xml
+++ b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_callDialogMethod.xml
@@ -75,6 +75,17 @@ Generic method called when submitting a form in dialog mode.\n
 Responsible for validating form data and redirecting to the form action.\n
 """\n
 \n
+# XXX We should not use meta_type properly,\n
+# XXX We need to discuss this problem.(yusei)\n
+def isListBox(field):\n
+  if field.meta_type==\'ListBox\':\n
+    return True\n
+  elif field.meta_type==\'ProxyField\':\n
+    template_field = field.getRecursiveTemplateField()\n
+    if template_field.meta_type==\'ListBox\':\n
+      return True\n
+  return False\n
+\n
 from Products.Formulator.Errors import FormValidationError\n
 from ZTUtils import make_query\n
 \n
@@ -175,7 +186,7 @@ for field in form.get_fields():\n
   k = field.id\n
   v = context.REQUEST.get(k, MARKER)\n
   if v is not MARKER:\n
-    if field.meta_type == \'ListBox\':\n
+    if isListBox(field):\n
       listbox_id_list.append(k)\n
     elif can_redirect and (v in (None, [], ()) or hasattr(v, \'read\')) : # If we cannot redirect, useless to test it again\n
       can_redirect = 0\n
@@ -319,6 +330,7 @@ return context.REQUEST.RESPONSE.redirect(redirect_url)\n
                             <string>dialog_category</string>
                             <string>enable_pickle</string>
                             <string>kw</string>
+                            <string>isListBox</string>
                             <string>Products.Formulator.Errors</string>
                             <string>FormValidationError</string>
                             <string>ZTUtils</string>
-- 
2.30.9