[interchange] * Modify table editor to prevent double-increment of counter file
Greg Hanson
interchange-cvs at icdevgroup.org
Tue Apr 6 18:34:44 UTC 2010
commit b7637291d9e1991e6e56ce72f4cbf9dacae87577
Author: Greg Hanson <greg at perusion.com>
Date: Tue Apr 6 14:33:02 2010 -0400
* Modify table editor to prevent double-increment of counter file
when using IC AUTO_NUMBER.
* Provide reliable return routes after adding item.
dist/lib/UI/pages/admin/flex_editor.html | 5 -----
lib/Vend/Table/Editor.pm | 28 +++++++++++++++++++++++++++-
2 files changed, 27 insertions(+), 6 deletions(-)
---
diff --git a/dist/lib/UI/pages/admin/flex_editor.html b/dist/lib/UI/pages/admin/flex_editor.html
index c88041c..1897b15 100644
--- a/dist/lib/UI/pages/admin/flex_editor.html
+++ b/dist/lib/UI/pages/admin/flex_editor.html
@@ -55,11 +55,6 @@
[/loop]
[perl tables="[cgi mv_data_table]"]
my $db = $Db{$CGI->{mv_data_table}} or return;
- unless ($db->config('AUTO_SEQUENCE')) {
- $db->config('AUTO_NUMBER', '000001')
- unless $db->config('AUTO_NUMBER');
- $CGI->{item_id} = $db->autonumber();
- }
if ($CGI->{ui_clone_id}) {
$CGI->{ui_clone_tables} = '__UI_CLONE_TABLES__' || '__UI_ITEM_TABLES__';
my $db = $Db{$CGI->{mv_data_table}} or return;
diff --git a/lib/Vend/Table/Editor.pm b/lib/Vend/Table/Editor.pm
index 09470b9..f97a298 100644
--- a/lib/Vend/Table/Editor.pm
+++ b/lib/Vend/Table/Editor.pm
@@ -2944,6 +2944,7 @@ EOF
$Vend::Session->{ui_return_stack} ||= [];
+
if($opt->{cgi} and ! $pass_return_to) {
my $r_ary = $Vend::Session->{ui_return_stack};
@@ -2962,8 +2963,18 @@ EOF
if(ref $opt->{hidden} or ref $opt->{hidden_all}) {
my ($hk, $hv);
my @o;
+
while ( ($hk, $hv) = each %$hidden ) {
- push @o, produce_hidden($hk, $hv);
+
+##if new item, get mv_nextpage from radio buttons
+
+ if($opt->{ui_new_item}){
+ next if $hk =~ /mv_nextpage/;
+ push @o, produce_hidden($hk, $hv);
+ }
+ else {
+ push @o, produce_hidden($hk, $hv);
+ }
}
while ( ($hk, $hv) = each %$hidden_all ) {
push @o, produce_hidden($hk, $hv);
@@ -4215,6 +4226,20 @@ EOF
}
+ if($opt->{ui_new_item}) {
+ my $aa_msg = l('Add another item');
+ my $rt_msg = l('Return to table select');
+ chunk 'DO_ANOTHER', 'OUTPUT_MAP', <<EOF;
+<small>
+
+ <input type="radio" class="$opt->{widget_class}" name="mv_nextpage" value="admin/flex_select" CHECKED>
+ $rt_msg
+ <input type="radio" class="$opt->{widget_class}" name="mv_nextpage" value="admin/flex_editor">
+ $aa_msg
+EOF
+
+ }
+
chunk_alias 'HIDDEN_FIELDS', qw/
HIDDEN_ALWAYS
HIDDEN_EXTRA
@@ -4227,6 +4252,7 @@ EOF
OK_BOTTOM
CANCEL_BOTTOM
RESET_BOTTOM
+ DO_ANOTHER
/;
chunk_alias 'EXTRA_BUTTONS', qw/
AUTO_EXPORT
More information about the interchange-cvs
mailing list