Simplify code: use helper function that does same
This code was roughly duplicate of what _verifyRequestTypeId() was already doing.
This commit is contained in:
parent
453caf26bf
commit
b03a469338
1 changed files with 2 additions and 8 deletions
|
@ -963,14 +963,8 @@ sub _getOrCreateRequestType($$) {
|
||||||
$params->{requestTypeId} = $self->addRequestType($params->{requestType});
|
$params->{requestTypeId} = $self->addRequestType($params->{requestType});
|
||||||
} else {
|
} else {
|
||||||
my $id = $params->{requestTypeId};
|
my $id = $params->{requestTypeId};
|
||||||
die "_getOrCreateRequestType(): called with a non-numeric requestTypeId"
|
die "_getOrCreateRequestType(): invalid requestTypeId, \"$id\""
|
||||||
unless defined $id and looks_like_number($id);
|
unless $self->_verifyRequestTypeId($id);
|
||||||
|
|
||||||
my $val = $self->dbh()->selectall_hashref("SELECT id FROM request_type WHERE id = " .
|
|
||||||
$self->dbh->quote($id, 'SQL_INTEGER'), 'id');
|
|
||||||
|
|
||||||
die "_getOrCreateRequestType(): given requestTypeId, $id, is invalid"
|
|
||||||
unless (defined $val and defined $val->{$id});
|
|
||||||
}
|
}
|
||||||
delete $params->{requestType};
|
delete $params->{requestType};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue