[interchange-cvs] interchange - heins modified 2 files

interchange-cvs at icdevgroup.org interchange-cvs at icdevgroup.org
Wed Dec 3 22:52:19 EST 2003


User:      heins
Date:      2003-12-04 03:52:19 GMT
Modified:  lib/Vend/Options Matrix.pm Old48.pm
Log:
* Add inventory function back in. Mysteriously removed during the
  Options rewrite.

Revision  Changes    Path
1.6       +26 -3     interchange/lib/Vend/Options/Matrix.pm


rev 1.6, prev_rev 1.5
Index: Matrix.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Options/Matrix.pm,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- Matrix.pm	5 Aug 2003 21:46:19 -0000	1.5
+++ Matrix.pm	4 Dec 2003 03:52:18 -0000	1.6
@@ -1,6 +1,6 @@
 # Vend::Options::Matrix - Interchange Matrix product options
 #
-# $Id: Matrix.pm,v 1.5 2003/08/05 21:46:19 racke Exp $
+# $Id: Matrix.pm,v 1.6 2003/12/04 03:52:18 mheins Exp $
 #
 # Copyright (C) 2002-2003 Mike Heins <mikeh at perusion.net>
 # Copyright (C) 2002-2003 Interchange Development Group <interchange at icdevgroup.org>
@@ -23,7 +23,7 @@
 
 package Vend::Options::Matrix;
 
-$VERSION = substr(q$Revision: 1.5 $, 10);
+$VERSION = substr(q$Revision: 1.6 $, 10);
 
 =head1 NAME
 
@@ -133,7 +133,30 @@
 	# Will be different based on whether separate or not....
 	my $rsort;
 
-	my $inv_func;
+    my $inv_func;
+    if($opt->{inventory}) {
+        my ($tab, $col) = split /:+/, $opt->{inventory};
+        MAKEFUNC: {
+            my $idb = dbref($tab)
+                or do {
+                    logError("Bad table %s for inventory function.", $tab);
+                    last MAKEFUNC;
+                };
+            $idb->test_column($col)
+                or do {
+                    logError(
+                        "Bad column %s in table %s for inventory function.",
+                        $col,
+                        $tab,
+                    );
+                    last MAKEFUNC;
+                };
+            $inv_func = sub {
+                my $key = shift;
+                return $idb->field($key, $col);
+            };
+        }
+    }
 
 	use constant SEP_CODE		=> 0;
 	use constant SEP_GROUP		=> 1;



1.4       +27 -2     interchange/lib/Vend/Options/Old48.pm


rev 1.4, prev_rev 1.3
Index: Old48.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Options/Old48.pm,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- Old48.pm	8 Sep 2003 12:25:18 -0000	1.3
+++ Old48.pm	4 Dec 2003 03:52:18 -0000	1.4
@@ -1,6 +1,6 @@
 # Vend::Options::Old48 - Interchange 4.8 compatible product options
 #
-# $Id: Old48.pm,v 1.3 2003/09/08 12:25:18 jon Exp $
+# $Id: Old48.pm,v 1.4 2003/12/04 03:52:18 mheins Exp $
 #
 # Copyright (C) 2002-2003 Mike Heins <mikeh at perusion.net>
 # Copyright (C) 2002-2003 Interchange Development Group <interchange at icdevgroup.org>
@@ -23,7 +23,7 @@
 
 package Vend::Options::Old48;
 
-$VERSION = substr(q$Revision: 1.3 $, 10);
+$VERSION = substr(q$Revision: 1.4 $, 10);
 
 =head1 NAME
 
@@ -130,6 +130,31 @@
 	my @out;
 	my $out;
 	
+    my $inv_func;
+    if($opt->{inventory}) {
+        my ($tab, $col) = split /:+/, $opt->{inventory};
+        MAKEFUNC: {
+            my $idb = dbref($tab)
+                or do {
+                    logError("Bad table %s for inventory function.", $tab);
+                    last MAKEFUNC;
+                };
+            $idb->test_column($col)
+                or do {
+                    logError(
+                        "Bad column %s in table %s for inventory function.",
+                        $col,
+                        $tab,
+                    );
+                    last MAKEFUNC;
+                };
+            $inv_func = sub {
+                my $key = shift;
+                return $idb->field($key, $col);
+            };
+        }
+    }
+
 	my $rsort = find_sort($opt, $db, $loc);
 
 	if($opt->{display_type} eq 'separate') {








More information about the interchange-cvs mailing list