<?php
/*
 * @version			$Id: index.php 10381 2008-06-01 03:35:53Z $
 * @package			Carteasy
 * @copyright		Copyright (C) 2005 - 2011 Wlanium
 * @license			proprietary
 * @author			Thomas Bartelt
 * Carteasy is a web shop system
 */

class InvoiceStatus {

	protected function __construct() {}

	private function __clone() {}

	public static function get_all() {
		$db = Registry::get('base')->db;

		$sql = "SELECT *
				FROM invoice_status";

		$result = $db->query($sql);

		if ($result->num_rows > 0) {
			while ($obj = $result->fetch_object()) {
				$return[] = $obj;
			}

			return $return;
		}

		return false;
	}

	public static function get_name($id) {
		$db = Registry::get('base')->db;

		if (empty($id)) return false;
		
		$sql = "SELECT name FROM invoice_status WHERE id=$id";
		$result = $db->query($sql);

		if ($result->num_rows > 0) {
			$obj = $result->fetch_object();

			return $obj->name;
		}

		return false;
	} // end get_name

	public static function get_data($id) {
		$db = Registry::get('base')->db;

		$sql = "SELECT * FROM invoice_status WHERE id=$id";

		$result = $db->query($sql);

		if ($result->num_rows > 0) {
			return $result->fetch_object();
		}

		return false;
	} // end get_data

}

?>