function migrate_test_plans(&$source_db, &$target_db, &$tplans, &$old_new)
{
    $tplan_mgr = new testplan($target_db);
    $tplan_qty = count($tplans);
    echo "<pre>   Test plans to migrate: " . $tplan_qty;
    echo "</pre>";
    foreach ($tplans as $item_id => $idata) {
        $old_prodid = intval($idata['prodid']);
        $tproj_id = 0;
        if ($old_prodid > 0) {
            $tproj_id = $old_new['product'][$old_prodid];
        }
        $old_new['tplan'][$item_id] = $tplan_mgr->create($idata['name'], $idata['notes'], $tproj_id);
        //echo "OLD TPlan ID {$item_id} {$idata['name']} -> {$old_new['tplan'][$item_id]} <br>";
        // 20070130 - jbarchibald
        if (intval($idata['active']) == 0) {
            $sql = "UPDATE testplans SET active=0 WHERE testplans.id={$old_new['tplan'][$item_id]}";
            $target_db->exec_query($sql);
        }
    }
}
예제 #2
0
 /**
  * 
  *
  */
 private function copy_testplans($source_id, $target_id, $user_id, $mappings)
 {
     static $tplanMgr;
     $tplanSet = $this->get_all_testplans($source_id);
     if (!is_null($tplanSet)) {
         $keySet = array_keys($tplanSet);
         if (is_null($tplanMgr)) {
             $tplanMgr = new testplan($this->db);
         }
         foreach ($keySet as $itemID) {
             $new_id = $tplanMgr->create($tplanSet[$itemID]['name'], $tplanSet[$itemID]['notes'], $target_id, $tplanSet[$itemID]['active'], $tplanSet[$itemID]['is_public']);
             if ($new_id > 0) {
                 // TICKET 5190: Copy Test projects - tester assignments to testplan+build are not copied
                 $tplanMgr->copy_as($itemID, $new_id, null, $target_id, $user_id, array('copy_assigned_to' => 1), $mappings);
             }
         }
     }
 }
예제 #3
0
 /**
  * 
  *
  */
 private function copy_testplans($source_id, $target_id, $user_id, $mappings)
 {
     static $tplanMgr;
     $tplanSet = $this->get_all_testplans($source_id);
     if (!is_null($tplanSet)) {
         $keySet = array_keys($tplanSet);
         if (is_null($tplanMgr)) {
             $tplanMgr = new testplan($this->db);
         }
         foreach ($keySet as $itemID) {
             $new_id = $tplanMgr->create($tplanSet[$itemID]['name'], $tplanSet[$itemID]['notes'], $target_id, $tplanSet[$itemID]['active'], $tplanSet[$itemID]['is_public']);
             if ($new_id > 0) {
                 $tplanMgr->copy_as($itemID, $new_id, null, $target_id, $user_id, null, $mappings);
             }
         }
     }
 }
예제 #4
0
     }
     if (!$status_ok) {
         $gui->tplan_id = $args->tplan_id;
         $gui->tproject_name = $args->tproject_name;
         $gui->notes = $of->CreateHTML();
     }
     break;
 case 'do_create':
     $template = 'planEdit.tpl';
     $status_ok = false;
     $of->Value = $args->notes;
     $gui->testplan_name = $args->testplan_name;
     $gui->is_active = $args->active == 'on' ? 1 : 0;
     $gui->is_public = $args->is_public == 'on' ? 1 : 0;
     if (!$name_exists) {
         $new_tplan_id = $tplan_mgr->create($args->testplan_name, $args->notes, $args->tproject_id, $args->active, $args->is_public);
         if ($new_tplan_id == 0) {
             $gui->user_feedback = $db->error_msg();
         } else {
             logAuditEvent(TLS("audit_testplan_created", $args->tproject_name, $args->testplan_name), "CREATED", $new_tplan_id, "testplans");
             $cf_map = $tplan_mgr->get_linked_cfields_at_design($new_tplan_id, $args->tproject_id);
             $tplan_mgr->cfield_mgr->design_values_to_db($_REQUEST, $new_tplan_id, $cf_map);
             $status_ok = true;
             $template = null;
             $gui->user_feedback = '';
             if ($args->rights == 'on') {
                 $result = insertTestPlanUserRight($db, $new_tplan_id, $args->user_id);
             }
             if ($args->copy) {
                 // BUGID 3485: "Create from existing Test Plan" always copies builds
                 $options = array('items2copy' => $args->copy_options, 'copy_assigned_to' => $args->copy_assigned_to, 'tcversion_type' => $args->tcversion_type);