From be644466dc5f0c3c8341243b796e66939845db63 Mon Sep 17 00:00:00 2001
From: Vincent Pelletier <vincent@nexedi.com>
Date: Wed, 28 Mar 2007 09:22:43 +0000
Subject: [PATCH] Fix problem when generating a list of more than one id for a
 non-existing id_group.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@13741 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../erp5_mysql_innodb/z_portal_ids_generate_id.xml            | 4 ++--
 product/ERP5/bootstrap/erp5_mysql_innodb_catalog/bt/revision  | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/product/ERP5/bootstrap/erp5_mysql_innodb_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_portal_ids_generate_id.xml b/product/ERP5/bootstrap/erp5_mysql_innodb_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_portal_ids_generate_id.xml
index 68619f3d2b..a1308d58fe 100644
--- a/product/ERP5/bootstrap/erp5_mysql_innodb_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_portal_ids_generate_id.xml
+++ b/product/ERP5/bootstrap/erp5_mysql_innodb_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_portal_ids_generate_id.xml
@@ -112,7 +112,7 @@ BEGIN\n
 INSERT INTO\n
   portal_ids (`id_group`, `last_id`)\n
 VALUES\n
-  (<dtml-sqlvar id_group type="string">, LAST_INSERT_ID(<dtml-sqlvar default type="int">))\n
+  (<dtml-sqlvar id_group type="string">, LAST_INSERT_ID(<dtml-sqlvar expr="default + id_count" type="int">))\n
 ON DUPLICATE KEY UPDATE\n
   `last_id` = LAST_INSERT_ID(`last_id` + <dtml-sqlvar id_count type="int">)\n
 <dtml-var sql_delimiter>\n
@@ -162,7 +162,7 @@ BEGIN\n
 INSERT INTO\n
   portal_ids (`id_group`, `last_id`)\n
 VALUES\n
-  (<dtml-sqlvar id_group type="string">, LAST_INSERT_ID(<dtml-sqlvar default type="int">))\n
+  (<dtml-sqlvar id_group type="string">, LAST_INSERT_ID(<dtml-sqlvar expr="default + id_count" type="int">))\n
 ON DUPLICATE KEY UPDATE\n
   `last_id` = LAST_INSERT_ID(`last_id` + <dtml-sqlvar id_count type="int">)\n
 <dtml-var sql_delimiter>\n
diff --git a/product/ERP5/bootstrap/erp5_mysql_innodb_catalog/bt/revision b/product/ERP5/bootstrap/erp5_mysql_innodb_catalog/bt/revision
index dce6588ca1..c24b6ae77d 100644
--- a/product/ERP5/bootstrap/erp5_mysql_innodb_catalog/bt/revision
+++ b/product/ERP5/bootstrap/erp5_mysql_innodb_catalog/bt/revision
@@ -1 +1 @@
-36
\ No newline at end of file
+38
\ No newline at end of file
-- 
2.30.9