[ic] [email-raw] during Perl loop

Aaron Rubin interchange-users@icdevgroup.org
Fri Oct 4 17:07:00 2002


Makes sense, Ed. I'm running Redhat 7.2, Perl 5.6.1, and problem seems
to be the same on IC 4.86 and 4.92

Code is

	[button form=batch bold=1 text="[L]Shipped[/L]"]
	mv_todo=back
	order=[cgi code]
	[tag flag write]orderhistory transactions[/tag]
	[perl tables="orderhistory transactions userdb tracknumbers
__UI_META_TABLE__" interpolate=1]
		my $tdb = $Db{transactions}
			or die "No transactions database!\n";
		my $hdb = $Db{orderhistory}
			or die "No orderhistory database!\n";
		my $udb = $Db{userdb}
			or die "No userdb database!\n";
		my $tndb = $Db{tracknumbers}
			or die "No tracknumbers database!\n";

my $number;
my $onumber;
my $sku;
my $upto;
my $t2;
while ($Scratch->{my_lines} > 0)
{

$upto = $Scratch->{my_lines};
my $xyz = "order_$upto";
my $oxyz = "order_$upto";
$number = $CGI->{$xyz};
my $ins;
my $lines_ary;
my $abc;
$abc = "packedby_$upto";
   my $lower=100;
   my $upper=200000;
   my $t2 = int(rand( $upper-$lower+1 ) ) + $lower;
if ($CGI->{$upto})
{



	$tdb->set_field($number, 'status', 'shipped');
		my $user       = $tdb->field($number, 'username');
		my $wants_copy = $udb->field($user, 'email_copy');
        my $tnumber = $tndb->field($number, 'tracknumber');
		delete $Scratch->{ship_notice_username};
		delete $Scratch->{ship_notice_email};



		if($wants_copy) {
					$Scratch->{ship_now_complete} =
'1';
			$Scratch->{ship_notice_username} = $user;
			$Scratch->{ship_notice_email} =
$tdb->field($number, 'email');
		}

my $ins = "insert into orderhistory
(code,order_number,information,updated_by,update_date) values
('$number-$t2','$number','Order shipped with track number <a
href=http://wwwapps.ups.com/etracking/tracking.cgi?tracknum=$tnumber
target=#top>$tnumber</a>. Packed by
$CGI->{$abc}','$CGI->{entered_by}','$CGI->{entered_date}')";
my $lines_ary =  $hdb->query($ins);


		[email-raw][include etc/ship_notice][/email-raw]

}
$Scratch->{my_lines}--;
}
		return;
		delete $Scratch->{ship_now_complete};
	[/perl]
	[/button]




In search-region I have 

  <input type="checkbox" name="[scratch my_lines]">
  <input name="packedby_[scratch my_lines]" SIZE=10>
  <input name="order_[scratch my_lines]" type=hidden value=[item-param
code]>




When more than one order is checked I get in the error logs
  Error saving matches:

and only one email is sent. Works as it should when there's just one
item checked.

Thanks.

aaron