|
@@ -1331,7 +1331,7 @@ class Payment extends Base
|
|
|
$val = Validate::rule([
|
|
|
'payNo|对账编号' => 'require|max:255',
|
|
|
'invoiceType|发票类型' => 'require|in:' . implode(',', array_values($this->invName)),
|
|
|
- 'invoiceCode|发票代码' => 'invoiceCodeCallback',
|
|
|
+ 'invoiceCode|发票代码' => 'max:255|checkInvoiceCode:',
|
|
|
'invoiceNumber|发票号码' => 'require|max:255',
|
|
|
'inv_subtotal_amount|发票税前金额' => 'require|float|max:9999999.99',
|
|
|
'open_time|开票日期' => 'require|date',
|
|
@@ -1345,14 +1345,14 @@ class Payment extends Base
|
|
|
}
|
|
|
return true;
|
|
|
});
|
|
|
+ $val->extend('checkInvoiceCode', function ($val, $rule, $da) {
|
|
|
|
|
|
- $val->extend('invoiceCodeCallback', function ($val, $rule, $da) {
|
|
|
+ if (in_array($da['invoiceType'], ['special', 'normal', 'roll', 'special_electronic', 'electronic', 'toll'])) {
|
|
|
+ if (empty($val)) return '发票代码必填';
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ });
|
|
|
|
|
|
- if (in_array($da['invoiceType'], ['special', 'normal', 'roll', 'special_electronic', 'electronic', 'toll'])) {
|
|
|
- if (empty($val)) return '发票代码必填';
|
|
|
- }
|
|
|
- return true;
|
|
|
- });
|
|
|
|
|
|
//所有的payNo(对账编码)
|
|
|
$payNo = array_column($param['list'], 'payNo');
|