- $type = CGI::escapeHTML($type);
- $dbh->begin_work;
- my $deflog = '';
- my $settype = $dbh->prepare(q{UPDATE incomings SET shiptype = ? WHERE inc = ?});
- while (my $inc = $fleets->fetchrow_hashref){
- $call //= $inc->{call};
- if ($inc->{eta} < 0){
- $c->reply("This call is old. Did you use the call id instead of inc id by"
- ." accident? You can use .settypeall callid to set the type on all incs"
- ." in a call. Or use webbie if you really want to update this old call.");
+ $type = CGI::escapeHTML($type);
+ $dbh->begin_work;
+ my $deflog = '';
+ my $settype = $dbh->prepare(q{UPDATE incomings SET shiptype = ? WHERE inc = ?});
+ while (my $inc = $fleets->fetchrow_hashref){
+ $call //= $inc->{call};
+ if ($inc->{eta} < 0){
+ $c->reply("This call is old. Did you use the call id instead of inc id by"
+ ." accident? You can use .settypeall callid to set the type on all incs"
+ ." in a call. Or use webbie if you really want to update this old call.");
+ $dbh->rollback;
+ return;
+ }
+ $settype->execute($type,$inc->{inc});
+ $deflog .= "Set fleet: [B]$inc->{inc} [/B] to: [B]$type [/B]\n";
+ $c->reply("Set fleet $inc->{inc} from $inc->{coords} on call $call to $type (previously $inc->{shiptype})");
+ }
+ if ($fleets->rows == 0){
+ $c->reply("No matching fleets");