[interchange-cvs] interchange - heins modified
lib/Vend/Table/Editor.pm
interchange-cvs at icdevgroup.org
interchange-cvs at icdevgroup.org
Mon Apr 12 14:29:51 EDT 2004
User: heins
Date: 2004-04-12 18:29:50 GMT
Modified: lib/Vend/Table Editor.pm
Log:
* Have table-editor pre-populate the appropriate fields of a COMPOSITE_KEY
record when an item_id is requested and the item does not exist.
Revision Changes Path
1.56 +16 -4 interchange/lib/Vend/Table/Editor.pm
rev 1.56, prev_rev 1.55
Index: Editor.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Table/Editor.pm,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -r1.55 -r1.56
--- Editor.pm 11 Apr 2004 23:01:57 -0000 1.55
+++ Editor.pm 12 Apr 2004 18:29:50 -0000 1.56
@@ -1,6 +1,6 @@
# Vend::Table::Editor - Swiss-army-knife table editor for Interchange
#
-# $Id: Editor.pm,v 1.55 2004/04/11 23:01:57 mheins Exp $
+# $Id: Editor.pm,v 1.56 2004/04/12 18:29:50 mheins Exp $
#
# Copyright (C) 2002-2003 Interchange Development Group
# Copyright (C) 2002 Mike Heins <mike at perusion.net>
@@ -26,7 +26,7 @@
package Vend::Table::Editor;
use vars qw($VERSION);
-$VERSION = substr(q$Revision: 1.55 $, 10);
+$VERSION = substr(q$Revision: 1.56 $, 10);
use Vend::Util;
use Vend::Interpolate;
@@ -1718,6 +1718,7 @@
my $data;
my $exists;
my $db;
+ my $multikey;
## Try and sneak a peek at the data so we can determine views and
## maybe some other stuff -- we definitely need table/key or a
@@ -1729,7 +1730,8 @@
$db = database_exists_ref($tab);
if($db) {
- if($db->config('COMPOSITE_KEY') and $key !~ /\0/) {
+ $multikey = $db->config('COMPOSITE_KEY');
+ if($multikey and $key !~ /\0/) {
$key =~ s/-_NULL_-/\0/g;
}
if($opt->{ui_clone_id} and $db->record_exists($opt->{ui_clone_id})) {
@@ -1739,6 +1741,16 @@
$data = $db->row_hash($key);
$exists = 1;
}
+
+ if(! $exists and $multikey) {
+ $data = {};
+ eval {
+ my @inits = split /\0/, $key;
+ for(@{$db->config('_Key_columns')}) {
+ $data->{$_} = shift @inits;
+ }
+ };
+ }
}
}
@@ -2043,7 +2055,7 @@
my $key_message;
if($opt->{ui_new_item} and ! $opt->{notable}) {
- if( ! $db->config('_Auto_number') and ! $db->config('AUTO_SEQUENCE') ) {
+ if( ! $db->config('_Auto_number') and ! $db->config('AUTO_SEQUENCE')) {
$db->config('AUTO_NUMBER', '000001');
$key = $db->autonumber($key);
}
More information about the interchange-cvs
mailing list