diff --git a/module/product/control.php b/module/product/control.php index 0adc83f41a..718c723ae7 100644 --- a/module/product/control.php +++ b/module/product/control.php @@ -1078,7 +1078,7 @@ class product extends control public function ajaxGetPlans($productID, $branch = 0, $planID = 0, $fieldID = '', $needCreate = false, $expired = '', $param = '') { $param = strtolower($param); - if(strpos($param, 'getpairsforstory') === false) + if(strpos($param, 'forstory') === false) { $plans = $this->loadModel('productplan')->getPairs($productID, $branch, $expired, strpos($param, 'skipparent') !== false); } diff --git a/module/story/js/create.js b/module/story/js/create.js index eab048da18..795572a81c 100644 --- a/module/story/js/create.js +++ b/module/story/js/create.js @@ -238,7 +238,7 @@ function loadPlanForSiblings(productID, branch, branchIndex) { /* Load plan */ if(branch == '0') branch = ''; - planLink = createLink('product', 'ajaxGetPlans', 'productID=' + productID + '&branch=' + branch + '&planID=0&fieldID=' + branchIndex + '&needCreate=false&expired=unexpired¶m=skipParent|getpairsforstory,' + config.currentMethod); + planLink = createLink('product', 'ajaxGetPlans', 'productID=' + productID + '&branch=' + branch + '&planID=0&fieldID=' + branchIndex + '&needCreate=false&expired=unexpired¶m=skipParent|forStory,' + config.currentMethod); if(branchIndex > 0) { var $planIdBox = $('.addBranchesBox'+ branchIndex +' #planIdBox'); diff --git a/module/story/model.php b/module/story/model.php index f3ec4081a3..8a74d4ee84 100644 --- a/module/story/model.php +++ b/module/story/model.php @@ -2533,11 +2533,13 @@ class storyModel extends model $allChanges[$storyID] = common::createChanges($oldStory, $story); } + if($ignoreStories) { $ignoreStories = trim($ignoreStories, ','); echo js::alert(sprintf($this->lang->story->ignoreClosedStory, $ignoreStories)); } + return $allChanges; } @@ -6131,7 +6133,16 @@ class storyModel extends model /* Get related objects title or names. */ $relatedSpecs = $this->dao->select('*')->from(TABLE_STORYSPEC)->where('`story`')->in($storyIdList)->orderBy('version desc')->fetchGroup('story'); + + $fileIdList = array(); + foreach($relatedSpecs as $relatedSpec) + { + if(!empty($relatedSpec[0]->files)) $fileIdList[] = $relatedSpec[0]->files; + } + $fileIdList = array_unique($fileIdList); $relatedFiles = $this->dao->select('id, objectID, pathname, title')->from(TABLE_FILE)->where('objectType')->eq('story')->andWhere('objectID')->in($storyIdList)->andWhere('extra')->ne('editor')->fetchGroup('objectID'); + $filesInfo = $this->dao->select('id, objectID, pathname, title')->from(TABLE_FILE)->where('id')->in($fileIdList)->andWhere('extra')->ne('editor')->fetchAll('id'); + foreach($stories as $story) { $story->spec = ''; @@ -6142,6 +6153,11 @@ class storyModel extends model $story->title = $storySpec->title; $story->spec = $storySpec->spec; $story->verify = $storySpec->verify; + + if(!empty($storySpec->files) and empty($relatedFiles[$story->id]) and !empty($filesInfo[$storySpec->files])) + { + $relatedFiles[$story->id][0] = $filesInfo[$storySpec->files]; + } } if($this->post->fileType == 'csv')