From a9b14c3f6fe3c4ab93083d57ceb9663c275441ee Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gr=C3=A9gory=20Wisniewski?= <gregory@nexedi.com>
Date: Sun, 16 May 2010 17:09:22 +0000
Subject: [PATCH] Open accounting dates within the current month only

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@35368 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../accounting_date_workflow/scripts/checkOpenPossible.xml   | 5 +++++
 bt5/erp5_banking_core/bt/revision                            | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/bt5/erp5_banking_core/WorkflowTemplateItem/portal_workflow/accounting_date_workflow/scripts/checkOpenPossible.xml b/bt5/erp5_banking_core/WorkflowTemplateItem/portal_workflow/accounting_date_workflow/scripts/checkOpenPossible.xml
index 9e5317e2d0..e4a9143af0 100644
--- a/bt5/erp5_banking_core/WorkflowTemplateItem/portal_workflow/accounting_date_workflow/scripts/checkOpenPossible.xml
+++ b/bt5/erp5_banking_core/WorkflowTemplateItem/portal_workflow/accounting_date_workflow/scripts/checkOpenPossible.xml
@@ -70,6 +70,11 @@ if site_uid is None:\n
   msg = Message(domain=\'ui\',message="Sorry, the site is not defined")\n
   raise ValidationFailed (msg,)\n
 \n
+# Check if the start_date is in the current month\n
+if not accounting_date.getStartDate().isCurrentMonth():\n
+  msg = Message(domain=\'ui\', message=\'Date must be within the current month\')\n
+  raise ValidationFailed (msg,)\n
+\n
 opened_date_list = accounting_date.portal_catalog(portal_type="Accounting Date", simulation_state="opened", default_site_uid=accounting_date.getSiteUid())\n
 if len(opened_date_list) > 0:\n
   msg = Message(domain=\'ui\',message="Sorry, another accounting date is already opened")\n
diff --git a/bt5/erp5_banking_core/bt/revision b/bt5/erp5_banking_core/bt/revision
index 1bc902939e..625c09bc81 100644
--- a/bt5/erp5_banking_core/bt/revision
+++ b/bt5/erp5_banking_core/bt/revision
@@ -1 +1 @@
-531
\ No newline at end of file
+532
-- 
2.30.9