Пример #1
0
 }
 // First check parameters
 // CC
 $add_cc = $request->get('add_cc');
 $array_add_cc = split('[,;]', $add_cc);
 if ($add_cc && !util_validateCCList($array_add_cc, $message)) {
     exit_error($Language->getText('tracker_index', 'cc_list_invalid'), $message);
 }
 // Files
 if (isset($_FILES['input_file']['error']) && $_FILES['input_file']['error'] != UPLOAD_ERR_NO_FILE && !util_check_fileupload($_FILES['input_file']['tmp_name'])) {
     exit_error($Language->getText('global', 'error'), $Language->getText('tracker_index', 'invalid_filename'));
 }
 //Check Field Dependencies
 require_once 'common/tracker/ArtifactRulesManager.class.php';
 $arm = new ArtifactRulesManager();
 if (!$arm->validate($atid, $art_field_fact->extractFieldList(), $art_field_fact)) {
     exit_error($Language->getText('global', 'error'), $Language->getText('tracker_index', 'invalid_field_dependency'));
 }
 //data control layer
 $canned_response = $request->get('canned_response');
 $changed = $ah->handleUpdate($request->get('artifact_id_dependent'), $canned_response, $changes);
 if (!$changed) {
     $GLOBALS['Response']->redirect('?group_id=' . (int) $group_id . '&atid=' . (int) $atid . '&func=browse');
     exit;
 }
 //
 //  Attach file to this Artifact.
 //
 if (isset($_FILES['input_file']['error']) && $_FILES['input_file']['error'] != UPLOAD_ERR_NO_FILE) {
     $afh = new ArtifactFileHtml($ah);
     if (!$afh || !is_object($afh)) {
Пример #2
0
 /**
  * updateArtifact - update the artifact $artifact_id in tracker $group_artifact_id of the project $group_id with given values
  *
  * @param string $sessionKey the session hash associated with the session opened by the person who calls the service
  * @param int $group_id the ID of the group we want to update the artifact
  * @param int $group_artifact_id the ID of the tracker we want to update the artifact
  * @param int $artifact_id the ID of the artifact we want to update
  * @param int $status_id the ID of the status of the artifact
  * @param int $close_date the close date of the artifact. The date format is timestamp
  * @param string $summary the summary of the artifact
  * @param string $details the details (original submission) of the artifact
  * @param int $severity the severity of the artifact
  * @param array{SOAPArtifactFieldValue} $extra_fields the extra_fields of the artifact (non standard fields)
  * @return int the ID of the artifact, 
  *              or a soap fault if :
  *              - group_id does not match with a valid project, 
  *              - group_artifact_id does not match with a valid tracker,
  *              - artifact_id does not match with a valid artifact,
  *              - the given values are breaking a field dependency rule
  *              - the artifact modification failed.
  */
 function updateArtifact($sessionKey, $group_id, $group_artifact_id, $artifact_id, $status_id, $close_date, $summary, $details, $severity, $extra_fields)
 {
     global $art_field_fact, $ath;
     if (session_continue($sessionKey)) {
         try {
             $pm = ProjectManager::instance();
             $grp = $pm->getGroupByIdForSoap($group_id, 'updateArtifact');
         } catch (SoapFault $e) {
             return $e;
         }
         $ath = new ArtifactType($grp, $group_artifact_id);
         if (!$ath || !is_object($ath)) {
             return new SoapFault(get_artifact_type_fault, 'ArtifactType could not be created', 'updateArtifact');
         }
         if ($ath->isError()) {
             return new SoapFault(get_artifact_type_fault, $ath->getErrorMessage(), 'updateArtifact');
         }
         // Check if this tracker is valid (not deleted)
         if (!$ath->isValid()) {
             return new SoapFault(get_artifact_type_fault, 'This tracker is no longer valid.', 'updateArtifact');
         }
         $art_field_fact = new ArtifactFieldFactory($ath);
         if (!$art_field_fact || !is_object($art_field_fact)) {
             return new SoapFault(get_artifact_field_factory_fault, 'Could Not Get ArtifactFieldFactory', 'updateArtifact');
         } elseif ($art_field_fact->isError()) {
             return new SoapFault(get_artifact_field_factory_fault, $art_field_fact->getErrorMessage(), 'updateArtifact');
         }
         $a = new Artifact($ath, $artifact_id);
         if (!$a || !is_object($a)) {
             return new SoapFault(get_artifact_fault, 'Could Not Get Artifact', 'updateArtifact');
         } elseif ($a->isError()) {
             return new SoapFault(get_artifact_fault, $a->getErrorMessage(), 'updateArtifact');
         }
         $data = setArtifactData($status_id, $close_date, $summary, $details, $severity, $extra_fields);
         //Check Field Dependencies
         require_once 'common/tracker/ArtifactRulesManager.class.php';
         $arm = new ArtifactRulesManager();
         if (!$arm->validate($ath->getID(), $data, $art_field_fact)) {
             return new SoapFault(invalid_field_dependency_fault, 'Invalid Field Dependency', 'updateArtifact');
         }
         if (!$a->handleUpdate($artifact_id_dependent, $canned_response, $changes, false, $data, true)) {
             return new SoapFault(update_artifact_fault, $a->getErrorMessage(), 'updateArtifact');
         } else {
             if ($a->isError()) {
                 return new SoapFault(get_artifact_type_fault, $a->getErrorMessage(), 'updateArtifact');
             }
             // Update last_update_date field
             $a->update_last_update_date();
             // Send the notification
             if ($changes) {
                 $agnf = new ArtifactGlobalNotificationFactory();
                 $addresses = $agnf->getAllAddresses($ath->getID(), true);
                 $a->mailFollowupWithPermissions($addresses, $changes);
             }
             return $a->getID();
         }
     } else {
         return new SoapFault(invalid_session_fault, 'Invalid Session ', 'updateArtifact');
     }
 }