diff --git a/module/story/control.php b/module/story/control.php index 447c18f1ed..8f5a2bcf9a 100644 --- a/module/story/control.php +++ b/module/story/control.php @@ -434,7 +434,6 @@ class story extends control $products = $this->product->getPairs(); $moduleOptionMenu = $this->tree->getOptionMenu($productID, $viewType = 'story', 0, $branch); - /* Init vars. */ $planID = $plan; $pri = 0; @@ -494,6 +493,7 @@ class story extends control $this->view->moduleID = $moduleID; $this->view->moduleOptionMenu = $moduleOptionMenu; $this->view->plans = $plans; + $this->view->users = $this->user->getPairs('pdfirst|noclosed|nodeleted'); $this->view->priList = $priList; $this->view->sourceList = $sourceList; $this->view->planID = $planID; diff --git a/module/story/model.php b/module/story/model.php index b66b21a9cf..aea0865847 100644 --- a/module/story/model.php +++ b/module/story/model.php @@ -353,6 +353,16 @@ class storyModel extends model */ public function batchCreate($productID = 0, $branch = 0, $type = 'story') { + foreach($_POST['needReview'] as $index => $value) + { + if(isset($_POST['reviewer'][$index])) $_POST['reviewer'][$index] = array_filter($_POST['reviewer'][$index]); + if($value and !isset($_POST['reviewer'][$index])) + { + dao::$errors[] = $this->lang->story->errorEmptyReviewedBy; + return false; + } + } + $this->loadModel('action'); $branch = (int)$branch; $productID = (int)$productID; @@ -489,6 +499,19 @@ class storyModel extends model $this->dao->insert(TABLE_STORYSPEC)->data($specData)->exec(); + /* Save the story reviewer to storyreview table. */ + if(isset($_POST['reviewer'][$i])) + { + foreach($_POST['reviewer'][$i] as $reviewer) + { + $reviewData = new stdclass(); + $reviewData->story = $storyID; + $reviewData->version = 1; + $reviewData->reviewer = $reviewer; + $this->dao->insert(TABLE_STORYREVIEW)->data($reviewData)->exec(); + } + } + $this->executeHooks($storyID); $actionID = $this->action->create('story', $storyID, 'Opened', ''); @@ -498,7 +521,6 @@ class storyModel extends model $mails[$i]->actionID = $actionID; } - /* Remove upload image file and session. */ if(!empty($stories->uploadImage) and $this->session->storyImagesFile) { diff --git a/module/story/view/batchcreate.html.php b/module/story/view/batchcreate.html.php index d75df5b695..b13d506ba4 100644 --- a/module/story/view/batchcreate.html.php +++ b/module/story/view/batchcreate.html.php @@ -57,6 +57,7 @@