Skip to content

Commit

Permalink
Improved customer admin
Browse files Browse the repository at this point in the history
  • Loading branch information
uldisn committed Apr 14, 2015
1 parent fae2786 commit 45d043c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
1 change: 0 additions & 1 deletion controllers/AdminController.php
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,6 @@ public function actionViewCustomer()
}
}

$model = $this->loadModel();
$this->render($view,array(
'model'=>$model,
));
Expand Down
20 changes: 12 additions & 8 deletions models/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ class User extends CActiveRecord
{
public $ccmp_id;
public $ccmp_name;
public $first_name;
public $last_name;

const STATUS_NOACTIVE=0;
const STATUS_ACTIVE=1;
Expand Down Expand Up @@ -263,7 +265,10 @@ public function searchCustomers()
{

$criteria=new CDbCriteria;
$criteria->select = 'id,username,email,create_at,lastvisit_at,status,ccmp_company.ccmp_name as ccmp_name';
$criteria->select = '
id,username,email,create_at,lastvisit_at,status,
ccmp_company.ccmp_name as ccmp_name';
//`p`.first_name p_first_name ,`p`.last_name ';
$criteria->compare('id',$this->id);
$criteria->compare('username',$this->username,true);
$criteria->compare('email',$this->email,true);
Expand All @@ -277,16 +282,15 @@ public function searchCustomers()
INNER JOIN AuthAssignment aa
ON user.id = aa.userid
AND itemname = '".Yii::app()->getModule('user')->customerUser['role']."'
INNER JOIN profiles
ON user.id = profiles.user_id
INNER JOIN profiles as p
ON user.id = p.user_id
INNER JOIN ccuc_user_company
ON profiles.person_id = ccuc_person_id
AND ccuc_status = '".CcucUserCompany::CCUC_STATUS_SYS."'
ON p.person_id = ccuc_person_id
AND ccuc_status = '".CcucUserCompany::CCUC_STATUS_PERSON."'
LEFT OUTER JOIN ccmp_company
ON profiles.ccmp_id = ccmp_company.ccmp_id
ON ccuc_ccmp_id = ccmp_company.ccmp_id
";
$criteria->compare('ccuc_ccmp_id', Yii::app()->sysCompany->getActiveCompany());
//$criteria->compare('ccuc_ccmp_id', Yii::app()->sysCompany->getActiveCompany());
}

return new CActiveDataProvider(get_class($this), array(
Expand Down

0 comments on commit 45d043c

Please sign in to comment.