107
>CreateFromXML(ProjectPath().'forms/clients/LayoutOFormView_clients.xml');
$this->DataAlias="table_clients";
$this->SubTablesKeyId=0;
$this->Attributes=array();
$this->Record=new ODBObject("", $this, "MainDBConnection");
$this->Record->SelectQueryAlias="Select_table_clients";
$this->Record->UpdateQueryAlias="Update_table_clients";
$this->Record->InsertQueryAlias="Insert_table_clients";
$this->Assigner->Add($this->Edit_NAME, "NAME", $this->Label_NAME,
true);
$this->Assigner->Add($this->Edit_FULLNAME, "FULLNAME", $this-
>Label_FULLNAME, true);
$this->Assigner->Add($this->ListBox_ID_TYPE, "ID_TYPE");
$this->Assigner->Add($this->TextArea_ADDRESS, "ADDRESS");
$this->Assigner->Add($this->Edit_PHONE, "PHONE");
$this->Assigner->Add($this->Edit_EMAIL, "EMAIL");
$this->Assigner->Add($this->Edit_WEBSITE, "WEBSITE");
$this->Assigner->Add($this->TextArea_NOTICE, "NOTICE");
}
protected function AfterAssign()
{
parent::AfterAssign();
if($this->Edit_FULLNAME->Value!="")
{
$this->Title=$this->Edit_FULLNAME->Value;
}
Fill_ListBox($this->ListBox_ID_TYPE, "table_client_types", "ID",
"NAME");
$this->FormClientEmployees->Work($this->GetCurrentRecordId());
$this->FormClientHistory->Work($this->GetCurrentRecordId());
$this->FormClientPlans->Work($this->GetCurrentRecordId());
$this->FormClientProjects->Work($this->GetCurrentRecordId());
$this->FormClientBranchs->Work($this->GetCurrentRecordId());
$this->FormClientHeads->Work($this->GetCurrentRecordId());
if($this->GetCurrentRecordId()<=0)
{
$this->ListBox_ID_TYPE->Value=4;
}
$this->LoadClientAttributes();
}
protected function LoadClientAttributes()
{
$query="SELECT cp.ID, cp.NAME FROM table_client_params cp
LEFT JOIN table_cp_relation cpr ON cpr.ID_PARAM=cp.ID
WHERE cpr.ID_CLIENT='".$this->GetCurrentRecordId()."'";
$ds=new ODBDataSet("", $this, GetConnection("MainDBConnection"));
$ds->Open($query);
for($i=0; $i<$ds->RowCount; $i++)