예제 #1
0
 public function removeArtifactFromSource(PFUser $user, array $add)
 {
     $to_add = array();
     foreach ($add as $move) {
         if (!isset($move['id']) || !is_int($move['id'])) {
             throw new RestException(400, "invalid value specified for `id`. Expected: integer");
         }
         if (isset($move['remove_from']) && !is_int($move['remove_from'])) {
             throw new RestException(400, "invalid value specified for `remove_from`. Expected: integer");
         }
         $to_add[] = $move['id'];
         if (isset($move['remove_from'])) {
             $from_artifact = $this->getArtifact($move['remove_from']);
             $this->artifactlink_updater->updateArtifactLinks($user, $from_artifact, array(), array($move['id']));
         }
     }
     return $to_add;
 }
 public function put(PFUser $user, Project $project, array $ids)
 {
     $this->checkIfUserCanChangePrioritiesInMilestone($user, $project);
     $this->validateArtifactIdsAreInUnassignedTopBacklog($ids, $user, $project);
     try {
         $this->artifactlink_updater->setOrderWithHistoryChangeLogging($ids, self::TOP_BACKLOG_IDENTIFIER, $project->getId());
     } catch (ItemListedTwiceException $exception) {
         throw new RestException(400, $exception->getMessage());
     }
     $this->sendAllowHeaders();
 }
예제 #3
0
 private function addMissingElementsToBacklog(Planning_Milestone $milestone, PFUser $user, array $to_add)
 {
     if (count($to_add) > 0) {
         $this->artifactlink_updater->updateArtifactLinks($user, $milestone->getArtifact(), $to_add, array());
     }
 }
 public function appendElementToMilestoneBacklog($linked_artifact_id, PFUser $current_user, Planning_Milestone $milestone)
 {
     $linked_artifact_ids = $this->artifactlink_updater->getElementsAlreadyLinkedToArtifact($milestone->getArtifact(), $current_user);
     array_push($linked_artifact_ids, $linked_artifact_id);
     $this->updateMilestoneContent(array_unique($linked_artifact_ids), $current_user, $milestone);
 }