/**
  * This function is overruning its original scope, but it seems logical
  * to put that functionality there.  
  * It finds equipment associated with the supplied ticket id, checks if this
  * ticket is the only one associated with the equipment and will reset
  * equipment status to its baseline.
  * 
  * @param int $ticket_id Ticket id to lookup
  * @param int $eq_id Optional, equipment id to ignore, if this id is 
  * associated with the ticket, it will not be reset.  This is used when
  * a ticket is updated and new status is selected for existing equipment. 
  * @param bool $force Whether to force status reset.  This is used when new
  * equipment is selected during ticket update.  If there is only one ticket
  * associated with this equipment, the equipment status will be reset.
  * @return void
  */
 public static function onCloseTicket($ticket_id, $eq_id = 0, $force = false)
 {
     $eq = self::findByTicket($ticket_id);
     if ($eq) {
         if ($eq->getId() == $eq_id) {
             return;
         }
         $open_tickets = self::getOpenTickets($eq->getId());
         $do_close = count($open_tickets) == 0;
         if (!$do_close) {
             $do_close = $force && count($open_tickets) == 1 && $open_tickets[0] == $ticket_id;
         }
         if ($do_close) {
             $b_status = Equipment_Status::getBaselineStatus();
             if ($b_status) {
                 $eq->setStatus_Id($b_status->getId());
                 $eq->save();
             }
         }
     }
 }