File: ArtifactType.class

package info (click to toggle)
gforge 3.1-31sarge5
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 9,148 kB
  • ctags: 11,865
  • sloc: sql: 27,860; php: 25,574; perl: 7,124; xml: 3,152; sh: 2,586; ansic: 315; makefile: 143
file content (768 lines) | stat: -rw-r--r-- 19,715 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
<?php
/**
 * ArtifactType.class - Class to artifact an type
 *
 * SourceForge: Breaking Down the Barriers to Open Source Development
 * Copyright 1999-2001 (c) VA Linux Systems
 * http://sourceforge.net
 *
 * @version   $Id: ArtifactType.class,v 1.18.2.1 2004/03/31 20:08:10 lo-lan-do Exp $
 *
 * This file is part of GForge.
 *
 * GForge is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * GForge is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with GForge; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  US
 */
require_once('common/include/Error.class');

	/**
	* Gets an ArtifactType object from the artifact type id
	* 
	* @param artType_id	the ArtifactType id
	* @param res	the DB handle if passed in (optional)
	* @return	the ArtifactType object	
	*/
	function &artifactType_get_object($artType_id,$res=false) {
		global $ARTIFACTTYPE_OBJ;
		if (!isset($ARTIFACTTYPE_OBJ["_".$artType_id."_"])) {
			if ($res) {
				//the db result handle was passed in
			} else {
				$res=db_query("SELECT * FROM artifact_group_list_vw
						WHERE group_artifact_id='$artType_id'");
			}
			if (!$res || db_numrows($res) < 1 ){
				$ARTIFACTTYPE_OBJ["_".$artType_id."_"]=false;
			} else {
				$data =& db_fetch_array($res);
				$Group =& group_get_object($data["group_id"]);
				$ARTIFACTTYPE_OBJ["_".$artType_id."_"]= new ArtifactType($Group,$data["group_artifact_id"],$data);
			}
		}
		return $ARTIFACTTYPE_OBJ["_".$artType_id."_"];
	}	

class ArtifactType extends Error {

	/**
	 * The Group object.
	 *
	 * @var		object	$Group.
	 */
	var $Group; //group object

	/**
	 * Categories db resource ID.
	 *
	 * @var		int		$categories_res.
	 */
	var $categories_res;

	/**
	 * Resolutions db resource ID.
	 *
	 * @var		int		$resolutions_res.
	 */
	var $resolutions_res;

	/**
	 * Groups db resource ID.
	 *
	 * @var		int		$groups_res.
	 */
	var $groups_res;

	/**
	 * Current user permissions.
	 *
	 * @var		int		$current_user_perm.
	 */
	var $current_user_perm;

	/**
	 * Technicians db resource ID.
	 *
	 * @var		int		$technicians_res.
	 */
	var $technicians_res;

	/**
	 * Status db resource ID.
	 *
	 * @var		int		$status_res.
	 */
	var $status_res;

	/**
	 * Canned responses resource ID.
	 *
	 * @var		int		$cannecresponses_res.
	 */
	var $cannedresponses_res;

	/**
	 * Array of artifact data.
	 *
	 * @var		array	$data_array.
	 */
	var $data_array;

	/**
	 *	ArtifactType - constructor.
	 *
	 *	@param	object	The Group object.
	 *	@param	int		The id # assigned to this artifact type in the db.
	 *  @param	array	The associative array of data.
	 *	@return boolean	success.
	 */
	function ArtifactType(&$Group,$artifact_type_id=false, $arr=false) {
		$this->Error();
		if (!$Group || !is_object($Group)) {
			$this->setError('No Valid Group Object');
			return false;
		}
		if ($Group->isError()) {
			$this->setError('ArtifactType: '.$Group->getErrorMessage());
			return false;
		}
		$this->Group =& $Group;
		if ($artifact_type_id) {
			if (!$arr || !is_array($arr)) {
				if (!$this->fetchData($artifact_type_id)) {
					return false;
				}
			} else {
				$this->data_array =& $arr;
				if ($this->data_array['group_id'] != $this->Group->getID()) {
					$this->setError('Group_id in db result does not match Group Object');
					$this->data_array = null;
					return false;
				}
			}
			if (!$this->isPublic()) {
	                	$perm =& $this->Group->getPermission( session_get_user() );
			        if (!$perm || !is_object($perm) || !$perm->isMember()) {
	                		$this->setPermissionDeniedError();
					$this->data_array = null;
	                		return false;
				}
			}
		}
	}

	/**
	 *	create - use this to create a new ArtifactType in the database.
	 *
	 *	@param	string	The type name.
	 *	@param	string	The type description.
	 *	@param	bool	(1) true (0) false - viewable by general public.
	 *	@param	bool	(1) true (0) false - whether non-logged-in users can submit.
	 *	@param	bool	(1) true (0) false - whether to email on all updates.
	 *	@param	string	The address to send new entries and updates to.
	 *	@param	int		Days before this item is considered overdue.
	 *	@param	bool	(1) trye (0) false - whether the resolution box should be shown.
	 *	@param	string	Free-form string that project admins can place on the submit page.
	 *	@param	string	Free-form string that project admins can place on the browse page.
	 *	@param	int		(1) bug tracker, (2) Support Tracker, (3) Patch Tracker, (4) features (0) other.
	 *	@return id on success, false on failure.
	 */
	function create($name,$description,$is_public,$allow_anon,$email_all,$email_address,
		$due_period,$use_resolution,$submit_instructions,$browse_instructions,$datatype=0) {

		global $Language;
		$perm =& $this->Group->getPermission( session_get_user() );

		if (!$perm || !is_object($perm) || !$perm->isArtifactAdmin()) {
			$this->setPermissionDeniedError();
			return false;
		}

		if (!$name || !$description || !$due_period) {
			$this->setError($Language->getText('tracker_artifacttype','required_fields'));
			return false;
		}

		if ($email_address && !validate_email($email_address)) {
			$email_address='';
		}
		if ($email_all && !$email_address) {
			$email_all=0;
		}

                $use_resolution = ((!$use_resolution) ? 0 : $use_resolution);
                $is_public = ((!$is_public) ? 0 : $is_public);
                $allow_anon = ((!$allow_anon) ? 0 : $allow_anon);
                $email_all = ((!$email_all) ? 0 : $email_all);


		$sql="INSERT INTO 
			artifact_group_list 
			(group_id,
			name,
			description,
			is_public,
			allow_anon,
			email_all_updates,
			email_address,
			due_period,
			status_timeout,
			use_resolution,
			submit_instructions,
			browse_instructions,
			datatype) 
			VALUES 
			('". $this->Group->getID() ."',
			'". htmlspecialchars($name) ."',
			'". htmlspecialchars($description) ."',
			'$is_public',
			'$allow_anon',
			'$email_all',
			'$email_address',
			'". ($due_period*(60*60*24)) ."',
			'1209600',
			'$use_resolution',
			'".htmlspecialchars($submit_instructions)."',
			'".htmlspecialchars($browse_instructions)."',
			'$datatype')";
		//echo $sql;
		$res = db_query($sql);

		db_begin();
		$id = db_insertid($res,'artifact_group_list','group_artifact_id');
		
		if (!$res || !$id) {
			$this->setError('ArtifactType: '.db_error());
			db_rollback();
			return false;
		} else {
			if (!$this->fetchData($id)) {
				db_rollback();
				return false;
			} else {
				db_commit();
				return $id;
			}
		}
	}

	/**
	 *  fetchData - re-fetch the data for this ArtifactType from the database.
	 *
	 *  @param	int		The artifact type ID.
	 *  @return boolean	success.
	 */
	function fetchData($artifact_type_id) {
		$res=db_query("SELECT * FROM artifact_group_list_vw
			WHERE group_artifact_id='$artifact_type_id' 
			AND group_id='". $this->Group->getID() ."'");
		if (!$res || db_numrows($res) < 1) {
			$this->setError('ArtifactType: Invalid ArtifactTypeID');
			return false;
		}
		$this->data_array =& db_fetch_array($res);
		db_free_result($res);
		return true;
	}

	/**
	 *	  getGroup - get the Group object this ArtifactType is associated with.
	 *
	 *	  @return	Object	The Group object.
	 */
	function &getGroup() {
		return $this->Group;
	}

	/**
	 *	  getID - get this ArtifactTypeID.
	 *
	 *	  @return	int	The group_artifact_id #.
	 */
	function getID() {
		return $this->data_array['group_artifact_id'];
	}

	/**
	 *	  getOpenCount - get the count of open tracker items in this tracker type.
	 *
	 *	  @return	int	The count.
	 */
	function getOpenCount() {
		return $this->data_array['open_count'];
	}

	/**
	 *	  getTotalCount - get the total number of tracker items in this tracker type.
	 *
	 *	  @return	int	The total count.
	 */
	function getTotalCount() {
		return $this->data_array['count'];
	}

	/**
	 *	  allowsAnon - determine if non-logged-in users can post.
	 *
	 *	  @return	boolean	allow_anonymous_submissions.
	 */
	function allowsAnon() {
		return $this->data_array['allow_anon'];
	}

	/**
	 *	  getSubmitInstructions - get the free-form string strings.
	 *
	 *	  @return	string	instructions.
	 */
	function getSubmitInstructions() {
		return $this->data_array['submit_instructions'];
	}

	/**
	 *	  getBrowseInstructions - get the free-form string strings.
	 *
	 *	  @return string instructions.
	 */
	function getBrowseInstructions() {
		return $this->data_array['browse_instructions'];
	}

	/**
	 *	  emailAll - determine if we're supposed to email on every event.
	 *
	 *	  @return	boolean	email_all.
	 */
	function emailAll() {
		return $this->data_array['email_all_updates'];
	}

	/**
	 *	  emailAddress - defined email address to send events to.
	 *
	 *	  @return	string	email.
	 */
	function getEmailAddress() {
		return $this->data_array['email_address'];
	}

	/**
	 *	  isPublic - whether non-group-members can view.
	 *
	 *	  @return boolean	is_public.
	 */
	function isPublic() {
		return $this->data_array['is_public'];
	}

	/**
	 *	  getName - the name of this ArtifactType.
	 *
	 *	  @return	string	name.
	 */
	function getName() {
		return $this->data_array['name'];
	}

	/**
	 *	  getDescription - the description of this ArtifactType.
	 *
	 *	  @return	string	description.
	 */
	function getDescription() {
		return $this->data_array['description'];
	}

	/**
	 *	  getDuePeriod - how many seconds until it's considered overdue.
	 *
	 *	  @return int seconds.
	 */
	function getDuePeriod() {
		return $this->data_array['due_period'];
	}

	/**
	 *	getStatusTimeout - how many seconds until an item is stale.
	 *
	 *	@return int seconds.
	 */
	function getStatusTimeout() {
		return $this->data_array['status_timeout'];
	}

	/**
	 *	  useResolution - whether this ArtifactType uses the resolution feature.
	 *
	 *	  @return boolean	use_resolution.
	 */
	function useResolution() {
		return $this->data_array['use_resolution'];
	}

	/**
	 *	  getDataType - flag that is generally unused but can mark the difference between bugs, patches, etc.
	 *
	 *	  @return	int	The type (1) bug (2) support (3) patch (4) feature (0) other.
	 */
	function getDataType() {
		return $this->data_array['datatype'];
	}

	/**
	 *	getCategories - List of possible categories set up for this artifact type.
	 *
	 *	@return database result set.
	 */
	function getCategories() {
		if (!isset($this->categories_res)) {
			$sql="select id,category_name 
				FROM artifact_category 
				WHERE group_artifact_id='". $this->getID() ."'
				ORDER BY category_name";
			$this->categories_res=db_query($sql);
		}
		return $this->categories_res;
	}

	/**
	 *	getGroups - List of possible groups set up for this artifact type.
	 *
	 *	@return database result set.
	 */
	function getGroups() {
		if (!isset($this->groups_res)) {
			$sql="select id,group_name 
				FROM artifact_group 
				WHERE group_artifact_id='". $this->getID() ."'";
			$this->groups_res=db_query($sql);
		}
		return $this->groups_res;
	}

	/**
	 *	getResolutions - List of possible resolutions.
	 *
	 *	@return database result set.
	 */
	function getResolutions() {
		if (!isset($this->resolutions_res)) {
			$sql="select id,resolution_name 
				FROM artifact_resolution";
			$this->resolutions_res=db_query($sql);
		}
		return $this->resolutions_res;
	}

	/**
	 *	getTechnicians - returns a result set of technicians.
	 *
	 *	@return database result set.
	 */
	function getTechnicians() {
		if (!isset($this->technicians_res)) {
			$sql="SELECT user_id,realname 
				FROM artifactperm_user_vw
				WHERE group_artifact_id='". $this->getID() ."' 
				AND perm_level in (1,2)
				ORDER BY realname";
			$this->technicians_res = db_query($sql);
		}
		return $this->technicians_res;
	}

	/**
	 *	getCannedResponses - returns a result set of canned responses.
	 *
	 *	@return database result set.
	 */
	function getCannedResponses() {
		if (!isset($this->cannedresponses_res)) {
			$sql="SELECT id,title
				FROM artifact_canned_responses 
				WHERE group_artifact_id='". $this->getID() ."'";
			$this->cannedresponses_res = db_query($sql);
		}
		return $this->cannedresponses_res;
	}

	/**
	 *	getStatuses - returns a result set of statuses.
	 *
	 *	@return database result set.
	 */
	function getStatuses() {
		if (!isset($this->status_res)) {
			$sql="select * from artifact_status";
			$this->status_res=db_query($sql);
		}
		return $this->status_res;
	}

	/**
	 * getStatusName - returns the name of this status.
	 *
	 * @param	int		The status ID.
	 * @return	string	name.
	 */
	function getStatusName($id) {
		$sql="select * from artifact_status WHERE id='$id'";
		$result=db_query($sql);
		if ($result && db_numrows($result) > 0) {
			return db_result($result,0,'status_name');
		} else {
			return 'Error - Not Found';
		}
	}

	/**
	 *	addUser - add a user to this ArtifactType - depends on UNIQUE INDEX preventing duplicates.
	 *
	 *	@param	int		user_id of the new user.
	 *	@return boolean	success.
	 */
	function addUser($id) {
		if (!$this->userIsAdmin()) {
			$this->setPermissionDeniedError();
			return false;
		}
		if (!$id) {
			$this->setMissingParamsError();
			return false;
		}
		$sql="INSERT INTO artifact_perm (group_artifact_id,user_id,perm_level) 
			VALUES ('".$this->getID()."','$id',0)";
		$result=db_query($sql);
		if ($result && db_affected_rows($result) > 0) {
			return true;
		} else {
			$this->setError(db_error());
			return false;
		}
	}

	/**
	 *	updateUser - update a user's permissions.
	 *
	 *	@param	int		user_id of the user to update.
	 *	@param	int		(1) tech only, (2) admin & tech (3) admin only.
	 *	@return boolean	success.
	 */
	function updateUser($id,$perm_level) {
		if (!$this->userIsAdmin()) {
			$this->setPermissionDeniedError();
			return false;
		}
		if (!$id) {
			$this->setMissingParamsError();
			return false;
		}
		$sql="UPDATE artifact_perm SET perm_level='$perm_level'
			WHERE user_id='$id' AND group_artifact_id='".$this->getID()."'";
		$result=db_query($sql);
		if ($result) {
			return true;
		} else {
			$this->setError(db_error());
			return false;
		}
	}

	/**
	 *	deleteUser - delete a user's permissions.
	 *
	 *	@param	int		user_id of the user who's permissions to delete.
	 *	@return boolean	success.
	 */
	function deleteUser($id) {
		if (!$this->userIsAdmin()) {
			$this->setPermissionDeniedError();
			return false;
		}
		if (!$id) {
			$this->setMissingParamsError();
			return false;
		}
		$sql="DELETE FROM artifact_perm
			WHERE user_id='$id' AND group_artifact_id='".$this->getID()."'";
		$result=db_query($sql);
		if ($result) {
			return true;
		} else {
			$this->setError(db_error());
			return false;
		}
	}

	/*

		USER PERMISSION FUNCTIONS

	*/

	/**
	 *	  userCanView - determine if the user can view this artifact type.
	 *
	 *	  @return boolean	user_can_view.
	 */
	function userCanView() {
		if ($this->isPublic()) {
			return true;
		} else {
			if (!session_loggedin()) {
				return false;
			} else {
				//
				//	For now, we let any member of a project view this ArtifactType
				//	A future change might be to restrict to only those people with 
				//	a corresponding entry in artifact_perm table
				//
				$perm =& $this->Group->getPermission( session_get_user() );
				return $perm->isMember();
			}
		}
	}

	/**
	 *	userIsAdmin - see if the logged-in user's perms are >= 2 or Group ArtifactAdmin.
	 *
	 *	@return boolean	user_is_admin.
	 */
	function userIsAdmin() { 
		$perm =& $this->Group->getPermission( session_get_user() );

		if (($this->getCurrentUserPerm() >= 2) || ($perm->isArtifactAdmin())) {
			return true;
		} else {
			return false;
		}
	}

	/**
	 *	userIsTechnician - see if the logged-in user's perms are >= 1 or Group ArtifactAdmin.
	 *
	 *	@return boolean	user_is_technician.
	 */
	function userIsTechnician() { 
		$perm =& $this->Group->getPermission( session_get_user() );

		if (($this->getCurrentUserPerm() >= 1) || ($perm->isArtifactAdmin())) {
			return true;
		} else {
			return false;
		}
	}

	/**
	 *	getCurrentUserPerm - get the logged-in user's perms from artifact_perm.
	 *
	 *	@return int perm level for the logged-in user.
	 */
	function getCurrentUserPerm() {
		if (!session_loggedin()) {
			return 0;
		} else {
			if (!isset($this->current_user_perm)) {
				$sql="select perm_level
				FROM artifact_perm
				WHERE group_artifact_id='". $this->getID() ."'
				AND user_id='".user_getid()."'";
				$this->current_user_perm=db_result(db_query($sql),0,0);
			}
			return $this->current_user_perm;
		}
	}

	/**
	 *  update - use this to update this ArtifactType in the database.
	 *
	 *  @param	string	The item name.
	 *  @param	string	The item description.
	 *  @param	bool	(1) true (0) false - viewable by general public.
	 *  @param	bool	(1) true (0) false - whether non-logged-in users can submit.
	 *  @param	bool	(1) true (0) false - whether to email on all updates.
	 *  @param	string	The address to send new entries and updates to.
	 *  @param	int		Days before this item is considered overdue.
	 *  @param	int		Days before stale items time out.
	 *  @param	bool	(1) true (0) false - whether the resolution box should be shown.
	 *  @param	string	Free-form string that project admins can place on the submit page.
	 *  @param	string	Free-form string that project admins can place on the browse page.
	 *  @return true on success, false on failure.
	 */
	function update($name,$description,$is_public,$allow_anon,$email_all,$email_address,
		$due_period, $status_timeout,$use_resolution,$submit_instructions,$browse_instructions) {

		global $Language;
		$perm =& $this->Group->getPermission(session_get_user());

		if (!$perm || !is_object($perm) || !$perm->isArtifactAdmin()) {
			$this->setPermissionDeniedError();
			return false;
		}

		if ($this->getDataType()) {
			$name=$this->getName();
			$description=$this->getDescription();
		}
		
		if (!$name || !$description || !$due_period || !$status_timeout) {
			$this->setError($Language->getText('tracker_artifacttype','required_fields'));
			return false;
		}
		
		if ($email_address && !validate_email($email_address)) {
			$email_address='';
		}
		if ($email_all && !$email_address) {
			$email_all=0;
		}

		$email_all = ((!$email_all) ? 0 : $email_all); 
		$use_resolution = ((!$use_resolution) ? 0 : $use_resolution); 
		$allow_anon = ((!$allow_anon) ? 0 : $allow_anon); 
		$is_public = ((!$is_public) ? 0 : $is_public); 

		$sql="UPDATE artifact_group_list SET 
			name='". htmlspecialchars($name). "',
			description='". htmlspecialchars($description) ."',
			is_public='$is_public',
			allow_anon='$allow_anon',
			email_all_updates='$email_all',
			email_address='$email_address',
			due_period='". ($due_period * (60*60*24)) ."',
			status_timeout='". ($status_timeout * (60*60*24)) . "',
			use_resolution='$use_resolution',
			submit_instructions='". htmlspecialchars($submit_instructions)."',
			browse_instructions='" .htmlspecialchars($browse_instructions)."'
			WHERE 
			group_artifact_id='". $this->getID() ."' 
			AND group_id='". $this->Group->getID() ."'";

		$res=db_query($sql);
		if (!$res || db_affected_rows($res) < 1) {
			$this->setError('ArtifactType::Update(): '.db_error());
			return false;
		} else {
			$this->fetchData($this->getID());
			return true;
		}
	}

}

// Local Variables:
// mode: php
// c-file-style: "bsd"
// End:

?>