From 5f3489f5e3236b3c583e98d8eb409b4ba6bf61b4 Mon Sep 17 00:00:00 2001
From: Romain Courteaud <romain@nexedi.com>
Date: Thu, 30 Jul 2020 08:44:42 +0000
Subject: [PATCH] erp5_dms: drop the hardcoded LIMIT 1000

Do not limit by default
---
 .../erp5_dms/Base_zGetImplicitPredecessorValueList.sql      | 6 +++++-
 .../erp5_dms/Base_zGetImplicitSuccessorValueList.sql        | 6 +++++-
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/bt5/erp5_dms/SkinTemplateItem/portal_skins/erp5_dms/Base_zGetImplicitPredecessorValueList.sql b/bt5/erp5_dms/SkinTemplateItem/portal_skins/erp5_dms/Base_zGetImplicitPredecessorValueList.sql
index 34f6e81a68..c2cc4911e3 100644
--- a/bt5/erp5_dms/SkinTemplateItem/portal_skins/erp5_dms/Base_zGetImplicitPredecessorValueList.sql
+++ b/bt5/erp5_dms/SkinTemplateItem/portal_skins/erp5_dms/Base_zGetImplicitPredecessorValueList.sql
@@ -47,7 +47,11 @@ AS sub inner join catalog on catalog.path = sub.path
 AS main
 WHERE
 <dtml-sqltest "getUid()" column=uid op=ne type=int>
-LIMIT 1000
+
+<dtml-if "query['limit_expression']">
+  LIMIT <dtml-var "query['limit_expression']">
+</dtml-if>
+
 
 <dtml-if "'derived_merge' in optimizer_switch_key_list">
   <dtml-var sql_delimiter>
diff --git a/bt5/erp5_dms/SkinTemplateItem/portal_skins/erp5_dms/Base_zGetImplicitSuccessorValueList.sql b/bt5/erp5_dms/SkinTemplateItem/portal_skins/erp5_dms/Base_zGetImplicitSuccessorValueList.sql
index a452973dc1..0c3e215b05 100644
--- a/bt5/erp5_dms/SkinTemplateItem/portal_skins/erp5_dms/Base_zGetImplicitSuccessorValueList.sql
+++ b/bt5/erp5_dms/SkinTemplateItem/portal_skins/erp5_dms/Base_zGetImplicitSuccessorValueList.sql
@@ -47,7 +47,11 @@ AS sub inner join catalog on catalog.path = sub.path
 AS main
 WHERE
 <dtml-sqltest "getUid()" column=uid op=ne type=int>
-LIMIT 1000
+
+<dtml-if "query['limit_expression']">
+  LIMIT <dtml-var "query['limit_expression']">
+</dtml-if>
+
 
 <dtml-if "'derived_merge' in optimizer_switch_key_list">
   <dtml-var sql_delimiter>
-- 
2.30.9