|
|
@@ -4099,6 +4099,9 @@ class Procuremen extends Backend
|
|
|
$r['is_void'] = is_array($r) && $this->isPurchaseOrderDetailVoid($r);
|
|
|
$r['is_picked'] = is_array($r) && ProcuremenStatus::isPodPicked($r['status'] ?? '');
|
|
|
$r['oper_time_text'] = $this->resolveDetailSupplierOperTime($r);
|
|
|
+ if (is_array($r)) {
|
|
|
+ $r = $this->maskSupplierContactFields($r);
|
|
|
+ }
|
|
|
}
|
|
|
unset($r);
|
|
|
|
|
|
@@ -4142,7 +4145,7 @@ class Procuremen extends Backend
|
|
|
$this->view->assign('processDisplayRows', $quoteView['process_rows']);
|
|
|
$this->view->assign('processCount', count($mergeRows));
|
|
|
$this->view->assign('detailRows', $details);
|
|
|
- $this->view->assign('supplierQuoteGroups', $quoteView['supplier_groups']);
|
|
|
+ $this->view->assign('supplierQuoteGroups', $this->maskSupplierContactList($quoteView['supplier_groups']));
|
|
|
$this->view->assign('orderQuoteTotalText', $quoteView['order_total_text']);
|
|
|
$this->view->assign('orderQuoteTotalHas', $quoteView['order_total_has']);
|
|
|
$this->view->assign('selectedQuoteCompany', $quoteView['selected_company']);
|
|
|
@@ -4289,6 +4292,148 @@ class Procuremen extends Backend
|
|
|
return $out;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 供应商联系信息脱敏(仅用于页面展示 / 只读接口响应)
|
|
|
+ */
|
|
|
+ protected function maskSupplierContactFields(array $item): array
|
|
|
+ {
|
|
|
+ if (array_key_exists('email', $item)) {
|
|
|
+ $item['email'] = mask_email((string)$item['email']);
|
|
|
+ }
|
|
|
+ if (array_key_exists('phone', $item)) {
|
|
|
+ $item['phone'] = mask_phone((string)$item['phone']);
|
|
|
+ }
|
|
|
+
|
|
|
+ return $item;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @param array<int, array<string, mixed>> $list
|
|
|
+ * @return array<int, array<string, mixed>>
|
|
|
+ */
|
|
|
+ protected function maskSupplierContactList(array $list): array
|
|
|
+ {
|
|
|
+ $out = [];
|
|
|
+ foreach ($list as $item) {
|
|
|
+ $out[] = is_array($item) ? $this->maskSupplierContactFields($item) : $item;
|
|
|
+ }
|
|
|
+
|
|
|
+ return $out;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 从 customer 表行构建下发用供应商联系信息(含明文邮箱/手机,仅服务端使用)
|
|
|
+ *
|
|
|
+ * @return array<string, string>|null
|
|
|
+ */
|
|
|
+ protected function buildCustomerContactPayloadFromRow($row): ?array
|
|
|
+ {
|
|
|
+ if (!is_array($row)) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ $norm = [];
|
|
|
+ foreach ($row as $k => $v) {
|
|
|
+ $norm[is_string($k) ? strtolower($k) : $k] = $v;
|
|
|
+ }
|
|
|
+ $row = $norm;
|
|
|
+
|
|
|
+ $st = $row['status'] ?? '';
|
|
|
+ if ($st !== '' && $st !== null && $st !== 1 && $st !== '1') {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ $companyName = '';
|
|
|
+ foreach (['company_name', 'name'] as $nk) {
|
|
|
+ if (!empty($row[$nk])) {
|
|
|
+ $companyName = trim((string)$row[$nk]);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if ($companyName === '') {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ $username = '';
|
|
|
+ foreach (['username', 'contact', 'linkman', 'contacts'] as $uk) {
|
|
|
+ if (isset($row[$uk]) && trim((string)$row[$uk]) !== '') {
|
|
|
+ $username = trim((string)$row[$uk]);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ $email = isset($row['email']) ? trim((string)$row['email']) : '';
|
|
|
+ $phone = isset($row['phone']) ? trim((string)$row['phone']) : '';
|
|
|
+ if ($phone === '' && isset($row['account'])) {
|
|
|
+ $phone = trim((string)$row['account']);
|
|
|
+ }
|
|
|
+ if ($phone === '' && isset($row['mobile'])) {
|
|
|
+ $phone = trim((string)$row['mobile']);
|
|
|
+ }
|
|
|
+ if ($email === '' && $phone === '') {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ $category = '';
|
|
|
+ foreach (['company_type', 'category', 'type_name'] as $ck) {
|
|
|
+ if (isset($row[$ck]) && trim((string)$row[$ck]) !== '') {
|
|
|
+ $category = trim((string)$row[$ck]);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return [
|
|
|
+ 'id' => isset($row['id']) ? (string)$row['id'] : '',
|
|
|
+ 'name' => $companyName,
|
|
|
+ 'company_name' => $companyName,
|
|
|
+ 'username' => $username,
|
|
|
+ 'email' => $email,
|
|
|
+ 'phone' => $phone,
|
|
|
+ 'category' => $category,
|
|
|
+ 'company_type' => $category,
|
|
|
+ ];
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 按 customer.id 解析供应商联系信息(服务端下发/通知用)
|
|
|
+ */
|
|
|
+ protected function resolveCustomerContactById(string $id): ?array
|
|
|
+ {
|
|
|
+ $id = trim($id);
|
|
|
+ if ($id === '' || !ctype_digit($id)) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ $row = Db::table('customer')->where('id', (int)$id)->find();
|
|
|
+ } catch (\Throwable $e) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ return $this->buildCustomerContactPayloadFromRow($row);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 按供应商名称解析联系信息(兼容旧提交数据)
|
|
|
+ */
|
|
|
+ protected function resolveCustomerContactByCompanyName(string $name): ?array
|
|
|
+ {
|
|
|
+ $name = trim($name);
|
|
|
+ if ($name === '') {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ $row = Db::table('customer')
|
|
|
+ ->where(function ($q) use ($name) {
|
|
|
+ $q->where('company_name', $name)->whereOr('name', $name);
|
|
|
+ })
|
|
|
+ ->order('id', 'desc')
|
|
|
+ ->find();
|
|
|
+ } catch (\Throwable $e) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ return $this->buildCustomerContactPayloadFromRow($row);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 规范化下发/确认时勾选的供应商
|
|
|
*
|
|
|
@@ -4302,18 +4447,19 @@ class Procuremen extends Backend
|
|
|
if (!is_array($c)) {
|
|
|
continue;
|
|
|
}
|
|
|
+ $resolved = null;
|
|
|
+ $cid = trim((string)($c['id'] ?? ''));
|
|
|
+ if ($cid !== '') {
|
|
|
+ $resolved = $this->resolveCustomerContactById($cid);
|
|
|
+ }
|
|
|
$name = trim((string)($c['name'] ?? $c['company_name'] ?? ''));
|
|
|
- if ($name === '') {
|
|
|
+ if ($resolved === null && $name !== '') {
|
|
|
+ $resolved = $this->resolveCustomerContactByCompanyName($name);
|
|
|
+ }
|
|
|
+ if ($resolved === null) {
|
|
|
continue;
|
|
|
}
|
|
|
- $out[] = [
|
|
|
- 'name' => $name,
|
|
|
- 'company_name' => $name,
|
|
|
- 'username' => trim((string)($c['username'] ?? '')),
|
|
|
- 'email' => trim((string)($c['email'] ?? '')),
|
|
|
- 'phone' => trim((string)($c['phone'] ?? '')),
|
|
|
- 'company_type' => trim((string)($c['company_type'] ?? $c['category'] ?? '')),
|
|
|
- ];
|
|
|
+ $out[] = $resolved;
|
|
|
}
|
|
|
|
|
|
return $out;
|
|
|
@@ -6360,8 +6506,8 @@ class Procuremen extends Backend
|
|
|
$this->view->assign('processRows', $mergeRows);
|
|
|
$this->view->assign('processDisplayRows', $this->buildAuditProcessDisplayRows($mergeRows));
|
|
|
$this->view->assign('processCount', count($mergeRows));
|
|
|
- $this->view->assign('quoteGroups', $quoteGroups);
|
|
|
- $this->view->assign('quoteGroupsJson', json_encode($quoteGroups, JSON_UNESCAPED_UNICODE));
|
|
|
+ $this->view->assign('quoteGroups', $this->maskSupplierContactList($quoteGroups));
|
|
|
+ $this->view->assign('quoteGroupsJson', json_encode($this->maskSupplierContactList($quoteGroups), JSON_UNESCAPED_UNICODE));
|
|
|
$this->view->assign('pickedCompanyName', $pickedName);
|
|
|
$this->view->assign('sysRq', $this->formatProcuremenSysRqForInput($po['sys_rq'] ?? null));
|
|
|
$this->view->assign('quoteDeadlineReached', $this->isProcuremenQuoteDeadlineReached($this->resolveBundleSysRq($bundle)) ? 1 : 0);
|
|
|
@@ -6925,45 +7071,11 @@ class Procuremen extends Backend
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
- $id = isset($row['id']) ? (string)$row['id'] : '';
|
|
|
-
|
|
|
- $companyName = '';
|
|
|
- foreach (['company_name', 'name'] as $nk) {
|
|
|
- if (!empty($row[$nk])) {
|
|
|
- $companyName = trim((string)$row[$nk]);
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- $username = '';
|
|
|
- foreach (['username', 'contact', 'linkman', 'contacts'] as $uk) {
|
|
|
- if (isset($row[$uk]) && trim((string)$row[$uk]) !== '') {
|
|
|
- $username = trim((string)$row[$uk]);
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- $email = isset($row['email']) ? trim((string)$row['email']) : '';
|
|
|
- $phone = isset($row['phone']) ? trim((string)$row['phone']) : '';
|
|
|
- if ($phone === '' && isset($row['account'])) {
|
|
|
- $phone = trim((string)$row['account']);
|
|
|
- }
|
|
|
- if ($phone === '' && isset($row['mobile'])) {
|
|
|
- $phone = trim((string)$row['mobile']);
|
|
|
- }
|
|
|
- /* 邮箱、手机号均为空则无法发短信/邮件,不在下发弹窗展示 */
|
|
|
- if ($email === '' && $phone === '') {
|
|
|
+ $payload = $this->buildCustomerContactPayloadFromRow($row);
|
|
|
+ if ($payload === null) {
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
- $category = '';
|
|
|
- foreach (['company_type', 'category', 'type_name'] as $ck) {
|
|
|
- if (isset($row[$ck]) && trim((string)$row[$ck]) !== '') {
|
|
|
- $category = trim((string)$row[$ck]);
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
$detail = '';
|
|
|
foreach ($detailColCandidates as $dk) {
|
|
|
if (!isset($row[$dk])) {
|
|
|
@@ -6976,17 +7088,8 @@ class Procuremen extends Backend
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- $list[] = [
|
|
|
- 'id' => $id,
|
|
|
- 'name' => $companyName,
|
|
|
- 'company_name' => $companyName,
|
|
|
- 'username' => $username,
|
|
|
- 'email' => $email,
|
|
|
- 'phone' => $phone,
|
|
|
- 'category' => $category,
|
|
|
- 'company_type' => $category,
|
|
|
- 'detail' => $detail,
|
|
|
- ];
|
|
|
+ $payload['detail'] = $detail;
|
|
|
+ $list[] = $this->maskSupplierContactFields($payload);
|
|
|
}
|
|
|
|
|
|
$this->success('', '', $list);
|
|
|
@@ -7099,6 +7202,9 @@ class Procuremen extends Backend
|
|
|
} else {
|
|
|
$r['createtime_text'] = '';
|
|
|
}
|
|
|
+ if (is_array($r)) {
|
|
|
+ $r = $this->maskSupplierContactFields($r);
|
|
|
+ }
|
|
|
}
|
|
|
unset($r);
|
|
|
|
|
|
@@ -7126,7 +7232,7 @@ class Procuremen extends Backend
|
|
|
$this->view->assign('confirmProcessCount', $confirmProcessCount);
|
|
|
$this->view->assign('orderCcydh', $confirmBundle['ccydh'] ?? '');
|
|
|
$this->view->assign('processDisplayRows', $processDisplayRows);
|
|
|
- $this->view->assign('confirmPickGroups', $confirmPickGroups);
|
|
|
+ $this->view->assign('confirmPickGroups', $this->maskSupplierContactList($confirmPickGroups));
|
|
|
$this->view->assign('confirmPickCount', count($confirmPickGroups));
|
|
|
$this->view->assign('pickedCompanyName', $pickedCompanyName);
|
|
|
$sysRqDisplay = '—';
|