[interchange-cvs] interchange - heins modified lib/Vend/Data.pm
interchange-cvs at icdevgroup.org
interchange-cvs at icdevgroup.org
Sat Dec 16 10:59:05 EST 2006
User: heins
Date: 2006-12-16 15:59:05 GMT
Modified: lib/Vend Data.pm
Log:
* Fix attribute-based pricing for options.
* Add ability to set price to zero with mv_price by checking for "FREE" value.
Previously, the zero is returned and ignored for price chain purposes.
* Allow setting of values in data to "undef" in field by setting
<input type="hidden" name="mv_data_undef:field" value="1">
Revision Changes Path
2.60 +11 -2 interchange/lib/Vend/Data.pm
rev 2.60, prev_rev 2.59
Index: Data.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Data.pm,v
retrieving revision 2.59
retrieving revision 2.60
diff -u -r2.59 -r2.60
--- Data.pm 9 Aug 2006 13:56:16 -0000 2.59
+++ Data.pm 16 Dec 2006 15:59:05 -0000 2.60
@@ -1,6 +1,6 @@
# Vend::Data - Interchange databases
#
-# $Id: Data.pm,v 2.59 2006/08/09 13:56:16 racke Exp $
+# $Id: Data.pm,v 2.60 2006/12/16 15:59:05 mheins Exp $
#
# Copyright (C) 2002-2006 Interchange Development Group
# Copyright (C) 1996-2002 Red Hat, Inc.
@@ -1439,6 +1439,10 @@
my $mod = $1;
if($mod =~ s/^\$(\d|$)/$1/) {
$price = $item->{mv_price} || $mod;
+ if($price =~ /^\s*free\s*$/i) {
+ $final = 0;
+ last CHAIN;
+ }
redo CHAIN;
}
elsif($mod =~ /^(\w*):([^:]*)(?::(\S*))?$/) {
@@ -1560,7 +1564,7 @@
elsif ($mod =~ s/^=([\d.]*)=([^=]+)//) {
$final += $1 if $1;
my ($attribute, $table, $field, $key) = split /:/, $2;
- if($item->{$attribute}) {
+ if($attribute) {
$key = $field ? $item->{$attribute} : $item->{code}
unless $key;
$price = database_field( ( $table ||
@@ -2241,6 +2245,11 @@
#::logDebug("storing d=$d $field blob_only=$CGI::values{mv_blob_only}");
($d, $f) = set_db($base_db, $field);
#::logDebug("storing table=$table d=$d f=$f key=$key");
+
+ if(! $value and ! length($value)) {
+ $value = $CGI::values{"mv_data_undef:$field"} ? undef : '';
+ }
+
if(! defined $qd->{$d}) {
$qd->{$d} = $d;
$qf->{$d} = [$f];
More information about the interchange-cvs
mailing list