From adfb1ae3eb1e7675a789ed0f7f9c8052846bebca Mon Sep 17 00:00:00 2001
From: Vincent Pelletier <vincent@nexedi.com>
Date: Fri, 2 Jan 2009 14:34:33 +0000
Subject: [PATCH] Restrict last counter day lookup to current year (references
 must restart at 1 each year).

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@24999 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../counter_date_workflow/scripts/openAllCounter.xml           | 3 +++
 bt5/erp5_banking_core/bt/revision                              | 2 +-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/bt5/erp5_banking_core/WorkflowTemplateItem/portal_workflow/counter_date_workflow/scripts/openAllCounter.xml b/bt5/erp5_banking_core/WorkflowTemplateItem/portal_workflow/counter_date_workflow/scripts/openAllCounter.xml
index 7ceb257242..4e03667212 100644
--- a/bt5/erp5_banking_core/WorkflowTemplateItem/portal_workflow/counter_date_workflow/scripts/openAllCounter.xml
+++ b/bt5/erp5_banking_core/WorkflowTemplateItem/portal_workflow/counter_date_workflow/scripts/openAllCounter.xml
@@ -120,8 +120,10 @@ if listbox is not None:\n
 \n
 \n
 # Set a reference\n
+first_day_of_year = DateTime(now.year(), 1, 1)\n
 counter_date_list = [x.getObject() for x  in context.portal_catalog(\n
                                            portal_type=\'Counter Date\',site_uid=site_uid,\n
+                                           start_date={\'type\': \'date\', \'query\': first_day_of_year, \'range\': \'nlt\'},\n
                                            sort_on=[(\'start_date\',\'descending\')],limit=1,\n
                                            simulation_state=(\'open\',\'closed\'))]\n
 previous_reference = None\n
@@ -207,6 +209,7 @@ counter_date.setReference(reference)\n
                             <string>check_date_is_today</string>
                             <string>line</string>
                             <string>counter</string>
+                            <string>first_day_of_year</string>
                             <string>previous_reference</string>
                             <string>previous_counter_date</string>
                             <string>int</string>
diff --git a/bt5/erp5_banking_core/bt/revision b/bt5/erp5_banking_core/bt/revision
index 8cb9d84396..d7b14a6c47 100644
--- a/bt5/erp5_banking_core/bt/revision
+++ b/bt5/erp5_banking_core/bt/revision
@@ -1 +1 @@
-475
\ No newline at end of file
+476
\ No newline at end of file
-- 
2.30.9