From 8c368da29189facf7ab00be62b57c738d8f55664 Mon Sep 17 00:00:00 2001
From: Vincent Bechu <vincent.bechu@nexedi.com>
Date: Thu, 11 May 2017 15:23:08 +0200
Subject: [PATCH] erp5_officejs: limit document amount for erp5 synchronization

---
 .../gadget_officejs_page_jio_erp5_configurator_js.js  | 11 +++--------
 .../gadget_officejs_page_jio_erp5_configurator_js.xml |  4 ++--
 2 files changed, 5 insertions(+), 10 deletions(-)

diff --git a/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_jio_erp5_configurator_js.js b/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_jio_erp5_configurator_js.js
index 4bff4e5358..db6f2611de 100644
--- a/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_jio_erp5_configurator_js.js
+++ b/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_jio_erp5_configurator_js.js
@@ -19,18 +19,13 @@
           portal_type = result[0],
           attachment_synchro = result[1] !== undefined,
           extended_attachment_url = result[1];
-        // We are looking for documents modified in the past 3 month
-        old_date = new Date(old_date.getFullYear(), old_date.getMonth(), old_date.getDate() - 15);
         configuration = {
           type: "replicate",
           // XXX This drop the signature lists...
           query: {
-            query: 'portal_type:"' + portal_type
-            // XX Synchonizing the whole module is too much, here is a way to start quietly
-            // Supsended until modification_date is handled for synchronization
-              + '" AND modification_date:>="'
-              + old_date.toISOString() + '" ',
-            limit: [0, 1234567890]
+            query: 'portal_type:"' + portal_type + '"',
+            limit: [0, 30],
+            sort_on: [["modification_date", "descending"]]
           },
           use_remote_post: true,
           conflict_handling: 1,
diff --git a/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_jio_erp5_configurator_js.xml b/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_jio_erp5_configurator_js.xml
index d084e5698a..ec6f176b90 100644
--- a/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_jio_erp5_configurator_js.xml
+++ b/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_jio_erp5_configurator_js.xml
@@ -273,7 +273,7 @@
             </item>
             <item>
                 <key> <string>serial</string> </key>
-                <value> <string>957.15138.20000.4881</string> </value>
+                <value> <string>958.61732.51927.19012</string> </value>
             </item>
             <item>
                 <key> <string>state</string> </key>
@@ -291,7 +291,7 @@
                     </tuple>
                     <state>
                       <tuple>
-                        <float>1486741091.54</float>
+                        <float>1493209251.12</float>
                         <string>UTC</string>
                       </tuple>
                     </state>
-- 
2.30.9