diff --git a/module/story/control.php b/module/story/control.php index 12715015a9..1ab6c8cbc0 100755 --- a/module/story/control.php +++ b/module/story/control.php @@ -877,7 +877,7 @@ class story extends control $story = $this->story->getById($storyID, 0, true); $this->commonAction($storyID); - if($story->status != 'draft' and $story->status != 'changing') unset($this->config->story->edit->requiredFields); + if($story->status != 'draft' and $story->status != 'changing') $this->config->story->edit->requiredFields = ''; if(!empty($_POST)) { diff --git a/module/story/model.php b/module/story/model.php index 33e7ffe586..49b2dab1ae 100644 --- a/module/story/model.php +++ b/module/story/model.php @@ -1136,7 +1136,7 @@ class storyModel extends model if(!empty($story->plan)) $this->action->create('productplan', $story->plan, 'linkstory', '', $storyID); } - $changed = $story->parent != $oldStory->parent; + $changed = (isset($story->parent) && $story->parent != $oldStory->parent); if($oldStory->parent > 0) { $oldParentStory = $this->dao->select('*')->from(TABLE_STORY)->where('id')->eq($oldStory->parent)->fetch(); @@ -1157,7 +1157,7 @@ class storyModel extends model } } - if($story->parent > 0) + if(isset($story->parent) && $story->parent > 0) { $parentStory = $this->dao->select('*')->from(TABLE_STORY)->where('id')->eq($story->parent)->fetch(); $this->dao->update(TABLE_STORY)->set('parent')->eq(-1)->where('id')->eq($story->parent)->exec(); @@ -1228,8 +1228,7 @@ class storyModel extends model if(in_array($changeStoryID, $removeStories)) { $linkStories = str_replace(",$storyID,", ',', ",$changeStory,"); - $linkStories = trim($linkStories, ','); - $this->dao->update(TABLE_STORY)->set($linkStoryField)->eq(implode(',', $linkStories))->where('id')->eq((int)$changeStoryID)->exec(); + $this->dao->update(TABLE_STORY)->set($linkStoryField)->eq(trim($linkStories, ','))->where('id')->eq((int)$changeStoryID)->exec(); } }