From 61b73009089ced10c5eb31801c9dc134234faed4 Mon Sep 17 00:00:00 2001 From: Paul Arthur Date: Tue, 2 Apr 2013 15:41:57 -0400 Subject: GH#4: Tagging artist incorrectly We should only look up by MBID if we actually have an MBID. Might fix this issue. --- lib/class/artist.class.php | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'lib/class') diff --git a/lib/class/artist.class.php b/lib/class/artist.class.php index b9523ef3..f99ed79b 100644 --- a/lib/class/artist.class.php +++ b/lib/class/artist.class.php @@ -296,14 +296,17 @@ class Artist extends database_object { $exists = false; - $sql = 'SELECT `id` FROM `artist` WHERE `mbid` = ?'; - $db_results = Dba::read($sql, array($mbid)); + if ($mbid) { + $sql = 'SELECT `id` FROM `artist` WHERE `mbid` = ?'; + $db_results = Dba::read($sql, array($mbid)); - if ($row = Dba::fetch_assoc($db_results)) { - $id = $row['id']; - $exists = true; + if ($row = Dba::fetch_assoc($db_results)) { + $id = $row['id']; + $exists = true; + } } - else { + + if (!$exists) { $sql = 'SELECT `id`, `mbid` FROM `artist` WHERE `name` LIKE ?'; $db_results = Dba::read($sql, array($name)); -- cgit