[ic] [4.9.5] Question about lib/UI/pages/include/item_option_simple

Reid Sutherland interchange-users@icdevgroup.org
Tue Jan 14 14:08:01 2003


Hi everyone,

I have a question about the code in 
lib/UI/pages/include/item_option_simple.  This can apply to both 4.8.6 
and 4.9.5 (versions I'm running).

What does $v do?

...
[perl interpolate=1 tables="[cgi mv_data_table]"]
         my $db = $Db{[cgi mv_data_table]}
                 or return;
         my ($k,$v);
         $db->clone_row($CGI->{ui_clone_id}, $CGI->{sku});
         $db->clone_set('sku', $CGI->{ui_clone_id}, $CGI->{sku});
         return;
[/perl]
...


It seems to serve no purpose other then to stop the Options Editor from 
functioning properly.

..
             map {
                 my $default = 0;
                 s/[,\r\n]//g;
                 if(s/\*//g) { $default = 1; $hasdefault = 1; }

                 if($v) {
                     if(/=/) {
                         ($left,$right) = split('=',$_);
                     } else {
                         $right = $_;
                         $left = substr($right,0,3);
                     }

                     while($seen{$left}++) { $left++; }

                     $_ = join('=',$left,$right);
                     if($default) { $_ .= "*"; }
                 }
             } @value;
..

Anything below 'if ($v)' does not get executed which results in an 
option's default being lost, or not being set, when using the Options 
Editor.  Moving 'if($default) { $_ .= "*"; )' below the if block, solves 
this issue.

Also futher down there is this line:

$odb->set_field($key,'o_widget','select');

This will cause the widget style to be lost upon use of the Options 
Editor.  Removing this line solves this issue.


Any ideas?

-reid