예제 #1
0
 /**
  * Update card content
  *
  * Things to take into account:
  * <ol>
  *  <li>You will get an error (400) if there are no changes in submitted document</li>
  *  <li>You can re-use the same document provided by /milestones/:id/cardwall cards
  *      section. Even if it contains more data. The extra data/info will be ignored</li>
  *  <li>You don't need to set all 'values' of the card, you can restrict to the modified ones</li>
  *  <li>If the card embbed in 'values' a field that correspond to 'label' or 'column_id'
  *      (ie. that might happens if the status is displayed on the card). The data submitted
  *      in 'values' section will override whatever was set in 'label' or 'column_id'</li>
  * </ol>
  *
  * @url PUT {id}
  * @param string $id        Id of the card (format: planningId_artifactId, @see milestones/:id/cardwall)
  * @param string $label     Label of the card {@from body}
  * @param array  $values    Card's fields values {@from body}
  * @param int    $column_id Where the card should stands {@from body}
  *
  */
 protected function putId($id, $label, array $values, $column_id = null)
 {
     try {
         $current_user = $this->user_manager->getCurrentUser();
         $single_card = $this->getSingleCard($current_user, $id);
         $card_updater = new CardUpdater();
         $card_updater->updateCard($current_user, $single_card, $label, $values, $column_id);
     } catch (Tracker_FormElement_InvalidFieldException $exception) {
         throw new RestException(400, $exception->getMessage());
     } catch (Tracker_Exception $exception) {
         if ($GLOBALS['Response']->feedbackHasErrors()) {
             throw new RestException(400, $GLOBALS['Response']->getRawFeedback());
         }
         throw new RestException(400, $exception->getMessage());
     }
     Header::allowOptionsPut();
 }