[ic] BUG -: possible bug in 4.6.1

Murray Gibbins Murray@scotweb.ltd.uk
Fri, 02 Feb 2001 10:22:44 +0000


In my basket page I'm doing this .....

------------------------------------------------------

[loop args="[scratch cart-loop]" prefix=what_the_hell]

[set what_the_hell-code][what_the_hell-code][/set]


[perl tables="[what_the_hell-code]_thekeys [what_the_hell-code]_fields
[what_the_hell-code]" global=1]

    my $debug  = 0;

# This code deals withthe problem of
# minvend giving the atributes of products
# incremental numericla "form-name" values
# This stops two products in two different
# carts having independant product atributes.

# To solve this the new form-names have the
# name of the cart prepended to it.

# This code then deals with the 
# parseing of this new form-name.
# It takes the values and puts them
# into the correct carts and products

my $cart = $Scratch->{'what_the_hell-code'};

(! defined $cart)?die"Undefined Cart":1;
(! $cart)?die"False Cart":1;



# now we need the mv_ip number

if(exists($Carts->{$cart}) && defined($Carts->{$cart}) ){
foreach my $product_hash_ref (@{$Carts->{$cart}}){
    
    (!defined $product_hash_ref)?die"no $cart \$product_hash_ref":1;

    my $db_cart_thekeys = $Db{$cart."_thekeys"};

    (!defined $db_cart_thekeys)?die"no $cart \$product_hash_ref
\$db_cart_thekeys":1;

    
	

    # we have the cart, so ..
    
    # now we now that if we have the choice 
    # a choice must be there.
    # This means that the procudt db must
    # have an entry for this field into
    # ohter wise we don't give a choice.
    
    my $product_db_ref = $Db{$cart} ;

    (!defined $product_db_ref)?die"\$product_db_ref not defined":1;

    foreach my  $key (split(/\s/,($db_cart_thekeys->field("fields","keys")))){ 

	if(! defined($cart)){
	  die"\$cart not defined\n";
        }
	if(! defined($key)){
	  die"\$key not defined\n";
        }
	
        my $cart_field = $cart."_fields" ;
        my $db_cart_field = $Db{$cart."_fields"};

	if(! defined($db_cart_field)){
	  my $str = "\$Db = \$Db\n";
	  $str .= "\$key = $key\n";
	  $str .= "\$cart_field = $cart_field\n";
	  $str .= "\$db_cart_field not defined\n";

	  die"$str";
        }

        if($db_cart_field->field($key,"basket")){
	    
	    # ok if we are here then we have an posible atribute
	    # of the product.
	    
	    if($db_cart_field->field($key,"choice")){
		
		# if we are here then we know that this sttribute
		# is one that can be posibly set for the product		
		
		# we have the cart, so ..
		
		if( (defined $product_db_ref->test_column($key)) && (defined
$product_db_ref->field($product_hash_ref->{code},$key)) &&
$product_db_ref->field($product_hash_ref->{code},$key) ){
		    
		    my $mv_ip = $product_hash_ref->{mv_ip} ;
		    
		    my $cgi_thing = $cart."_".$key.$mv_ip ;
		    
		    my $cgi_val = $CGI->{$cart."_".$key.$mv_ip} ; 
		    
		    if((defined $cgi_val) && ($cgi_val)){
			
			$product_hash_ref->{$key} = $cgi_val;
		    }
		    
		}
	    }
	}
	select(undef,undef,undef,0.0001);
	
    }
    
}
}



return ;
[/perl]
    
[/loop]

-----------------------------------------------------

When the catalog is visited the firts time after an interchange restart I get
this error .....

-----------------------------------------------------

193.195.20.134 XkP6udYz:193.195.20.134 - [02/February/2001:10:07:39 +0000] carn
/cgi-bin/carn/process Safe: $Db = $Db
> $key = description
> $cart_field = carn_fields
> $db_cart_field not defined
> 
> 
> 
>     my $debug  = 0;
> 
> # This code deals withthe problem of
> # minvend giving the atributes of products
> # incremental numericla "form-name" values
> # This stops two products in two different
> # carts having independant product atributes.
> 
> # To solve this the new form-names have the
> # name of the cart prepended to it.
> 
> # This code then deals with the 
> # parseing of this new form-name.
> # It takes the values and puts them
> # into the correct carts and products
> 
> my $cart = $Scratch->{'what_the_hell-code'};
> 
> (! defined $cart)?die"Undefined Cart":1;
> (! $cart)?die"False Cart":1;
> 
> 
> 
> # now we need the mv_ip number
> 
> if(exists($Carts->{$cart}) && defined($Carts->{$cart}) ){
> foreach my $product_hash_ref (@{$Carts->{$cart}}){
>     
>     (!defined $product_hash_ref)?die"no $cart \$product_hash_ref":1;
> 
>     my $db_cart_thekeys = $Db{$cart."_thekeys"};
> 
>     (!defined $db_cart_thekeys)?die"no $cart \$product_hash_ref \$db_cart_thekeys":1;
> 
>     
> 
> 
>     # we have the cart, so ..
>     
>     # now we now that if we have the choice 
>     # a choice must be there.
>     # This means that the procudt db must
>     # have an entry for this field into
>     # ohter wise we don't give a choice.
>     
>     my $product_db_ref = $Db{$cart} ;
> 
>     (!defined $product_db_ref)?die"\$product_db_ref not defined":1;
> 
>     foreach my  $key (split(/\s/,($db_cart_thekeys->field("fields","keys")))){ 
> 
>       if(! defined($cart)){
>         die"\$cart not defined\n";
>         }
>       if(! defined($key)){
>         die"\$key not defined\n";
>         }
> 
>         my $cart_field = $cart."_fields" ;
>         my $db_cart_field = $Db{$cart."_fields"};
> 
>       if(! defined($db_cart_field)){
>         my $str = "\$Db = \$Db\n";
>         $str .= "\$key = $key\n";
>         $str .= "\$cart_field = $cart_field\n";
>         $str .= "\$db_cart_field not defined\n";
> 
>         die"$str";
>         }
> 
>         if($db_cart_field->field($key,"basket")){
>           
>           # ok if we are here then we have an posible atribute
>           # of the product.
>           
>           if($db_cart_field->field($key,"choice")){
> 
>               # if we are here then we know that this sttribute
>               # is one that can be posibly set for the product
> 
>               # we have the cart, so ..
> 
>               if( (defined $product_db_ref->test_column($key)) && (defined $product_db_ref->field($product_hash_ref->{code},$key)) && $product_db_ref->field($product_hash_ref->{code},$key) ){
>                   
>                   my $mv_ip = $product_hash_ref->{mv_ip} ;
>                   
>                   my $cgi_thing = $cart."_".$key.$mv_ip ;
>                   
>                   my $cgi_val = $CGI->{$cart."_".$key.$mv_ip} ; 
>                   
>                   if((defined $cgi_val) && ($cgi_val)){
> 
>                       $product_hash_ref->{$key} = $cgi_val;
>                   }
>                   
>               }
>           }
>       }
>       select(undef,undef,undef,0.0001);
> 
>     }
>     
> }
> }
> 
> 
> 
> return ;
> 
> 

------------------------------------------------------

But if I change the start of my code to ...

-------------------------------------------------------

[loop args="[scratch cart-loop]" prefix=what_the_hell]

[set what_the_hell-code][what_the_hell-code][/set]

[comment] look up feilds data to pump the cache[/comment]

[set silly][data table="[what_the_hell-code]_fields" field="code"
key="description"][/set]
[perl]delete $Scratch->{silly}[/perl]

[perl tables="[what_the_hell-code]_thekeys [what_the_hell-code]_fields
[what_the_hell-code]" global=1]

.....

---------------------------------------------------------

I get no error messages.

Is this werid or what !!!!!

RH 7.0
Perl 5.6
Interchange rpm 4.6.1 (plus my diffs)
http://www.morpheux.org/interchange/patches/Interchange.4.6.1-1-murray.diff.gz

NB I had this problem before I patched Interchange!

section of my interchange.cfg ....

----------------------------------------------------------

DataBase        carn /var/lib/interchange/catalogs/carn/www/products/products.as
c     TAB
DataBase        carn              WRITE_CONTROL           1
DataBase        carn              READ_ONLY               1
DataBase        carn_company /var/lib/interchange/catalogs/carn/www/products/com
panyconfig.asc       TAB
DataBase        carn_company              WRITE_CONTROL           1
DataBase        carn_company              READ_ONLY               1
DataBase        carn_config /var/lib/interchange/catalogs/carn/www/products/conf
ig.asc       TAB
DataBase        carn_config              WRITE_CONTROL           1
DataBase        carn_config              READ_ONLY               1
DataBase        carn_thekeys /var/lib/interchange/catalogs/carn/www/products/key
s.asc       TAB
DataBase        carn_thekeys             WRITE_CONTROL           1
DataBase        carn_thekeys              READ_ONLY               1
DataBase        carn_currencies /var/lib/interchange/catalogs/carn/www/products/
currencies.asc       TAB
DataBase        carn_currencies             WRITE_CONTROL           1
DataBase        carn_currencies              READ_ONLY               1
DataBase        carn_fields  /var/lib/interchange/catalogs/carn/www/products/fie
lds.asc      TAB
DataBase        carn_fields           WRITE_CONTROL           1
DataBase        carn_fields             READ_ONLY               1
DataBase        carn_scotweb /var/lib/interchange/catalogs/carn/www/products/sco
tweb.asc     TAB
DataBase        carn_scotweb         WRITE_CONTROL           1
DataBase        carn_scotweb             READ_ONLY               1
Database        carn_locale  /var/lib/interchange/catalogs/carn/www/products/loc
ale.asc      TAB
DataBase        carn_locale       WRITE_CONTROL           1
DataBase        carn_locale            READ_ONLY               1

---------------------------------------------------------------------

-- 
  ____
  \__/    Murray Gibbins             murray@scotweb.ltd.uk
  /  \    Programmer
_ \__/ _  ================================================
\\ || //  Scotweb Limited,             info@scotweb.ltd.uk
 \\||//   13a Albert Terrace,    http://www.scotweb.ltd.uk
  \||/    Edinburgh EH10 5EA   Tel: +44 (0)  131 270 82 33
   ||     Scotland. Europe.    Fax: +44 (0) 7020  93 49 04