diff --git a/module/action/model.php b/module/action/model.php index f4bbbc23a4..92d3ef5127 100755 --- a/module/action/model.php +++ b/module/action/model.php @@ -649,11 +649,17 @@ class actionModel extends model $action->extra = sprintf($this->lang->execution->action->extra, '' . join(', ', $linkedProducts) . ''); } } - elseif($objectType == 'demand' && $actionName == 'retracted') + elseif($objectType == 'demand' && in_array($actionName, array('retracted', 'restored'))) { $story = $this->loadModel('story')->getById($action->extra); - $action->extra = "#{$action->extra} {$this->lang->story->title} " . html::a(helper::createLink('story', 'view', "storyID=$story->id"), "$story->title"); + if($story) $action->extra = common::hasPriv('story', 'view') ? "#{$action->extra} {$this->lang->story->title} " . html::a(helper::createLink('story', 'view', "storyID=$story->id"), "$story->title") : "#$action->extra " . $demand->title; } + elseif($objectType == 'story' && $actionName == 'distributed') + { + $demand = $this->loadModel('demand')->getById($action->extra); + if($demand) $action->extra = common::hasPriv('demand', 'view') ? html::a(helper::createLink('demand', 'view', "demandID=$action->extra"), "#$action->extra " . $demand->title) : "#$action->extra " . $demand->title; + } + $action->history = isset($histories[$actionID]) ? $histories[$actionID] : array(); $actionName = strtolower($action->action); diff --git a/module/story/model.php b/module/story/model.php index 4efb3691d5..e5e1a78e03 100644 --- a/module/story/model.php +++ b/module/story/model.php @@ -2749,6 +2749,9 @@ class storyModel extends model ->add('reviewedDate', '0000-00-00') ->add('duplicateStory', 0) ->add('childStories', '') + ->add('retractedReason', '') + ->add('retractedBy', '') + ->add('retractedDate', NULL) ->setDefault('lastEditedBy', $this->app->user->account) ->setDefault('lastEditedDate', $now) ->setDefault('assignedDate', $now) @@ -2788,6 +2791,13 @@ class storyModel extends model $changes = common::createChanges($oldStory, $story); if(!empty($oldStory->twins)) $this->syncTwins($storyID, $oldStory->twins, $changes, 'Activated'); + + if($this->config->edition == 'ipd' and $oldStory->demand) + { + $this->loadModel('demand')->changeDemandStatus($oldStory->demand, '0', true); + $this->loadModel('action')->create('demand', $oldStory->demand, 'restored', '', $storyID); + } + return $changes; }