From 3b1a65113a56d31e19f7faa88a0f72a5ce89494c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com>
Date: Wed, 2 Oct 2013 10:56:25 +0200
Subject: [PATCH] Support owner with no related person in listboxs

---
 .../erp5_mysql_innodb/SQLCatalog_makeOwnerTitleSearchQuery.xml  | 2 +-
 .../portal_skins/erp5_base/Base_getOwnerTitle.xml               | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/bt5/erp5_base/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/SQLCatalog_makeOwnerTitleSearchQuery.xml b/bt5/erp5_base/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/SQLCatalog_makeOwnerTitleSearchQuery.xml
index 122e75cee8..e3abb29958 100644
--- a/bt5/erp5_base/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/SQLCatalog_makeOwnerTitleSearchQuery.xml
+++ b/bt5/erp5_base/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/SQLCatalog_makeOwnerTitleSearchQuery.xml
@@ -60,7 +60,7 @@ reference_list = [x.reference for x in\n
                                         select_list=[\'reference\'],\n
                                         portal_type="Person", title=value)]\n
 \n
-return SimpleQuery(owner=reference_list or -1)\n
+return SimpleQuery(owner=reference_list or value or -1)\n
 </string> </value>
         </item>
         <item>
diff --git a/bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/Base_getOwnerTitle.xml b/bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/Base_getOwnerTitle.xml
index f4bad77914..6b09eb54d3 100644
--- a/bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/Base_getOwnerTitle.xml
+++ b/bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/Base_getOwnerTitle.xml
@@ -58,6 +58,7 @@ if owner_id_list:\n
   found_user_list = getUserByLogin(context.getPortalObject(), tuple(owner_id_list))\n
   if found_user_list:\n
     return found_user_list[0].getTitle()\n
+  return owner_id_list[0]\n
 </string> </value>
         </item>
         <item>
-- 
2.30.9