From 9133cf61b6ef9c1aebd4889644db51643d2beca5 Mon Sep 17 00:00:00 2001 From: wangyuting Date: Thu, 20 Mar 2025 17:07:30 +0800 Subject: [PATCH] * [bug#60654,done,1h,0h] Fix import jira data error. --- module/convert/model.php | 4 ++-- module/convert/tao.php | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/module/convert/model.php b/module/convert/model.php index cffc6f1eb5..6d6850cab8 100644 --- a/module/convert/model.php +++ b/module/convert/model.php @@ -252,7 +252,7 @@ class convertModel extends model if(!empty($desc)) $value['description'] = $desc; if(!empty($summary)) $value['summary'] = $summary; if(!empty($body)) $value['body'] = $body; - $dataID = !empty($value['id']) ? $value['id'] : $key; + $dataID = !empty($value['id']) ? $value['id'] : ($key + 1); $data = array_merge($data, $value); } else @@ -260,7 +260,7 @@ class convertModel extends model $data = array_merge($data, array($k => $value)); } } - $dataList[$dataID] = $data; + if(!empty($dataID)) $dataList[$dataID] = $data; } else { diff --git a/module/convert/tao.php b/module/convert/tao.php index f6b46c3e8d..25bdb723d5 100644 --- a/module/convert/tao.php +++ b/module/convert/tao.php @@ -1055,6 +1055,9 @@ class convertTao extends convertModel $fileName = $fileAttachment->filename; list($mime, $extension) = explode('/', $fileAttachment->mimetype); + $jiraFile = $this->app->getTmpRoot() . 'attachments/' . $filePaths[$issueID] . $fileID; + if(!is_file($jiraFile)) continue; + $file = new stdclass(); $file->pathname = $this->file->setPathName((int)$fileID, $extension); $file->title = str_ireplace(".{$extension}", '', $fileName); @@ -1067,10 +1070,8 @@ class convertTao extends convertModel $file->addedDate = !empty($fileAttachment->created) ? substr($fileAttachment->created, 0, 19) : null; $this->dao->dbh($this->dbh)->insert(TABLE_FILE)->data($file)->exec(); - $jiraFile = $this->app->getTmpRoot() . 'attachments/' . $filePaths[$issueID] . $fileID; - if(is_file($jiraFile)) copy($jiraFile, $this->file->savePath . $file->pathname); - $fileID = $this->dao->dbh($this->dbh)->lastInsertID(); + copy($jiraFile, $this->file->savePath . $file->pathname); if(in_array($file->objectType, array('epic', 'requirement', 'story'))) {