+sub check_customer {
+
+ @flds = qw(customer validfrom validto pricebreak customerprice pricegroup);
+ @a = ();
+ $count = 0;
+
+ map { $form->{"${_}_$form->{customer_rows}"} = $form->parse_amount(\%myconfig, $form->{"${_}_$form->{customer_rows}"}) } qw(customerprice pricebreak);
+
+ for $i (1 .. $form->{customer_rows} - 1) {
+
+ map { $form->{"${_}_$i"} = $form->parse_amount(\%myconfig, $form->{"${_}_$i"}) } qw(customerprice pricebreak);
+
+ if ($form->{"customerprice_$i"}) {
+ if ($form->{"pricebreak_$i"} || $form->{"customer_$i"} || $form->{"pricegroup_$i"}) {
+
+ push @a, {};
+ $j = $#a;
+ map { $a[$j]->{$_} = $form->{"${_}_$i"} } @flds;
+ $count++;
+
+ }
+ }
+ }
+
+ $i = $form->{customer_rows};
+
+ if (!$form->{selectcustomer}) {
+
+ if ($form->{"customer_$i"}) {
+ ($form->{customer}) = split /--/, $form->{"customer_$i"};
+
+ if (($j = $form->get_name(\%myconfig, customer)) > 1) {
+ &select_name(customer, $i);
+ exit;
+ }
+
+ if ($j == 1) {
+ # we got one name
+ $form->{"customer_$i"} = qq|$form->{name_list}[0]->{name}--$form->{name_list}[0]->{id}|;
+ } else {
+ # name is not on file
+ $form->error(qq|$form->{customer} : |.$locale->text('Customer not on file!'));
+ }
+ }
+ }
+
+ if ($form->{"customer_$i"} || $form->{"pricegroup_$i"} || ($form->{"customerprice_$i"} || $form->{"pricebreak_$i"})) {
+ push @a, {};
+ $j = $#a;
+ map { $a[$j]->{$_} = $form->{"${_}_$i"} } @flds;
+ $count++;
+ }
+
+ $form->redo_rows(\@flds, \@a, $count, $form->{customer_rows});
+ $form->{customer_rows} = $count;
+
+}
+
+
+
+sub select_name {
+ my ($table, $vr) = @_;
+
+ @column_index = qw(ndx name address);
+
+ $label = ucfirst $table;
+ $column_data{ndx} = qq|<th> </th>|;
+ $column_data{name} = qq|<th class=listheading>|.$locale->text($label).qq|</th>|;
+ $column_data{address} = qq|<th class=listheading>|.$locale->text('Address').qq|</th>|;
+
+ # list items with radio button on a form
+ $form->header;
+
+ $title = $locale->text('Select from one of the names below');
+
+ print qq|
+<body>
+
+<form method=post action="$form->{script}#end">
+
+<input type=hidden name=vr value=$vr>
+
+<table width=100%>
+ <tr>
+ <th class=listtop>$title</th>
+ </tr>
+ <tr space=5></tr>
+ <tr>
+ <td>
+ <table width=100%>
+ <tr class=listheading>|;