From b03a469338e5cb8e26a202e80c8a89647578e8c6 Mon Sep 17 00:00:00 2001 From: "Bradley M. Kuhn" Date: Wed, 30 Dec 2015 03:33:36 -0800 Subject: [PATCH] Simplify code: use helper function that does same This code was roughly duplicate of what _verifyRequestTypeId() was already doing. --- Supporters/lib/Supporters.pm | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/Supporters/lib/Supporters.pm b/Supporters/lib/Supporters.pm index 151c192..6cd290c 100644 --- a/Supporters/lib/Supporters.pm +++ b/Supporters/lib/Supporters.pm @@ -963,14 +963,8 @@ sub _getOrCreateRequestType($$) { $params->{requestTypeId} = $self->addRequestType($params->{requestType}); } else { my $id = $params->{requestTypeId}; - die "_getOrCreateRequestType(): called with a non-numeric requestTypeId" - unless defined $id and looks_like_number($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}); + die "_getOrCreateRequestType(): invalid requestTypeId, \"$id\"" + unless $self->_verifyRequestTypeId($id); } delete $params->{requestType}; }