add contract controller(s) changes
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace backend\models;
|
||||
|
||||
use common\components\Helper;
|
||||
use Yii;
|
||||
use yii\base\Model;
|
||||
use yii\data\ActiveDataProvider;
|
||||
@@ -15,6 +16,7 @@ class ContractSearch extends Contract
|
||||
{
|
||||
|
||||
public $customer_name;
|
||||
public $card_number;
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
@@ -23,7 +25,7 @@ class ContractSearch extends Contract
|
||||
{
|
||||
return [
|
||||
[['id_contract', 'id_customer', 'status', 'flag', 'part_paid', 'part_count', 'part_required', 'id_ticket_type'], 'integer'],
|
||||
[['customer_name' ], 'safe'],
|
||||
[['customer_name' ,'card_number'], 'safe'],
|
||||
];
|
||||
}
|
||||
|
||||
@@ -65,7 +67,8 @@ class ContractSearch extends Contract
|
||||
$query->from('contract');
|
||||
$query->innerJoin('user' ,'user.id = contract.id_user');
|
||||
$query->innerJoin('customer' ,'customer.id_customer = contract.id_customer');
|
||||
|
||||
$query->leftJoin('card as card' ,'card.id_card = customer.id_customer_card');
|
||||
|
||||
|
||||
$dataProvider = new ActiveDataProvider([
|
||||
'query' => $query,
|
||||
@@ -133,6 +136,9 @@ class ContractSearch extends Contract
|
||||
// $query->where('0=1');
|
||||
return $dataProvider;
|
||||
}
|
||||
if ( isset($this->card_number)){
|
||||
$this->card_number = Helper::fixAsciiChars($this->card_number);
|
||||
}
|
||||
|
||||
$query->andFilterWhere([
|
||||
'contract.id_contract' => $this->id_contract,
|
||||
@@ -147,6 +153,7 @@ class ContractSearch extends Contract
|
||||
'contract.created_at' => $this->created_at,
|
||||
'contract.updated_at' => $this->updated_at,
|
||||
'contract.id_ticket_type' => $this->id_ticket_type,
|
||||
'card.number' => $this->card_number,
|
||||
]);
|
||||
|
||||
$query->andFilterWhere(['like', 'customer.name', $this->customer_name]);
|
||||
|
||||
Reference in New Issue
Block a user