public function deleteArtifactLinkReference($id)
 {
     $dao = new Tracker_FormElement_Field_Value_ArtifactLinkDao();
     return $dao->deleteReference($id);
 }
Пример #2
0
 protected function editOptions($request)
 {
     $old_item_name = $this->getItemName();
     $old_name = $this->getName();
     $this->name = trim($request->getValidated('name', 'string', ''));
     $this->description = trim($request->getValidated('description', 'text', ''));
     $this->color = trim($request->getValidated('tracker_color', 'string', ''));
     $this->item_name = trim($request->getValidated('item_name', 'string', ''));
     $this->allow_copy = $request->getValidated('allow_copy') ? 1 : 0;
     $this->enable_emailgateway = $request->getValidated('enable_emailgateway') ? 1 : 0;
     $this->submit_instructions = $request->getValidated('submit_instructions', 'text', '');
     $this->browse_instructions = $request->getValidated('browse_instructions', 'text', '');
     $this->instantiate_for_new_projects = $request->getValidated('instantiate_for_new_projects') ? 1 : 0;
     $this->log_priority_changes = $request->getValidated('log_priority_changes') ? 1 : 0;
     if (!$this->name || !$this->description || !$this->color || !$this->item_name) {
         $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('plugin_tracker_common_type', 'name_requ'));
     } else {
         if ($old_name != $this->name) {
             if (TrackerFactory::instance()->isNameExists($this->name, $this->group_id)) {
                 $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('plugin_tracker_common_type', 'name_already_exists', $this->name));
                 return false;
             }
         }
         if ($old_item_name != $this->item_name) {
             if (!$this->itemNameIsValid($this->item_name)) {
                 $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('plugin_tracker_common_type', 'invalid_shortname', $this->item_name, CODENDI_PURIFIER_CONVERT_HTML));
                 return false;
             }
             if (TrackerFactory::instance()->isShortNameExists($this->item_name, $this->group_id)) {
                 $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('plugin_tracker_common_type', 'shortname_already_exists', $this->item_name));
                 return false;
             }
             $reference_manager = ReferenceManager::instance();
             if (!$reference_manager->checkKeyword($this->item_name)) {
                 $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('plugin_tracker_common_type', 'invalid_shortname', $this->item_name, CODENDI_PURIFIER_CONVERT_HTML));
                 return false;
             }
             if ($reference_manager->_isKeywordExists($this->item_name, $this->group_id)) {
                 $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('plugin_tracker_common_type', 'shortname_already_exists', $this->item_name, CODENDI_PURIFIER_CONVERT_HTML));
                 return false;
             }
             //Update reference and cross references
             //WARNING this replace existing reference(s) so that all old_item_name reference won't be extracted anymore
             $reference_manager->updateProjectReferenceShortName($this->group_id, $old_item_name, $this->item_name);
             $artifact_link_value_dao = new Tracker_FormElement_Field_Value_ArtifactLinkDao();
             $artifact_link_value_dao->updateItemName($this->group_id, $old_item_name, $this->item_name);
         }
         $dao = new TrackerDao();
         if ($dao->save($this)) {
             $GLOBALS['Response']->addFeedback('info', $GLOBALS['Language']->getText('plugin_tracker_admin', 'successfully_updated'));
         } else {
             $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('global', 'error'));
         }
     }
 }