From 31b40dbadd526547fa1fc018f6e5230fee16ff6f Mon Sep 17 00:00:00 2001
From: Yoshinori Okuji <yo@nexedi.com>
Date: Wed, 19 Jan 2005 15:11:18 +0000
Subject: [PATCH] Add support for base categories without sub-categories and
 choosing skin selections.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@2244 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5/Document/BusinessTemplate.py | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/product/ERP5/Document/BusinessTemplate.py b/product/ERP5/Document/BusinessTemplate.py
index c751556005..bcce54a18d 100755
--- a/product/ERP5/Document/BusinessTemplate.py
+++ b/product/ERP5/Document/BusinessTemplate.py
@@ -173,6 +173,11 @@ class CategoryTemplateItem(ObjectTemplateItem):
       #if not object.cb_isCopyable():
       #  raise CopyError, eNotSupported % escape(relative_url)
       category_copy = category._getCopy(context)
+      include_sub_categories = category.getProperty('business_template_include_sub_categories', 1)
+      if not include_sub_categories:
+        id_list = category_copy.objectIds()
+        if len(id_list) > 0:
+          category_copy.manage_delObjects(list(id_list))
       self._archive[relative_url] = category_copy
       category_copy.wl_clearLocks()
       # No store attributes for light install
@@ -223,10 +228,12 @@ class SkinTemplateItem(ObjectTemplateItem):
     for skin_name, selection in ps.getSkinPaths():
       new_selection = []
       selection = selection.split(',')
-      for relative_url in self._archive.keys():
+      for relative_url, object in self._archive.items():
         skin_id = relative_url.split('/')[-1]
-        if skin_id not in selection:
-          new_selection.append(skin_id)
+        selection_list = object.getProperty('business_template_registered_skin_selections', None)
+        if selection_list is None or skin_name in selection_list:
+          if skin_id not in selection:
+            new_selection.append(skin_id)
       new_selection.extend(selection)
       ps.manage_skinLayers(skinpath = tuple(new_selection), skinname = skin_name, add_skin = 1)
 
-- 
2.30.9