Bunch of changes
Joshua Dickerson

Joshua Dickerson commited on 2011-10-12 19:32:51
Showing 2 changed files, with 92 additions and 2 deletions.

... ...
@@ -562,11 +562,101 @@ class mbt_to_tbg extends tbg_converter
562 562
 		$this->checkTimeout(__FUNCTION__);
563 563
 
564 564
 	}
565
+
566
+	private function getIssues()
567
+	{
568
+		// Get the basics - we'll fix it up in a minute.
569
+		$this->db->query('
570
+			INSERT INTO ' . $this->tbg_prefix . 'issues
571
+				id, project_id, title, assigned_to, duplicate_of, posted, last_updated,
572
+				state, category, resolution, priority, severity, reproducability
573
+			SELECT bt.id, bt.project_id, bt.summary AS title, bt.handler_id AS assigned_to,
574
+				bt.duplicate_id AS duplicate_of, bt.date_submitted AS posted, bt.last_updated,
575
+				bt.status AS state, bt.category_id AS category, bt.resolution, bt.priority,
576
+				bt.severity, bt.reproducability, btt.steps_to_reproduce AS reproduction_steps, btt.description
577
+			FROM ' . $this->mtb_prefix . 'bug_table AS bt
578
+			LEFT JOIN ' . $this->mtb_prefix . 'bug_text_table AS btt ON (btt.id = bt.bug_text_id)
579
+			'
580
+		);
581
+
582
+		// Update reproducability
583
+		// Mantis (always = 10; sometimes = 30; random = 50; have not tried = 70; unable to reproduce = 90; N/A = 100)
584
+		// TBG (Always = 12; Often = 11; Rarely = 10; Can't reproduce = 9)
585
+		// Mantis->TBG (10->12, 30->11, 50->10, 90->9, 70->null, 100->null)
586
+		$this->db->query('
587
+			UPDATE ' . $this->tbg_prefix . 'issues
588
+			SET reproducability =
589
+				CASE reproducability
590
+					WHEN 10 THEN 12
591
+					WHEN 30 THEN 11
592
+					WHEN 50 THEN 10
593
+					WHEN 90 THEN 9
594
+					WHEN 70 THEN null
595
+					WHEN 100 THEN null
596
+		');
597
+
598
+		// Update severity
599
+		// Mantis (feature = 10; trivial = 20; text = 30; tweak = 40; minor = 50; major = 60; crash = 70; block = 80;)
600
+		// TBG (Low = 20; Normal = 21; Critical = 22)
601
+		// Mantis->TBG ()
602
+		$this->db->query('
603
+			UPDATE ' . $this->tbg_prefix . 'issues
604
+			SET severity =
605
+				CASE severity
606
+					WHEN 10 THEN 
607
+					WHEN 20 THEN 
608
+					WHEN 30 THEN 
609
+					WHEN 40 THEN 
610
+					WHEN 50 THEN 
611
+					WHEN 60 THEN 
612
+					WHEN 70 THEN 
613
+					WHEN 80 THEN 
614
+		');
615
+
616
+		// Update priority
617
+		// Mantis (none = 10; low = 20; normal = 30; high = 40; urgent = 50; immediate = 60)
618
+		// TBG()
619
+		$this->db->query('
620
+			UPDATE ' . $this->tbg_prefix . 'issues
621
+			SET priority =
622
+				CASE priority
623
+					WHEN 10 THEN 
624
+					WHEN 20 THEN 
625
+					WHEN 30 THEN 
626
+					WHEN 40 THEN 
627
+					WHEN 50 THEN 
628
+					WHEN 60 THEN 
629
+					WHEN 70 THEN 
630
+					WHEN 80 THEN 
631
+		');
565 632
 	}
566 633
 
567
-/*
634
+	private function getComments()
635
+	{
636
+		$this->db->query('
637
+			INSERT INTO ' . $this->tbg_prefix . 'comments
638
+				target_id, updated, posted, updated_by, posted_by, content			
639
+			SELECT bn.bug_id AS target_id, bn.last_modified AS updated, bn.date_submitted AS posted,
640
+				bn.reporter_id AS updated_by, bn.reporter_id AS posted_by, btt.note AS content
641
+			FROM ' . $this->mtb_prefix . 'bugnote_table AS bn
642
+			LEFT JOIN ' . $this->mtb_prefix . 'bugnote_text_table AS btt ON(' . $this->mtb_prefix . 'bugnote_text_table.id = ' . $this->mtb_prefix . 'bugnote_table.id)'
643
+		);
644
+		
645
+	}
646
+
647
+	private function getProjects()
648
+	{
649
+		$this->db->query('
650
+			INSERT INTO ' . $this->tbg_prefix . 'projects
651
+				id, name, locked, description	
652
+			SELECT id, name, enabled AS locked, description
653
+			FROM ' . $this->mtb_prefix . 'project_table
654
+		);
655
+	}
656
+}
657
+
658
+/** 
568 659
  * Theme wrapper.
569
-*
570 660
  */
571 661
 class tbg_converter_wrapper
572 662
 {
573 663