[interchange-cvs] interchange - jon modified 2 files

interchange-cvs at icdevgroup.org interchange-cvs at icdevgroup.org
Mon Jul 14 23:06:00 EDT 2003


User:      jon
Date:      2003-07-15 02:06:05 GMT
Modified:  lib/Vend Form.pm
Modified:  lib/Vend/Table Editor.pm
Log:
Two patches for lookup_query in mv_metadata:

* Substitute for placeholders in query (just like with prepend and append):

  _UI_TABLE_
  _UI_COLUMN_
  _UI_KEY_

  This allows foreign table lookup queries to be tailored for the record
  currently being edited in the table editor.

* Avoid internal server error if query fails.

Revision  Changes    Path
2.36      +5 -3      interchange/lib/Vend/Form.pm


rev 2.36, prev_rev 2.35
Index: Form.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Form.pm,v
retrieving revision 2.35
retrieving revision 2.36
diff -u -u -r2.35 -r2.36
--- Form.pm	3 Jul 2003 23:12:56 -0000	2.35
+++ Form.pm	15 Jul 2003 02:06:05 -0000	2.36
@@ -1,6 +1,6 @@
 # Vend::Form - Generate Form widgets
 # 
-# $Id: Form.pm,v 2.35 2003/07/03 23:12:56 mheins Exp $
+# $Id: Form.pm,v 2.36 2003/07/15 02:06:05 jon Exp $
 #
 # Copyright (C) 2002-2003 Interchange Development Group
 # Copyright (C) 1996-2002 Red Hat, Inc.
@@ -38,7 +38,7 @@
 require Exporter;
 @ISA = qw(Exporter);
 
-$VERSION = substr(q$Revision: 2.35 $, 10);
+$VERSION = substr(q$Revision: 2.36 $, 10);
 
 @EXPORT = qw (
 	display
@@ -1027,6 +1027,7 @@
 	my $look;
 
 	if($look = $opt->{lookup_query}) {
+#::logDebug("lookup_query called, opt=" . uneval($opt));
 		my $tab = $opt->{db} || $opt->{table} || $Vend::Cfg->{ProductFiles}[0];
 		my $db = Vend::Data::database_exists_ref($tab);
 		my @looks = split /\s*;\s*/, $look;
@@ -1034,7 +1035,8 @@
 		for my $l (@looks) {
 			next unless $db;
 			next unless $l =~ /^select\s+/i;
-			push @$data, @{$db->query($l)};
+			my $qr = $db->query($l);
+			ref($qr) eq 'ARRAY' and push @$data, @$qr;
 		}
 		if($data->[0] and @{$data->[0]} > 2) {
 			my $j = $opt->{label_joiner} || '-';



1.38      +4 -4      interchange/lib/Vend/Table/Editor.pm


rev 1.38, prev_rev 1.37
Index: Editor.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Table/Editor.pm,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -u -r1.37 -r1.38
--- Editor.pm	2 Jul 2003 15:15:31 -0000	1.37
+++ Editor.pm	15 Jul 2003 02:06:05 -0000	1.38
@@ -1,6 +1,6 @@
 # Vend::Table::Editor - Swiss-army-knife table editor for Interchange
 #
-# $Id: Editor.pm,v 1.37 2003/07/02 15:15:31 mheins Exp $
+# $Id: Editor.pm,v 1.38 2003/07/15 02:06:05 jon 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.37 $, 10);
+$VERSION = substr(q$Revision: 1.38 $, 10);
 
 use Vend::Util;
 use Vend::Interpolate;
@@ -400,8 +400,8 @@
 			last METAMAKE;
 		}
 
-#::logDebug("formatting prepend/append");
-		for(qw/append prepend/) {
+#::logDebug("formatting prepend/append/lookup_query");
+		for(qw/append prepend lookup_query/) {
 			next unless $record->{$_};
 			if($opt->{restrict_allow}) {
 				$record->{$_} = $Tag->restrict({







More information about the interchange-cvs mailing list