<?/*
Copyright (C) 2003 Media Net Link, Inc. Danville, CA 94526 USA

This file is part of AthenaRMS.

AthenaRMS is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

AthenaRMS is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/?>
<?php

##
## THIS WORKS WITH TICKET_STATUS NOT STATUS AS IT USED TO
##

require_once 'base_object.php';

class Status extends Base_Object {
  function Status () {
    global $dbi;
    $this->db = &$dbi;
  }

  function Add () {
    $h = $this->db->prepare ('
      insert into ticket_status (
        status,
        updated_by
      ) values (
        ?, ?
      )
    ');
    $res = $this->db->execute ($h, array(
      $this->status,
      $this->updated_by
    ));
    if (DB::isError($res)) {
       $this->error = $res->getMessage();
       return;
    }
  }

  function Delete () {
    $h = $this->db->prepare ('
      delete from ticket_status
       where status = ?
    ');
    $res = $this->db->execute ($h, array($this->status));
    if (DB::isError($res)) {
       $this->error = $res->getMessage();
       return;
    }
  }

  function &List_All () {
    $sql = '
      select status
        from ticket_status
    order by status
    ';
    $res = $this->db->getcol( $sql );
    if (DB::isError($res)) {
       $this->error = $res->getMessage();
       return;
    }

    if (count($res)) return $res;

    return array();
  }
}
?>
