From 2eacd5271e1bf8d3f471f42f76e09b66059c80fe Mon Sep 17 00:00:00 2001 From: tanghucheng Date: Mon, 25 Jul 2022 08:10:22 +0800 Subject: [PATCH] * Code for port. --- module/port/control.php | 15 ++++++++++----- module/port/model.php | 4 ++-- module/story/control.php | 2 +- module/task/config.php | 4 +++- 4 files changed, 16 insertions(+), 9 deletions(-) diff --git a/module/port/control.php b/module/port/control.php index 969e2ce2d1..c0e28ee02e 100644 --- a/module/port/control.php +++ b/module/port/control.php @@ -10,11 +10,11 @@ class port extends control * @access public * @return void */ - public function export($model = '', $params = '', $rows = array()) + public function export($model = '') { if($_POST) { - $this->port->export($model, $params, $rows); + $this->port->export($model); $this->fetch('file', 'export2' . $_POST['fileType'], $_POST); } } @@ -75,11 +75,16 @@ class port extends control { if($_FILES) { - $file = $this->loadModel('file')->getUpload('file'); - $file = $file[0]; + $file = $this->loadModel('file')->getUpload('file'); + $file = $file[0]; + $shortName = $this->file->getSaveName($file['pathname']); + if(empty($shortName)) + { + die(js::alert($this->lang->excel->emptyFileName)); + } $extension = $file['extension']; - $fileName = $this->file->savePath . $this->file->getSaveName($file['pathname']); + $fileName = $this->file->savePath . $shortName; move_uploaded_file($file['tmpname'], $fileName); $phpExcel = $this->app->loadClass('phpexcel'); diff --git a/module/port/model.php b/module/port/model.php index 5557fd1398..166325f7fc 100644 --- a/module/port/model.php +++ b/module/port/model.php @@ -1075,14 +1075,14 @@ class portModel extends model } $table = zget($this->config->objectTables, $model); - $this->dao->insert($table)->data($data)->autoCheck()->checkFlow()->exec(); + $this->dao->replace($table)->data($data)->autoCheck()->checkFlow()->exec(); $objectID = $this->dao->lastInsertID(); if(dao::isError()) die(js::error(dao::getError())); if(!empty($subDatas)) $this->saveSubTable($objectID, $subDatas); /* Create action*/ - $this->loadModel('action')->create($model, $objectID, 'Opened', ''); + if($this->post->insert) $this->loadModel('action')->create($model, $objectID, 'Opened', ''); } if($this->post->isEndPage) diff --git a/module/story/control.php b/module/story/control.php index 8252aaace1..c11cb56806 100644 --- a/module/story/control.php +++ b/module/story/control.php @@ -2714,7 +2714,7 @@ class story extends control } $this->view->fileName = $fileName; - $this->view->allExportFields = $this->config->story->list->exportFields; + $this->view->allExportFields = $this->config->story->exportFields; $this->view->customExport = true; $this->display(); } diff --git a/module/task/config.php b/module/task/config.php index 3a374318a8..fc8e4850bd 100644 --- a/module/task/config.php +++ b/module/task/config.php @@ -51,11 +51,13 @@ $config->task->fieldList['mode']['control'] = 'hidden'; $config->task->fieldList['desc']['control'] = 'textarea'; +$config->task->fieldList['assignedTo']['title'] = 'assignTo'; $config->task->fieldList['assignedTo']['control'] = 'select'; $config->task->fieldList['assignedTo']['dataSource'] = array('module' => 'user', 'method' => 'getTeamMemberPairs', 'params' => '$executionID&execution'); -$config->task->fieldList['assignedTo']['title'] = 'assignTo'; + $config->task->fieldList['estStarted']['control'] = 'date'; + $config->task->fieldList['deadline']['control'] = 'date'; $config->task->fieldList['closedReason']['dataSource'] = array('lang' => 'reasonList');