From 1ce39569c630dc8a8582012f59c5f0f20168f20e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bartek=20G=C3=B3rny?= <bartek@gorny.edu.pl>
Date: Thu, 28 Sep 2006 14:48:10 +0000
Subject: [PATCH] bugfixes

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@10409 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../erp5_dms/DMS_createObjectFromFile.xml             |  2 +-
 .../portal_skins/erp5_dms/DMS_notifyByEmail.xml       | 11 ++++++-----
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/bt5/erp5_dms/SkinTemplateItem/portal_skins/erp5_dms/DMS_createObjectFromFile.xml b/bt5/erp5_dms/SkinTemplateItem/portal_skins/erp5_dms/DMS_createObjectFromFile.xml
index e5027c4417..4eb1728c5e 100644
--- a/bt5/erp5_dms/SkinTemplateItem/portal_skins/erp5_dms/DMS_createObjectFromFile.xml
+++ b/bt5/erp5_dms/SkinTemplateItem/portal_skins/erp5_dms/DMS_createObjectFromFile.xml
@@ -76,7 +76,7 @@ if ctype is None:\n
 \n
 # create content\n
 ob=context.document_module.newContent(portal_type=ctype)\n
-ob.Base_edit(file=data) # XXX to nie jest dobrze\n
+ob.manage_upload(data)\n
 ob.DMS_ingestFile(fname,data)\n
 return ob\n
 </string> </value>
diff --git a/bt5/erp5_dms/SkinTemplateItem/portal_skins/erp5_dms/DMS_notifyByEmail.xml b/bt5/erp5_dms/SkinTemplateItem/portal_skins/erp5_dms/DMS_notifyByEmail.xml
index 901abe0582..a8a2fbb480 100644
--- a/bt5/erp5_dms/SkinTemplateItem/portal_skins/erp5_dms/DMS_notifyByEmail.xml
+++ b/bt5/erp5_dms/SkinTemplateItem/portal_skins/erp5_dms/DMS_notifyByEmail.xml
@@ -69,9 +69,9 @@
         <item>
             <key> <string>_body</string> </key>
             <value> <string>pref=context.portal_preferences.getPreferredDmsIngestEmailNotification()\n
-if len(pref)==0:return\n
-pref=pref[0]\n
-if pref==\'never\':return\n
+if pref is not None and len(pref)==0:\n
+  pref=pref[0]\n
+  if pref==\'never\':return\n
 \n
 subjecttpl=\'ingested %(name)s\'\n
 msgtpl="""Your document "%(name)s" was successfully ingested.\n
@@ -79,8 +79,8 @@ msgtpl="""Your document "%(name)s" was successfully ingested.\n
 click here: %(url)s/view to proceed with your work.\n
 """\n
 ob=kw[\'object\']\n
-subject=subjecttpl % {\'name\':ob.getOriginalFilename()}\n
-msg=msgtpl % {\'url\':ob.absolute_url(),\'name\':ob.getOriginalFilename()}\n
+subject=subjecttpl % {\'name\':ob.getSourceReference()}\n
+msg=msgtpl % {\'url\':ob.absolute_url(),\'name\':ob.getSourceReference()}\n
 mto=kw[\'address\']\n
 mfro=\'dms@dms.nexedi.com\'\n
 \n
@@ -131,6 +131,7 @@ context.MailHost.send(msg,mto,mfro,subject)\n
                             <string>_getattr_</string>
                             <string>context</string>
                             <string>pref</string>
+                            <string>None</string>
                             <string>len</string>
                             <string>_getitem_</string>
                             <string>subjecttpl</string>
-- 
2.30.9