From ccf5e9433148bd3c7051d6ff8c91a8dbdb3b0712 Mon Sep 17 00:00:00 2001 From: hufangzhou Date: Thu, 13 Jun 2024 15:50:18 +0800 Subject: [PATCH] * [bug#44143,done,0.8h] To re-record taskQueryCondition for export multiple tasks. --- module/execution/model.php | 2 ++ module/transfer/model.php | 11 ++++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/module/execution/model.php b/module/execution/model.php index 16a5799a60..adf93c2142 100755 --- a/module/execution/model.php +++ b/module/execution/model.php @@ -3736,6 +3736,8 @@ class executionModel extends model preg_match("/`assignedTo`\s+(([^']*) ('([^']*)'))/", $condition, $matches); $condition = preg_replace('/`(\w+)`/', 't1.`$1`', $condition); $condition = str_replace("t1.$matches[0]", "(t1.$matches[0] or (t1.mode = 'multi' and t2.`account` $matches[1] and t1.status != 'closed' and t2.status != 'done') )", $condition); + + $this->session->set('taskQueryCondition', $condition, $this->app->tab); } $sql = $this->dao->select('t1.id')->from(TABLE_TASK)->alias('t1'); diff --git a/module/transfer/model.php b/module/transfer/model.php index 7be1c1a270..dcde29eae1 100644 --- a/module/transfer/model.php +++ b/module/transfer/model.php @@ -653,9 +653,14 @@ class transferModel extends model { if($module == 'story') $queryCondition = str_replace('`story`', '`id`', $queryCondition); - $table = zget($this->config->objectTables, $module); //获取对应的表 - $moduleDatas = $this->dao->select('*')->from($table)->alias('t1') - ->where($queryCondition) + $table = zget($this->config->objectTables, $module); //获取对应的表 + $sql = $this->dao->select('*')->from($table)->alias('t1'); + if($module == 'task' && strpos($queryCondition, '`assignedTo`') !== false) + { + preg_match("/`assignedTo`\s+(([^']*) ('([^']*)'))/", $queryCondition, $matches); + $sql = $sql->leftJoin(TABLE_TASKTEAM)->alias('t2')->on("t2.task = t1.id and t2.account $matches[1]"); + } + $moduleDatas = $sql->where($queryCondition) ->beginIF($this->post->exportType == 'selected')->andWhere('t1.id')->in($checkedItem)->fi() ->fetchAll('id'); }