From 5795f3a7f944dff3fdd6d0de6a8f0a864e245670 Mon Sep 17 00:00:00 2001 From: liuyongkai Date: Thu, 22 Sep 2022 06:21:47 +0000 Subject: [PATCH] * Fix export excel bugs. --- module/port/model.php | 6 +++++- module/projectstory/control.php | 4 ++++ module/story/control.php | 14 ++++++++++++++ 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/module/port/model.php b/module/port/model.php index 635ec9507a..83a7ac5f2d 100644 --- a/module/port/model.php +++ b/module/port/model.php @@ -554,6 +554,10 @@ class portModel extends model if(!empty($pairs[0])) $valuePairs[$value[$pairs[0]]] = $value[$pairs[1]]; } $values = $valuePairs; + if(reset($values)) + { + if(current($values) or (current($values) == 0)) $values[0] = ''; + } } return $values; @@ -624,7 +628,7 @@ class portModel extends model } /* if value = 0 or value = 0000:00:00 set value = ''*/ - if(helper::isZeroDate($value)) + if(helper::isZeroDate($rows[$id]->$field)) { $rows[$id]->$field = ''; } diff --git a/module/projectstory/control.php b/module/projectstory/control.php index 6cf48eafe0..651cb073b7 100644 --- a/module/projectstory/control.php +++ b/module/projectstory/control.php @@ -37,6 +37,10 @@ class projectStory extends control public function story($projectID = 0, $productID = 0, $branch = 0, $browseType = '', $param = 0, $storyType = 'story', $orderBy = '', $recTotal = 0, $recPerPage = 20, $pageID = 1) { $this->products = $this->loadModel('product')->getProductPairsByProject($projectID); + + /* Set product list for export. */ + $this->session->set('exportProductList', $this->products); + if(empty($this->products)) return print($this->locate($this->createLink('product', 'showErrorNone', 'moduleName=project&activeMenu=story&projectID=' . $projectID))); echo $this->fetch('product', 'browse', "productID=$productID&branch=$branch&browseType=$browseType¶m=$param&storyType=$storyType&orderBy=$orderBy&recTotal=$recTotal&recPerPage=$recPerPage&pageID=$pageID&projectID=$projectID"); } diff --git a/module/story/control.php b/module/story/control.php index 4f2d88331f..3af6deb41d 100644 --- a/module/story/control.php +++ b/module/story/control.php @@ -2528,6 +2528,20 @@ class story extends control { $this->session->set('storyPortParams', array('productID' => $productID, 'executionID' => $executionID)); /* Create field lists. */ + if(!$productID) + { + $this->config->story->datatable->fieldList['branch']['dataSource'] = array('module' => 'branch', 'method' => 'getAllPairs', 'params' => 1); + $this->config->story->datatable->fieldList['module']['dataSource']['method'] = 'getAllModulePairs'; + $this->config->story->datatable->fieldList['module']['dataSource']['params'] = 'story'; + + $this->config->story->datatable->fieldList['project']['dataSource'] = array('module' => 'project', 'method' => 'getPairsByIdList', 'params' => $executionID); + $this->config->story->datatable->fieldList['execution']['dataSource'] = array('module' => 'execution', 'method' => 'getPairs', 'params' => $executionID); + + $productIdList = implode(',', array_flip($this->session->exportProductList)); + + $this->config->story->datatable->fieldList['plan']['dataSource'] = array('module' => 'productplan', 'method' => 'getPairs', 'params' => $productIdList); + } + $this->post->set('rows', $this->story->getExportStorys($executionID, $orderBy)); $this->fetch('port', 'export', 'model=story'); }