<?php
require_once(PATH_TABLES . "customer/CustomerPolicyTable.php");
require_once(PATH_MODELS . "base/MasterBase.php");

class CustomerPolicyClass extends MasterBase
{
    function __construct($db)
    {
        $this->db       = $db;
        $this->tbl      = CustomerPolicyTable::C_TABLE;
        $this->fldid2   = CustomerPolicyTable::C_ID;
        $this->fldid    = CustomerPolicyTable::C_POLICY_ID;
    }
    function __destruct()
    {
    }

    function getCustomerPolicy($id){
        $sql = "Select * FROM " . CustomerPolicyTable::C_TABLE . " WHERE " . CustomerPolicyTable::C_ID . " = " . $id;

        $rows = $this->db->getTable($sql);

        if(!is_null($rows) && count($rows) > 0){
            return $rows;
        }

        return null;
    }

    function updateCustomerPolicy($id, $desc){
        $sql = "UPDATE " . CustomerPolicyTable::C_TABLE . " SET " . CustomerPolicyTable::C_DESC . " = '" . $desc . "' WHERE " . CustomerPolicyTable::C_POLICY_ID . " = " . $id;

        $this->db->executeSql($sql);
    }
}
