Index: openacs-4/packages/ecommerce/www/admin/customer-service/picklist-item-add-2-postgresql.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/ecommerce/www/admin/customer-service/picklist-item-add-2-postgresql.xql,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/ecommerce/www/admin/customer-service/picklist-item-add-2-postgresql.xql 10 Jul 2001 20:33:53 -0000 1.1
+++ openacs-4/packages/ecommerce/www/admin/customer-service/picklist-item-add-2-postgresql.xql 27 Aug 2001 00:06:28 -0000 1.2
@@ -8,7 +8,7 @@
insert into ec_picklist_items
(picklist_item_id, picklist_item, picklist_name, sort_key, last_modified, last_modifying_user, modified_ip_address)
values
-(:picklist_item_id, :picklist_item, :picklist_name, (:prev_sort_key + :next_sort_key)/2, current_timestamp, :user_id,:address)
+(:picklist_item_id, :picklist_item, :picklist_name, ($prev_sort_key + $next_sort_key)/2, current_timestamp, :user_id,:address)
Index: openacs-4/packages/ecommerce/www/admin/customer-service/picklist-item-add-2.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/ecommerce/www/admin/customer-service/picklist-item-add-2.tcl,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/ecommerce/www/admin/customer-service/picklist-item-add-2.tcl 20 Apr 2001 20:51:14 -0000 1.1
+++ openacs-4/packages/ecommerce/www/admin/customer-service/picklist-item-add-2.tcl 27 Aug 2001 00:06:28 -0000 1.2
@@ -15,8 +15,8 @@
picklist_item_id
picklist_item
picklist_name
- prev_sort_key
- next_sort_key
+ prev_sort_key:notnull
+ next_sort_key:notnull
}
#
ad_require_permission [ad_conn package_id] admin
@@ -28,7 +28,7 @@
set return_url "[ad_conn url]?[export_entire_form_as_url_vars]"
- ad_returnredirect "/register.tcl?[export_url_vars return_url]"
+ ad_returnredirect "/register?[export_url_vars return_url]"
return
}
@@ -40,17 +40,19 @@
if { [db_0or1row get_picklist_item_id "select picklist_item_id from ec_picklist_items
where picklist_item_id=:picklist_item_id"] == 1 } {
- ad_returnredirect "picklists.tcl"
+ ad_returnredirect "picklists"
return
}
# now make sure that there is no picklist_item with the
# same picklist_name with a sort key equal to the new sort key
+set sort_key [expr ($prev_sort_key + $next_sort_key)/2]
+
set n_conflicts [db_string get_n_conflicts "select count(*)
from ec_picklist_items
where picklist_name=:picklist_name
-and sort_key = (:prev_sort_key + :next_sort_key)/2"]
+and sort_key = :sort_key"]
if { $n_conflicts > 0 } {
ad_return_complaint 1 "
The picklist management page you came from appears
@@ -64,6 +66,6 @@
db_dml insert_new_picklist_item "insert into ec_picklist_items
(picklist_item_id, picklist_item, picklist_name, sort_key, last_modified, last_modifying_user, modified_ip_address)
values
-(:picklist_item_id, :picklist_item, :picklist_name, (:prev_sort_key + :next_sort_key)/2, sysdate, :user_id,:address)"
+(:picklist_item_id, :picklist_item, :picklist_name, ($prev_sort_key + $next_sort_key)/2, sysdate, :user_id,:address)"
db_release_unused_handles
-ad_returnredirect "picklists.tcl"
+ad_returnredirect "picklists"
Index: openacs-4/packages/ecommerce/www/admin/customer-service/picklist-item-add-2.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/ecommerce/www/admin/customer-service/picklist-item-add-2.xql,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/ecommerce/www/admin/customer-service/picklist-item-add-2.xql 10 Jul 2001 20:33:53 -0000 1.1
+++ openacs-4/packages/ecommerce/www/admin/customer-service/picklist-item-add-2.xql 27 Aug 2001 00:06:28 -0000 1.2
@@ -14,7 +14,7 @@
select count(*)
from ec_picklist_items
where picklist_name=:picklist_name
-and sort_key = (:prev_sort_key + :next_sort_key)/2
+and sort_key = :sort_key
Index: openacs-4/packages/ecommerce/www/admin/customer-service/picklist-item-add.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/ecommerce/www/admin/customer-service/picklist-item-add.tcl,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/ecommerce/www/admin/customer-service/picklist-item-add.tcl 20 Apr 2001 20:51:14 -0000 1.1
+++ openacs-4/packages/ecommerce/www/admin/customer-service/picklist-item-add.tcl 27 Aug 2001 00:06:28 -0000 1.2
@@ -11,8 +11,8 @@
@author ported by Jerry Asher (jerry@theashergroup.com)
} {
picklist_name
- prev_sort_key
- next_sort_key
+ prev_sort_key:notnull
+ next_sort_key:notnull
}
ad_require_permission [ad_conn package_id] admin
@@ -22,11 +22,12 @@
# (average of prev_sort_key and next_sort_key);
# otherwise warn them that their form is not up-to-date
+set sort_key [expr ($prev_sort_key + $next_sort_key)/2]
set n_conflicts [db_string get_count_items "select count(*)
from ec_picklist_items
where picklist_name=:picklist_name
-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;
@@ -63,4 +64,4 @@
"
-doc_return 200 text/html $doc_body
\ No newline at end of file
+doc_return 200 text/html $doc_body
Index: openacs-4/packages/ecommerce/www/admin/customer-service/picklist-item-add.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/ecommerce/www/admin/customer-service/picklist-item-add.xql,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/ecommerce/www/admin/customer-service/picklist-item-add.xql 10 Jul 2001 20:33:53 -0000 1.1
+++ openacs-4/packages/ecommerce/www/admin/customer-service/picklist-item-add.xql 27 Aug 2001 00:06:28 -0000 1.2
@@ -6,7 +6,7 @@
select count(*)
from ec_picklist_items
where picklist_name=:picklist_name
-and sort_key = (:prev_sort_key + :next_sort_key)/2
+and sort_key = :sort_key