protected function sendMailToDiscardedBids($worklist_id) { // Get all bids marked as not accepted $query = "SELECT bids.email, u.nickname FROM " . BIDS . " as bids\n INNER JOIN " . USERS . " as u on (u.id = bids.bidder_id)\n WHERE bids.worklist_id={$worklist_id} AND bids.withdrawn = 0 AND bids.accepted = 0"; $result_query = mysql_query($query); $bids = array(); while ($row = mysql_fetch_assoc($result_query)) { $bids[] = $row; } $workitem = new WorkItem($worklist_id); $mechanic = $workitem->getMechanic()->getUsername(); foreach ($bids as $bid) { // Make sure the mechanic is not sent a discarded email if ($mechanic != $bid['email']) { Notification::workitemNotify(array('type' => 'bid_discarded', 'workitem' => $workitem, 'emails' => array($bid['email'])), array('who' => $bid['nickname'])); } } }