5 // get the Group object
7 $group =& group_get_object($group_id);
8 if (!$group || !is_object($group)) {
11 if ($group->isError()) {
12 if($group->isPermissionDeniedError()) {
13 exit_permission_denied($group->getErrorMessage());
15 exit_error($Language->getText('general','error'), $group->getErrorMessage());
19 // Create the ArtifactType object
21 $ath = new ArtifactTypeHtml($group,$atid);
23 if (!$ath || !is_object($ath)) {
24 exit_error('Error','ArtifactType could not be created');
26 if ($ath->isError()) {
27 if($ath->isPermissionDeniedError()) {
28 exit_permission_denied($group->getErrorMessage());
30 exit_error($Language->getText('general','error'), $ath->getErrorMessage());
44 $ah=new ArtifactHtml($ath);
45 if (!$ah || !is_object($ah)) {
46 exit_error('ERROR','Artifact Could Not Be Created');
48 if (empty($user_email)) {
51 if (!validate_email($user_email)) {
52 exit_error('ERROR', $Language->getText('general','invalid_email'));
55 if (!$ah->create($category_id,$artifact_group_id,$summary,$details,$assigned_to,$priority,$extra_fields)) {
56 exit_error('ERROR',$ah->getErrorMessage());
59 // Attach file to this Artifact.
62 $afh=new ArtifactFileHtml($ah);
63 if (!$afh || !is_object($afh)) {
64 $feedback .= 'Could Not Create File Object';
65 // } elseif ($afh->isError()) {
66 // $feedback .= $afh->getErrorMessage();
68 if (!$afh->upload($input_file,$input_file_name,$input_file_type,$file_description)) {
69 $feedback .= ' Could Not Attach File to Item: '.$afh->getErrorMessage();
73 $feedback .= $Language->getText('tracker','item_created');
80 $count=count($artifact_id_list);
82 if (!$ath->userIsAdmin()) {
83 exit_permission_denied();
86 $artifact_type_id=$ath->getID();
88 for ($i=0; $i < $count; $i++) {
89 $ah=new Artifact($ath,$artifact_id_list[$i]);
90 if (!$ah || !is_object($ah)) {
91 $feedback .= ' ID: '.$artifact_id_list[$i].'::Artifact Could Not Be Created';
92 } else if ($ah->isError()) {
93 $feedback .= ' ID: '.$artifact_id_list[$i].'::'.$ah->getErrorMessage();
95 $_priority=(($priority != 100) ? $priority : $ah->getPriority());
96 $_status_id=(($status_id != 100) ? $status_id : $ah->getStatusID());
97 $_category_id=(($category_id != 100) ? $category_id : $ah->getCategoryID());
98 $_artifact_group_id=(($artifact_group_id != 100) ? $artifact_group_id : $ah->getArtifactGroupID());
99 $_resolution_id=(($resolution_id != 100) ? $resolution_id : $ah->getResolutionID());
100 //yikes, we want the ability to mass-update to "un-assigned", which is the ID=100, which
101 //conflicts with the "no change" ID! Sorry for messy use of 100.1
102 $_assigned_to=(($assigned_to != '100.1') ? $assigned_to : $ah->getAssignedTo());
103 $_summary=addslashes($ah->getSummary());
105 if (!$ah->update($_priority,$_status_id,$_category_id,$_artifact_group_id,$_resolution_id,$_assigned_to,$_summary,$canned_response,'',$artifact_type_id)) {
110 $feedback .= ' ID: '.$artifact_id_list[$i].'::'.$ah->getErrorMessage();
118 $feedback = $Language->getText('tracker','updated_successful'); }
120 unset ($extra_fields_choice);
121 include ('browse.php');
126 Technicians can modify limited fields - to be certain
127 no one is hacking around, we override any fields they don't have
128 permission to change.
130 $ah=new ArtifactHtml($ath,$artifact_id);
131 if (!$ah || !is_object($ah)) {
132 exit_error('ERROR','Artifact Could Not Be Created');
133 } else if ($ah->isError()) {
134 exit_error('ERROR',$ah->getErrorMessage());
136 if (!$ath->userIsAdmin() && $ath->userIsTechnician()) {
137 // && !(session_loggedin() && ($ah->getSubmittedBy() == user_getid()))
138 // && (session_loggedin() && ($ah->getAssignedTo() == user_getid()))) {
139 $priority=$ah->getPriority();
140 $category_id=$ah->getCategoryID();
141 $artifact_group_id=$ah->getArtifactGroupID();
142 $summary=addslashes($ah->getSummary());
143 $canned_response=100;
144 $new_artfact_type_id=$ath->getID();
148 if (!$ah->update($priority,$status_id,$category_id,$artifact_group_id,$resolution_id,
149 $assigned_to,$summary,$canned_response,$details,$new_artfact_type_id,$extra_fields)) {
150 $feedback =$Language->getText('tracker','tracker_item'). ': '.$ah->getErrorMessage();
156 // Attach file to this Artifact.
159 $afh=new ArtifactFileHtml($ah);
160 if (!$afh || !is_object($afh)) {
161 $feedback .= 'Could Not Create File Object';
162 // } elseif ($afh->isError()) {
163 // $feedback .= $afh->getErrorMessage();
165 if (!util_check_fileupload($input_file)) {
166 exit_error("Error","Invalid filename");
168 if (!$afh->upload($input_file,$input_file_name,$input_file_type,$file_description)) {
169 $feedback .= ' <br />'.$Language->getText('tracker','file_upload_upload').':'.$afh->getErrorMessage();
172 $feedback .= ' <br />'.$Language->getText('tracker','file_upload_successful');
178 // Delete list of files from this artifact
181 $count=count($delete_file);
182 for ($i=0; $i<$count; $i++) {
183 $afh=new ArtifactFileHtml($ah,$delete_file[$i]);
184 if (!$afh || !is_object($afh)) {
185 $feedback .= 'Could Not Create File Object::'.$delete_file[$i];
186 } elseif ($afh->isError()) {
187 $feedback .= $afh->getErrorMessage().'::'.$delete_file[$i];
189 if (!$afh->delete()) {
190 $feedback .= ' <br />'.$Language->getText('tracker','file_delete').': '.$afh->getErrorMessage();
193 $feedback .= ' <br />'.$Language->getText('tracker','file_delete_successful');
199 // Show just one feedback entry if no errors
202 $feedback = $Language->getText('general','update_successful');
204 include ('browse.php');
208 case 'postaddcomment' : {
210 Attach a comment to an artifact
213 $ah=new ArtifactHtml($ath,$artifact_id);
214 if (!$ah || !is_object($ah)) {
215 exit_error('ERROR','Artifact Could Not Be Created');
216 } else if ($ah->isError()) {
217 exit_error('ERROR',$ah->getErrorMessage());
219 if ($ah->addMessage($details,$user_email,true)) {
220 $feedback=$Language->getText('tracker','comment_added');
221 include ('browse.php');
223 //some kind of error in creation
224 exit_error('ERROR',$feedback);
230 $ah=new ArtifactHtml($ath,$artifact_id);
231 if (!$ah || !is_object($ah)) {
232 exit_error('ERROR','Artifact Could Not Be Created');
233 } else if ($ah->isError()) { exit_error('ERROR',$ah->getErrorMessage());
236 $feedback=$ah->getErrorMessage();
238 include 'browse.php';
243 include 'taskmgr.php';
247 include 'browse.php';
251 Header("Redirect: /tracker/download.php?group_id=$group_id&atid=$atid&aid=$aid&file_id=$file_id");
256 // users can modify their own tickets if they submitted them
257 // even if they are not artifact admins
259 $ah=new ArtifactHtml($ath,$aid);
260 if (!$ah || !is_object($ah)) {
261 exit_error('ERROR','Artifact Could Not Be Created'); } else if ($ah->isError()) {
262 exit_error('ERROR',$ah->getErrorMessage());
264 if ($ath->userIsAdmin()) {
266 } elseif ($ath->userIsTechnician() || (session_loggedin() && ($ah->getSubmittedBy() == user_getid()))) {
267 include 'mod-limited.php';
269 include 'detail.php';
275 include 'browse.php';