From 0513d98e5b5b1f007d0d21ceb45a429cb5e09ff8 Mon Sep 17 00:00:00 2001
From: Romain Courteaud <romain@nexedi.com>
Date: Tue, 1 Jul 2008 09:48:01 +0000
Subject: [PATCH] Handle selection stats in ReportSection.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@22142 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5Form/Report.py | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/product/ERP5Form/Report.py b/product/ERP5Form/Report.py
index d010064980..cf0f6197c9 100644
--- a/product/ERP5Form/Report.py
+++ b/product/ERP5Form/Report.py
@@ -202,6 +202,7 @@ class ReportSection:
                      selection_params=None,
                      listbox_display_mode=None, 
                      selection_columns=None,
+                     selection_stats=None,
                      selection_sort_order=None,
                      selection_report_path=None,
                      selection_report_list=None):
@@ -226,6 +227,7 @@ class ReportSection:
     self.selection_params = selection_params
     self.listbox_display_mode = listbox_display_mode
     self.selection_columns = selection_columns
+    self.selection_stats = selection_stats
     self.selection_sort_order = selection_sort_order
     self.saved_selections = {}
     self.selection_report_path = selection_report_path
@@ -330,6 +332,12 @@ class ReportSection:
                                                        REQUEST=REQUEST)
           portal_selections.setSelectionSortOrder(selection_name,
                       self.selection_sort_order, REQUEST=REQUEST)
+        if self.selection_stats is not None:
+          self.saved_selections[selection_name]['stats'] =  \
+               portal_selections.getSelectionStats(selection_name,
+                                                     REQUEST=REQUEST)
+          portal_selections.setSelectionStats(selection_name,
+                                  self.selection_stats, REQUEST=REQUEST)
 
     self.saved_request_form = REQUEST.form
     REQUEST.form = {}
@@ -389,6 +397,10 @@ class ReportSection:
           portal_selections.setSelectionSortOrder(selection_name,
                       self.saved_selections[selection_name]['sort_order'],
                       REQUEST=REQUEST)
+        if self.selection_stats is not None:
+          portal_selections.setSelectionStats(selection_name,
+                      self.saved_selections[selection_name]['stats'],
+                      REQUEST=REQUEST)
 
     REQUEST.form = self.saved_request_form
 
-- 
2.30.9