Skip to content

Commit

Permalink
add email for redmine 3 with mysql
Browse files Browse the repository at this point in the history
  • Loading branch information
mipxtx committed Apr 8, 2016
1 parent bfeea1c commit 5d963ef
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/RedmineApi/MysqlClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,13 @@ public function request(array $ids, $table, $field = "id") {

$map = array_map(function ($i) { return is_int($i) ? $i : "'$i'";}, $ids);

$sql = "SELECT * FROM {$table} WHERE {$field} IN (" . implode(",", $map) . ")";
if ($table == 'users') {
$from = "users as t left join email_addresses e on e.user_id=t.id";
} else {
$from = "{$table} as t";
}

$sql = "SELECT * FROM {$from} WHERE t.{$field} IN (" . implode(",", $map) . ")";

$result = $this->getConnect()->query($sql);
if (!$result) {
Expand Down

0 comments on commit 5d963ef

Please sign in to comment.