<?php
require_once (PATH_TABLES . "activity/LocationTable.php") ;
require_once (PATH_MODELS . "base/MasterBase.php") ;

class LocationClass extends MasterBase {
	function __construct($db) {
		$this->db 		= $db ;
		$this->tbl 		= LocationTable::C_TABLE ;
		$this->fldid 	= LocationTable::C_ID ;
		$this->flddesc 	= LocationTable::C_DESC ;
		$this->fldorg 	= LocationTable::C_ORG_ID ;
	}
	function __destruct() {
	}


	function getLocationByCusId($id,$api=false){

		if ($api) {
             $sql = "SELECT ".$this->fldid.",".$this->flddesc." FROM " ;
        } else {
            $sql = "SELECT * FROM " ;
        }

        $sql .= LocationTable::C_TABLE . " WHERE " . LocationTable::C_CUSTOMER_ID . " = " . $id;
        
        $rows = $this->db->getTable($sql);
        
        if(!is_null($rows) && count($rows) > 0){
            return $rows;
        }
        
        return null;
    }
}
?>