[ic] 'order has shipped' email problem

Aaron Hazelton interchange-users@interchange.redhat.com
Thu Mar 7 10:32:00 2002


Hi everybody, I did not find this issue on the list....

Email receipts of the order are going out fine.  When in the UI, and
using the 'order_status' page, if you select 'shipped' and then click
'Ship order and send email to customer if appropriate' it takes you to
the order page but does not say 'email sent to....' and the email is not
sent.  I have found the error but don't know much perl so im lost... 



12.219.213.169 GfBFwWa9:12.219.213.169 - [07/March/2002:09:10:01 +0000]
ffstore /cgi-bin/ffstore.cgi/ui.html Safe: There is no row with index ''
at /usr/local/interchange/lib/Vend/Table/Common.pm line 259.
> 
> 
> 		my $odb = $Db{orderline}
> 			or die "No orderline database!\n";
> 		my $tdb = $Db{transactions}
> 			or die "No transactions database!\n";
> 		my $udb = $Db{userdb}
> 			or die "No userdb database!\n";
> 
> 		my $on = $Scratch->{ship_notice_order_number} =
$CGI->{code};
> 		my $user       = $tdb->field($on, 'username');
> 		my $wants_copy = $udb->field($user, 'email_copy');
> #Log("Order number=$on username=$user wants=$wants_copy");
> 		delete $Scratch->{ship_notice_username};
> 		delete $Scratch->{ship_notice_email};
> 		if($wants_copy) {
> 			$Scratch->{ship_notice_username} = $user;
> 			$Scratch->{ship_notice_email} =
$udb->field($user, 'email')
> 				or delete
$Scratch->{ship_notice_username};
> 		}
> 
> 		if($CGI->{status} =~ /\d\d\d\d/) {
> 			$tdb->set_field($on, 'status', $CGI->{status});
> 		}
> 		else {
> 			$tdb->set_field($on, 'status', 'shipped');
> 		}
> 
> 		my @shiplines = grep /\S/, split /\0/,
$CGI->{lines_shipped};
> 		my $to_ship = scalar @shiplines;
> 
> 		my $count_q = "select * from orderline where
order_number = '$on'";
> 		my $lines_ary =  $odb->query($count_q);
> 		if(! $lines_ary) {
> 			$Scratch->{ui_message} = "No order lines for
order $on";
> 			return;
> 		}
> 		my $total_lines = scalar @$lines_ary;
> 
> 		my $odb_keypos = $odb->config('KEY_INDEX');
> 
> 		# See if some items have already shipped
> 		my %already;
> 		for(@$lines_ary) {
> 			my $code = $_->[$odb_keypos];
> 			my $status = $odb->field($code, 'status');
> 			if($status eq 'shipped') {
> 				$already{$code} = $code;
> 			}
> 		}
> 		
> 		my $ship_mesg;
> 		my $g_status;
> 		my %shipping;
> 
> 		@shipping = grep ! $already{$_}, @shipping;
> 		@shipping{@shiplines} = @shiplines;
> 
> 		if($total_lines == $to_ship) {
> 			$ship_mesg = "Order $on complete, $total_lines
lines set shipped.";
> 			$Scratch->{ship_notice_complete} = $ship_mesg;
> 			$g_status = 'shipped';
> 		}
> 		else {
> 			$ship_mesg = "Order $on partially shipped
($to_ship of $total_lines lines).";
> 			delete $Scratch->{ship_notice_complete};
> 			$g_status = 'partial';
> 		}
> 
> 		my $minor_mesg = '';
> 
> 		my $email_mesg = $Scratch->{ship_notice_username}
> 						? "Email copy sent to
$Scratch->{ship_notice_email}."
> 						: "No email copy sent as
per user preference.";
> 
> 		# Actually update the orderline database
> 		for(@$lines_ary) {
> 			my $code = $_->[$odb_keypos];
> 			next if $already{$code};
> 			my $status = $shipping{$code} ? 'shipped' :
'backorder';
> 			$odb->set_field($code, 'status', $status)
> 				or do {
> 					$Scratch->{ui_message} =
"Orderline $code ship status update failed.";
> 					return;
> 				};
> 
> 		}
> 
> 		for(keys %already) {
> 			$shipping{$_} = $_;
> 		}
> 
> 		my $total_shipped_now = scalar keys %shipping; 
> 
> 
> 		delete $Scratch->{ship_now_complete};
> 		if (
> 			$total_lines != scalar @shipping
> 				and

Thanks!

Sincerely,
Aaron Hazelton
>>Hazenet<<