|
|
@@ -103,7 +103,8 @@ class ChangePerfForm extends Model {
|
|
|
$model = $this->_model = PerfAudit::findOne(['ID' => $this->id]);
|
|
|
$this->_userId = $model->USER_ID;
|
|
|
if ($model->AUDIT_STATUS > \Yii::$app->params['auditStatus']['un']['value']) {
|
|
|
- $this->addError($attribute, 'The application has been reviewed and cannot be reviewed again');// 该申请已经被审核,不能重复审核
|
|
|
+
|
|
|
+ $this->addError($attribute, \Yii::t('ctx', 'applicationCannotReviewedAgain'));// 该申请已经被审核,不能重复审核
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -116,10 +117,10 @@ class ChangePerfForm extends Model {
|
|
|
if ($this->_userId) {
|
|
|
// 如果该会员已经存在一个待审核的申请,直接提示错误
|
|
|
if (PerfAudit::find()->where('USER_ID=:USER_ID AND AUDIT_STATUS=:AUDIT_STATUS', [':USER_ID' => $this->_userId, ':AUDIT_STATUS' => \Yii::$app->params['auditStatus']['un']['value']])->exists()) {
|
|
|
- $this->addError($attribute, 'If there is a pending record in the member review list, it shall be submitted after the pending record has been reviewed'); // 该会员审核列表中如果有待审记录,需等待待审核记录审核后才可提交
|
|
|
+ $this->addError($attribute, \Yii::t('ctx', 'pendingRecordAfterThePendingReviewed')); // 该会员审核列表中如果有待审记录,需等待待审核记录审核后才可提交
|
|
|
}
|
|
|
} else {
|
|
|
- $this->addError($attribute, 'Member does not exist'); // 会员不存在
|
|
|
+ $this->addError($attribute, \Yii::t('ctx', 'memberDoesNotExist')); // 会员不存在
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -131,10 +132,11 @@ class ChangePerfForm extends Model {
|
|
|
$period = Period::instance();
|
|
|
if (!$period->isSent($this->periodNum)) {
|
|
|
// $this->addError($attribute, '该期【' . $this->periodNum . '】未挂网,无法调整');
|
|
|
- $this->addError($attribute, 'This period [' . $this->periodNum . '] is not connected to the net and cannot be adjusted');
|
|
|
+
|
|
|
+ $this->addError($attribute, \Yii::t('ctx', 'periodNotNetCannotAdjusted', ['periodNum' => $this->periodNum]));
|
|
|
}
|
|
|
if (Period::find()->where('IS_SENT=:IS_SENT AND PERIOD_NUM>=:START_PERIOD_NUM AND PERIOD_NUM<=:END_PERIOD_NUM', [':IS_SENT' => Period::SEND_FINISH, ':START_PERIOD_NUM' => $this->periodNum + 1, ':END_PERIOD_NUM' => $this->periodNum + 1])->count() == 1) {
|
|
|
- $this->addError($attribute, 'The next period [' . ($this->periodNum + 1) . '] has been connected to the net, and this period cannot be adjusted');
|
|
|
+ $this->addError($attribute, \Yii::t('ctx', 'nextPeriodConnectedNetCannotAdjusted', ['periodNum' => $this->periodNum+1]));
|
|
|
// $this->addError($attribute, '下一期【' . ($this->periodNum + 1) . '】已挂网,该期无法调整');
|
|
|
}
|
|
|
}
|
|
|
@@ -145,7 +147,8 @@ class ChangePerfForm extends Model {
|
|
|
*/
|
|
|
public function isPerfType($attribute) {
|
|
|
if (!in_array($this->perfType, array_keys(PerfAudit::CHANGE_PERF_TYPE))) {
|
|
|
- $this->addError($attribute, 'The adjustment type is incorrect'); // 调整类型不正确
|
|
|
+
|
|
|
+ $this->addError($attribute, \Yii::t('ctx', 'adjustmentTypeIncorrect')); // 调整类型不正确
|
|
|
}
|
|
|
$this->_periodNum = Period::sentMaxPeriodNum();
|
|
|
}
|
|
|
@@ -156,10 +159,10 @@ class ChangePerfForm extends Model {
|
|
|
*/
|
|
|
public function isLocation($attribute) {
|
|
|
if ($this->perfType==PerfAudit::PERF_TYPE_PV && !in_array($this->location, [1, 2, 3, 4, 5])) {
|
|
|
- $this->addError($attribute, 'Incorrect location'); // 区位不正确
|
|
|
+ $this->addError($attribute, \Yii::t('ctx', 'incorrectLocation')); // 区位不正确
|
|
|
}
|
|
|
if ($this->perfType==PerfAudit::PERF_TYPE_SURPLUS && !in_array($this->location, [1, 2, 3, 4, 5, 6])) {
|
|
|
- $this->addError($attribute, 'Incorrect location'); // 区位不正确
|
|
|
+ $this->addError($attribute, \Yii::t('ctx', 'incorrectLocation')); // 区位不正确
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -168,21 +171,21 @@ class ChangePerfForm extends Model {
|
|
|
* @param $attribute
|
|
|
*/
|
|
|
public function isAmount($attribute) {
|
|
|
- if ($this->amount == 0) $this->addError($attribute, 'The amount of change cannot be 0'); // 变动数额不能为0
|
|
|
+ if ($this->amount == 0) $this->addError($attribute, \Yii::t('ctx', 'amountChangeCannotZero')); // 变动数额不能为0
|
|
|
if ($this->perfType == PerfAudit::PERF_TYPE_PV) {
|
|
|
$userPerf = UserPerf::findOneAsArray('USER_ID=:USER_ID', [':USER_ID' => $this->_userId]);
|
|
|
if ($this->amount < 0 && (abs($this->amount) > $userPerf['PV_' . $this->location . 'L'])) {
|
|
|
- $this->addError('scenario', 'The member is underrepresented in that region'); // 该会员该区域的数额不足
|
|
|
+ $this->addError('scenario', \Yii::t('ctx', 'memberUnderrepresentedRegion')); // 该会员该区域的数额不足
|
|
|
}
|
|
|
} elseif ($this->perfType == PerfAudit::PERF_TYPE_SURPLUS) {
|
|
|
$perfPeriod = PerfPeriod::findOneAsArray('USER_ID=:USER_ID AND PERIOD_NUM=:PERIOD_NUM', [':USER_ID' => $this->_userId, ':PERIOD_NUM' => $this->_periodNum]);
|
|
|
if($this->location==6){
|
|
|
if ($this->amount < 0 && (abs($this->amount) > $perfPeriod['SURPLUS_LS'])) {
|
|
|
- $this->addError('scenario', 'The member has insufficient surplus in the region for the current period'); // 该会员当期该区域剩余数额不足
|
|
|
+ $this->addError('scenario', \Yii::t('ctx', 'memberSurplusRegionLess')); // 该会员当期该区域剩余数额不足
|
|
|
}
|
|
|
}else {
|
|
|
if ($this->amount < 0 && (abs($this->amount) > $perfPeriod['SURPLUS_' . $this->location . 'L'])) {
|
|
|
- $this->addError('scenario', 'The member has insufficient surplus in the region for the current period'); // 该会员当期该区域剩余数额不足
|
|
|
+ $this->addError('scenario', \Yii::t('ctx', 'memberSurplusRegionLess')); // 该会员当期该区域剩余数额不足
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -197,24 +200,24 @@ class ChangePerfForm extends Model {
|
|
|
$oneData = PerfAudit::findOneAsArray(['ID' => $this->id]);
|
|
|
switch ($this->auditStatus) {
|
|
|
case 'un':
|
|
|
- $this->addError($attribute, 'Cannot be set to pending review' . $this->auditStatus); // 不能设置为待审核状态
|
|
|
+ $this->addError($attribute, \Yii::t('ctx', 'cannotSetPendingReview') . $this->auditStatus); // 不能设置为待审核状态
|
|
|
break;
|
|
|
case 'true':
|
|
|
if ($oneData['AUDIT_STATUS'] == \Yii::$app->params['auditStatus']['true']['value']) {
|
|
|
- $this->addError($attribute, 'The audit has been approved and cannot be repeated'); // 已经审核通过不能重复审核
|
|
|
+ $this->addError($attribute, \Yii::t('ctx', 'auditCannotRepeated')); // 已经审核通过不能重复审核
|
|
|
} elseif ($oneData['AUDIT_STATUS'] == \Yii::$app->params['auditStatus']['reject']['value']) {
|
|
|
- $this->addError($attribute, 'It has been reviewed and rejected and cannot be reviewed again'); // 已经审核拒绝不能重复审核
|
|
|
+ $this->addError($attribute, \Yii::t('ctx', 'rejectedAuditCannotRepeated')); // 已经审核拒绝不能重复审核
|
|
|
}
|
|
|
break;
|
|
|
case 'reject':
|
|
|
if ($oneData['AUDIT_STATUS'] == \Yii::$app->params['auditStatus']['true']['value']) {
|
|
|
- $this->addError($attribute, 'The audit has been approved and cannot be repeated'); // 已经审核通过不能重复审核
|
|
|
+ $this->addError($attribute, \Yii::t('ctx', 'auditCannotRepeated')); // 已经审核通过不能重复审核
|
|
|
} elseif ($oneData['AUDIT_STATUS'] == \Yii::$app->params['auditStatus']['reject']['value']) {
|
|
|
- $this->addError($attribute, 'It has been reviewed and rejected and cannot be reviewed again'); // 已经审核拒绝不能重复审核
|
|
|
+ $this->addError($attribute, \Yii::t('ctx', 'rejectedAuditCannotRepeated')); // 已经审核拒绝不能重复审核
|
|
|
}
|
|
|
break;
|
|
|
default:
|
|
|
- $this->addError($attribute, '状态参数有误');
|
|
|
+ $this->addError($attribute, \Yii::t('ctx', 'statusParameterError'));
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -224,7 +227,7 @@ class ChangePerfForm extends Model {
|
|
|
*/
|
|
|
public function isSelected($attributes) {
|
|
|
if (!$this->selected) {
|
|
|
- $this->addError($attributes, 'A piece of data must be selected'); // 必须选择一条数据
|
|
|
+ $this->addError($attributes, \Yii::t('ctx', 'aPieceMustBeSelected')); // 必须选择一条数据
|
|
|
}
|
|
|
if (!is_array($this->selected)) {
|
|
|
$this->selected = [$this->selected];
|