|
|
@@ -126,7 +126,7 @@ class DeclarationForm extends Model
|
|
|
[['type','decLv','decWay','insertUserName',/* 'insertUserIdCard',*/'password','payPassword'], 'required'],
|
|
|
[['type'], 'isType', 'on'=>['userDec', 'canDec']],
|
|
|
[['insertUserName'], 'isCanAddUser'],
|
|
|
-// [['decUserName'], 'issetDec'],
|
|
|
+ [['decUserName'], 'issetDec'],
|
|
|
[['conUserName'], 'isConUserName'],
|
|
|
[['recUserName'], 'isRecUserName'],
|
|
|
[['location'], 'isLocation'],
|
|
|
@@ -180,7 +180,7 @@ class DeclarationForm extends Model
|
|
|
{
|
|
|
$parentScenarios = parent::scenarios();
|
|
|
$customScenarios = [
|
|
|
- 'userDec' => ['type','allData', 'decLv','decWay','insertUserName','password','payPassword', 'realName',/* 'insertUserIdCard',*/ 'mobile', 'address', 'openBank', 'bankAddress', 'bankNo', 'bankProvince','bankCity','bankCounty', 'consignee','acceptMobile','province',/*'city','county',*/ 'conUserName', 'recUserName',/*'decUserName',*/ 'location', 'email'],
|
|
|
+ 'userDec' => ['type','allData', 'decLv','decWay','insertUserName','password','payPassword', 'realName',/* 'insertUserIdCard',*/ 'mobile', 'address', 'openBank', 'bankAddress', 'bankNo', 'bankProvince','bankCity','bankCounty', 'consignee','acceptMobile','province',/*'city','county',*/ 'conUserName', 'recUserName','decUserName', 'location', 'email'],
|
|
|
'canDec' => ['type', 'insertUserName',/* 'insertUserIdCard',*/ 'conUserName', 'recUserName', 'location'],
|
|
|
'notFull' => ['type', 'insertUserName', 'conUserName', 'recUserName', 'location'],
|
|
|
];
|
|
|
@@ -192,26 +192,32 @@ class DeclarationForm extends Model
|
|
|
* @param $attribute
|
|
|
*/
|
|
|
public function issetDec($attribute){
|
|
|
- if (!$decUser = User::find()->select('ID')->where('IS_DEC=1 AND USER_NAME=:USER_NAME', [':USER_NAME' => $this->decUserName])->asArray()->one()) {
|
|
|
- $this->addError($attribute, Yii::t('app', 'stockistDoesNotExist'));
|
|
|
- return false;
|
|
|
+ if(!$this->decUserName){
|
|
|
+ $this->_decId = '';
|
|
|
} else {
|
|
|
- if ($this->decType !== 'ba') {
|
|
|
- // 判断报单中心是否在新加入会员的安置网上级中
|
|
|
- $this->loopFindParentToNetwork($this->insertUserName);
|
|
|
- //反转数组,in_array搜索错误
|
|
|
- //in_array($this->decUserName, $this->_tempNetworkParentUser[$this->insertUserName]);
|
|
|
- $flipParent = array_flip(array_filter($this->_tempNetworkParentUser[$this->insertUserName]));
|
|
|
+
|
|
|
+
|
|
|
+ if (!$decUser = User::find()->select('ID')->where('IS_DEC=1 AND USER_NAME=:USER_NAME', [':USER_NAME' => $this->decUserName])->asArray()->one()) {
|
|
|
+ $this->addError($attribute, Yii::t('app', 'stockistDoesNotExist'));
|
|
|
+ return false;
|
|
|
+ } else {
|
|
|
+ if ($this->decType !== 'ba') {
|
|
|
+ // 判断报单中心是否在新加入会员的安置网上级中
|
|
|
+ $this->loopFindParentToNetwork($this->insertUserName);
|
|
|
+ //反转数组,in_array搜索错误
|
|
|
+ //in_array($this->decUserName, $this->_tempNetworkParentUser[$this->insertUserName]);
|
|
|
+ $flipParent = array_flip(array_filter($this->_tempNetworkParentUser[$this->insertUserName]));
|
|
|
// var_dump($flipParent);
|
|
|
// echo $this->insertUserName.'=='.$this->decUserName;
|
|
|
// exit;
|
|
|
- if (!isset($flipParent[$this->decUserName])) {
|
|
|
- //$this->addError($attribute, '为' . $this->insertUserName . '报单,报单中心' . $this->decUserName . '不在' . $this->insertUserName . '的安置网上级中');
|
|
|
- $this->addError($attribute, 'To' . $this->insertUserName . 'Entry, Stockist' . $this->decUserName . 'not in exist' . $this->insertUserName . 'in the placement superiors');
|
|
|
- return ;
|
|
|
+ if (!isset($flipParent[$this->decUserName])) {
|
|
|
+ //$this->addError($attribute, '为' . $this->insertUserName . '报单,报单中心' . $this->decUserName . '不在' . $this->insertUserName . '的安置网上级中');
|
|
|
+ $this->addError($attribute, 'To' . $this->insertUserName . 'Entry, Stockist' . $this->decUserName . 'not in exist' . $this->insertUserName . 'in the placement superiors');
|
|
|
+ return;
|
|
|
+ }
|
|
|
}
|
|
|
+ $this->_decId = $decUser['ID'];
|
|
|
}
|
|
|
- $this->_decId = $decUser['ID'];
|
|
|
}
|
|
|
}
|
|
|
|