|
@@ -407,24 +407,27 @@ if ($act == "postchk") {
|
|
|
if (isset($_POST['chkbox']) && isset($_POST['chkact'])) {
|
|
|
$chkact = $_POST['chkact'];
|
|
|
$ids = implode(',', array_map('intval', $_POST['chkbox']));
|
|
|
+ $count = count($_POST['chkbox']);
|
|
|
|
|
|
- // Check if this is an employee transfer action
|
|
|
+ // 检查是否为员工转让操作
|
|
|
if (substr($chkact, 0, 1) === 't') {
|
|
|
- // Extract employee ID from the chkact value
|
|
|
+ // 从chkact值中提取员工ID
|
|
|
$employeeId = (int)substr($chkact, 1);
|
|
|
|
|
|
- // Get the employee code for the transfer
|
|
|
- $stmt = $conn->prepare("SELECT em_code FROM employee WHERE id = ?");
|
|
|
+ // 获取员工代码和名称
|
|
|
+ $stmt = $conn->prepare("SELECT em_code, em_user FROM employee WHERE id = ?");
|
|
|
$stmt->bind_param("i", $employeeId);
|
|
|
$stmt->execute();
|
|
|
$result = $stmt->get_result();
|
|
|
$employeeCode = '';
|
|
|
+ $employeeName = '未知业务员';
|
|
|
if ($row = $result->fetch_assoc()) {
|
|
|
$employeeCode = $row['em_code'];
|
|
|
+ $employeeName = $row['em_user'];
|
|
|
}
|
|
|
$stmt->close();
|
|
|
|
|
|
- // Update customer records
|
|
|
+ // 更新客户记录
|
|
|
$sql = "UPDATE customer SET
|
|
|
cs_updatetime = NOW(),
|
|
|
cs_code = REPLACE(cs_code, '-', '/{$employeeCode}-'),
|
|
@@ -432,6 +435,11 @@ if ($act == "postchk") {
|
|
|
cs_chain = CONCAT(cs_chain, ',{$employeeId}')
|
|
|
WHERE id IN ({$ids})";
|
|
|
mysqli_query($conn, $sql);
|
|
|
+
|
|
|
+ // 记录操作日志
|
|
|
+ $action = "{$_SESSION['employee_name']} 批量转移{$count}个客户({$ids})给业务员【{$employeeName}】";
|
|
|
+ logAction($action);
|
|
|
+
|
|
|
} else {
|
|
|
switch($chkact) {
|
|
|
case "0":
|