From 1029c2ad6b7c30fb2d93f425ca5d03844a85966a Mon Sep 17 00:00:00 2001
From: Gabriel Monnerat <gabriel@tiolive.com>
Date: Tue, 1 Mar 2011 14:17:01 +0000
Subject: [PATCH] - update docstring - add condition to ignore events without
 start_date and stop_date

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@43857 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../erp5_web_ung_theme/Base_updateCalendarEventList.xml   | 8 ++++++--
 bt5/erp5_web_ung_theme/bt/revision                        | 2 +-
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/bt5/erp5_web_ung_theme/SkinTemplateItem/portal_skins/erp5_web_ung_theme/Base_updateCalendarEventList.xml b/bt5/erp5_web_ung_theme/SkinTemplateItem/portal_skins/erp5_web_ung_theme/Base_updateCalendarEventList.xml
index 2f7c80b3e4..82dc5cbcf6 100644
--- a/bt5/erp5_web_ung_theme/SkinTemplateItem/portal_skins/erp5_web_ung_theme/Base_updateCalendarEventList.xml
+++ b/bt5/erp5_web_ung_theme/SkinTemplateItem/portal_skins/erp5_web_ung_theme/Base_updateCalendarEventList.xml
@@ -52,7 +52,8 @@
             <key> <string>_body</string> </key>
             <value> <string>"""\n
   Script to load all events and organize all data to be loaded on calendar.\n
-  XXX - Initial Script to serialize all events\n
+  XXX - This script should be splitted, because have many different\n
+  features(i.e add, remove and update events)\n
 """\n
 from Products.ERP5Type.JSONEncoder import encodeInJson as dumps\n
 from DateTime import DateTime\n
@@ -91,6 +92,8 @@ if request_type == "list":\n
   event_dict["end"] = (now+30).strftime("%m/%d/%Y %H:%M")\n
   event_dict["error"] = None\n
   for event in event_list:\n
+    if event.getStartDate() is None or event.getStopDate() is None:\n
+      continue\n
     start = event.getStartDate().strftime("%m/%d/%Y %H:%M")\n
     end = event.getStopDate().strftime("%m/%d/%Y %H:%M")\n
     if event.getStartDate().Date() == event.getStopDate().Date():\n
@@ -123,7 +126,8 @@ elif request_type == "update":\n
   text_content = form.get("event_text_content")\n
   end_date = convertToERP5DateTime(form.get("CalendarEndTime"))\n
   start_date = convertToERP5DateTime(form.get("CalendarStartTime"))\n
-  catalog_object = portal.portal_catalog.getResultValue(portal_type=portal_type_list, id=event_id)\n
+  catalog_object = portal.portal_catalog.getResultValue(portal_type=portal_type_list,\n
+                                                        id=event_id)\n
   event = context.restrictedTraverse(catalog_object.getPath())\n
   if title and event.getTitle() != title:\n
     event.setTitle(title)\n
diff --git a/bt5/erp5_web_ung_theme/bt/revision b/bt5/erp5_web_ung_theme/bt/revision
index ce83bd94b3..9754915269 100644
--- a/bt5/erp5_web_ung_theme/bt/revision
+++ b/bt5/erp5_web_ung_theme/bt/revision
@@ -1 +1 @@
-258
\ No newline at end of file
+259
\ No newline at end of file
-- 
2.30.9