Index: openacs-4/packages/ecommerce/www/admin/cat/subsubcategory-add-0.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/ecommerce/www/admin/cat/subsubcategory-add-0.tcl,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/ecommerce/www/admin/cat/subsubcategory-add-0.tcl 20 Apr 2001 20:51:13 -0000 1.1
+++ openacs-4/packages/ecommerce/www/admin/cat/subsubcategory-add-0.tcl 18 Jul 2001 02:52:45 -0000 1.2
@@ -26,11 +26,15 @@
# (average of prev_sort_key and next_sort_key);
# otherwise warn them that their form is not up-to-date
+### gilbertw - added do the calculation outside of the db. PostgreSQL encloses
+# the bind variables in ' '
+# where sort_key = (:prev_sort_key + :next_sort_key)/2
+set sort_key [expr ($prev_sort_key + $next_sort_key)/2]
set n_conflicts [db_string get_n_conflicts "select count(*)
from ec_subsubcategories
where subcategory_id=:subcategory_id
-and sort_key = (:prev_sort_key + :next_sort_key)/2"]
+and sort_key = :sort_key"]
if { $n_conflicts > 0 } {
ad_return_complaint 1 "
The page you came from appears to be out-of-date;
Index: openacs-4/packages/ecommerce/www/admin/cat/subsubcategory-add-0.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/ecommerce/www/admin/cat/subsubcategory-add-0.xql,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/ecommerce/www/admin/cat/subsubcategory-add-0.xql 10 Jul 2001 20:33:53 -0000 1.1
+++ openacs-4/packages/ecommerce/www/admin/cat/subsubcategory-add-0.xql 18 Jul 2001 02:52:45 -0000 1.2
@@ -6,7 +6,7 @@
select count(*)
from ec_subsubcategories
where subcategory_id=:subcategory_id
-and sort_key = (:prev_sort_key + :next_sort_key)/2
+and sort_key = :sort_key
Index: openacs-4/packages/ecommerce/www/admin/cat/subsubcategory-add-2-oracle.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/ecommerce/www/admin/cat/subsubcategory-add-2-oracle.xql,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/ecommerce/www/admin/cat/subsubcategory-add-2-oracle.xql 10 Jul 2001 20:33:53 -0000 1.1
+++ openacs-4/packages/ecommerce/www/admin/cat/subsubcategory-add-2-oracle.xql 18 Jul 2001 02:52:45 -0000 1.2
@@ -8,7 +8,7 @@
insert into ec_subsubcategories
(subcategory_id, subsubcategory_id, subsubcategory_name, sort_key, last_modified, last_modifying_user, modified_ip_address)
values
-(:subcategory_id, :subsubcategory_id, :subsubcategory_name, (:prev_sort_key + :next_sort_key)/2, sysdate, :user_id,:address)
+(:subcategory_id, :subsubcategory_id, :subsubcategory_name, :sort_key, sysdate, :user_id,:address)
Index: openacs-4/packages/ecommerce/www/admin/cat/subsubcategory-add-2-postgresql.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/ecommerce/www/admin/cat/subsubcategory-add-2-postgresql.xql,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/ecommerce/www/admin/cat/subsubcategory-add-2-postgresql.xql 10 Jul 2001 20:33:53 -0000 1.1
+++ openacs-4/packages/ecommerce/www/admin/cat/subsubcategory-add-2-postgresql.xql 18 Jul 2001 02:52:45 -0000 1.2
@@ -8,7 +8,7 @@
insert into ec_subsubcategories
(subcategory_id, subsubcategory_id, subsubcategory_name, sort_key, last_modified, last_modifying_user, modified_ip_address)
values
-(:subcategory_id, :subsubcategory_id, :subsubcategory_name, (:prev_sort_key + :next_sort_key)/2, current_timestamp, :user_id,:address)
+(:subcategory_id, :subsubcategory_id, :subsubcategory_name, :sort_key, current_timestamp, :user_id,:address)
Index: openacs-4/packages/ecommerce/www/admin/cat/subsubcategory-add-2.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/ecommerce/www/admin/cat/subsubcategory-add-2.tcl,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/ecommerce/www/admin/cat/subsubcategory-add-2.tcl 20 Apr 2001 20:51:13 -0000 1.1
+++ openacs-4/packages/ecommerce/www/admin/cat/subsubcategory-add-2.tcl 18 Jul 2001 02:52:45 -0000 1.2
@@ -54,10 +54,15 @@
# now make sure there's no subsubcategory in this subcategory with that sort key already
+### gilbertw - added do the calculation outside of the db. PostgreSQL encloses
+# the bind variables in ' '
+# where sort_key = (:prev_sort_key + :next_sort_key)/2
+set sort_key [expr ($prev_sort_key + $next_sort_key)/2]
+
set n_conflicts [db_string get_n_conflicts "select count(*)
from ec_subsubcategories
where subcategory_id=:subcategory_id
-and sort_key = (:prev_sort_key + :next_sort_key)/2"]
+and sort_key = :sort_key"]
if { $n_conflicts > 0 } {
ad_return_complaint 1 "The $subcategory_name page appears to be out-of-date;
@@ -71,7 +76,7 @@
db_dml insert_ec_subsubcat "insert into ec_subsubcategories
(subcategory_id, subsubcategory_id, subsubcategory_name, sort_key, last_modified, last_modifying_user, modified_ip_address)
values
-(:subcategory_id, :subsubcategory_id, :subsubcategory_name, (:prev_sort_key + :next_sort_key)/2, sysdate, :user_id,:address)"
+(:subcategory_id, :subsubcategory_id, :subsubcategory_name, :sort_key, sysdate, :user_id,:address)"
db_release_unused_handles
ad_returnredirect "subcategory?[export_url_vars category_id category_name subcategory_id subcategory_name]"
Index: openacs-4/packages/ecommerce/www/admin/cat/subsubcategory-add-2.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/ecommerce/www/admin/cat/subsubcategory-add-2.xql,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/ecommerce/www/admin/cat/subsubcategory-add-2.xql 10 Jul 2001 20:33:53 -0000 1.1
+++ openacs-4/packages/ecommerce/www/admin/cat/subsubcategory-add-2.xql 18 Jul 2001 02:52:45 -0000 1.2
@@ -14,7 +14,7 @@
select count(*)
from ec_subsubcategories
where subcategory_id=:subcategory_id
-and sort_key = (:prev_sort_key + :next_sort_key)/2
+and sort_key = :sort_key
Index: openacs-4/packages/ecommerce/www/admin/cat/subsubcategory-add.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/ecommerce/www/admin/cat/subsubcategory-add.tcl,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/ecommerce/www/admin/cat/subsubcategory-add.tcl 20 Apr 2001 20:51:14 -0000 1.1
+++ openacs-4/packages/ecommerce/www/admin/cat/subsubcategory-add.tcl 18 Jul 2001 02:52:45 -0000 1.2
@@ -30,11 +30,15 @@
# (average of prev_sort_key and next_sort_key);
# otherwise warn them that their form is not up-to-date
+### gilbertw - added do the calculation outside of the db. PostgreSQL encloses
+# the bind variables in ' '
+# where sort_key = (:prev_sort_key + :next_sort_key)/2
+set sort_key [expr ($prev_sort_key + $next_sort_key)/2]
set n_conflicts [db_string get_n_conflicts "select count(*)
from ec_subsubcategories
where subcategory_id=:subcategory_id
-and sort_key = (:prev_sort_key + :next_sort_key)/2"]
+and sort_key = :sort_key"]
if { $n_conflicts > 0 } {
ad_return_complaint 1 "The $subcategory_name page appears to be out-of-date;
Index: openacs-4/packages/ecommerce/www/admin/cat/subsubcategory-add.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/ecommerce/www/admin/cat/subsubcategory-add.xql,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/ecommerce/www/admin/cat/subsubcategory-add.xql 10 Jul 2001 20:33:53 -0000 1.1
+++ openacs-4/packages/ecommerce/www/admin/cat/subsubcategory-add.xql 18 Jul 2001 02:52:45 -0000 1.2
@@ -6,7 +6,7 @@
select count(*)
from ec_subsubcategories
where subcategory_id=:subcategory_id
-and sort_key = (:prev_sort_key + :next_sort_key)/2
+and sort_key = :sort_key