Exemplo n.º 1
0
function init_args(&$dbHandler, $dateFormat)
{
    $_REQUEST = strings_stripSlashes($_REQUEST);
    $args = new stdClass();
    // BUGID 3716
    $args->target_date_original = isset($_REQUEST['target_date']) ? $_REQUEST['target_date'] : null;
    $args->start_date_original = isset($_REQUEST['start_date']) ? $_REQUEST['start_date'] : null;
    // convert target date to iso format to write to db
    if (isset($_REQUEST['target_date']) && $_REQUEST['target_date'] != '') {
        $date_array = split_localized_date($_REQUEST['target_date'], $dateFormat);
        if ($date_array != null) {
            // set date in iso format
            $args->target_date = $date_array['year'] . "-" . $date_array['month'] . "-" . $date_array['day'];
        }
    }
    // convert start date to iso format to write to db
    if (isset($_REQUEST['start_date']) && $_REQUEST['start_date'] != '') {
        $date_array = split_localized_date($_REQUEST['start_date'], $dateFormat);
        if ($date_array != null) {
            // set date in iso format
            $args->start_date = $date_array['year'] . "-" . $date_array['month'] . "-" . $date_array['day'];
        }
    }
    $key2loop = array('low_priority_tcases', 'medium_priority_tcases', 'high_priority_tcases');
    foreach ($key2loop as $key) {
        $args->{$key} = isset($_REQUEST[$key]) ? intval($_REQUEST[$key]) : 0;
    }
    $args->id = isset($_REQUEST['id']) ? $_REQUEST['id'] : 0;
    $args->name = isset($_REQUEST['milestone_name']) ? $_REQUEST['milestone_name'] : null;
    $args->doAction = isset($_REQUEST['doAction']) ? $_REQUEST['doAction'] : null;
    $args->basehref = $_SESSION['basehref'];
    $treeMgr = new tree($dbHandler);
    $tprojectMgr = new testproject($dbHandler);
    $args->tproject_options = new stdClass();
    $args->tproject_options->testPriorityEnabled = 0;
    $args->tproject_name = '';
    $args->tproject_id = isset($_REQUEST['tproject_id']) ? intval($_REQUEST['tproject_id']) : 0;
    if ($args->tproject_id > 0) {
        $info = $tprojectMgr->get_by_id($args->tproject_id);
        $args->tproject_name = $info['name'];
        $args->tproject_options = $info['opt'];
    }
    $args->tplan_name = '';
    $args->tplan_id = isset($_REQUEST['tplan_id']) ? intval($_REQUEST['tplan_id']) : 0;
    if ($args->tplan_id > 0) {
        $info = $treeMgr->get_node_hierarchy_info($args->tplan_id);
        $args->tplan_name = $info['name'];
    }
    return $args;
}
Exemplo n.º 2
0
function crossChecks($argsObj, &$tplanMgr, $dateFormat)
{
    $op = new stdClass();
    $op->user_feedback = '';
    $op->status_ok = 1;
    $buildID = $argsObj->do_action == 'do_update' ? $argsObj->build_id : null;
    if ($tplanMgr->check_build_name_existence($argsObj->tplan_id, $argsObj->build_name, $buildID)) {
        $op->user_feedback = lang_get("warning_duplicate_build") . TITLE_SEP_TYPE3 . $argsObj->build_name;
        $op->status_ok = 0;
    }
    // check is date is valid
    if ($op->status_ok) {
        // BUGID 3716
        $rdate = trim($argsObj->release_date_original);
        // TODO: comment
        $date_array = split_localized_date($rdate, $dateFormat);
        if ($date_array != null) {
            $status_ok = checkdate($date_array['month'], $date_array['day'], $date_array['year']);
            $op->status_ok = $status_ok ? 1 : 0;
        } else {
            $op->status_ok = 0;
        }
        // release date is optional
        if ($rdate == "") {
            $op->status_ok = 1;
        }
        if ($op->status_ok == 0) {
            $op->user_feedback = lang_get("invalid_release_date");
        }
    }
    return $op;
}
Exemplo n.º 3
0
/**
 *
 */
function init_args(&$tprojectMgr)
{
    $_REQUEST = strings_stripSlashes($_REQUEST);
    $args = new stdClass();
    $iParams = array("doAction" => array(tlInputParameter::STRING_N, 0, 10), "tproject_id" => array(tlInputParameter::INT_N), "status" => array(tlInputParameter::INT_N), "keyword_id" => array(tlInputParameter::INT_N), "version" => array(tlInputParameter::INT_N, 999), "custom_field_id" => array(tlInputParameter::INT_N), "name" => array(tlInputParameter::STRING_N, 0, 50), "created_by" => array(tlInputParameter::STRING_N, 0, 50), "edited_by" => array(tlInputParameter::STRING_N, 0, 50), "summary" => array(tlInputParameter::STRING_N, 0, 50), "steps" => array(tlInputParameter::STRING_N, 0, 50), "expected_results" => array(tlInputParameter::STRING_N, 0, 50), "custom_field_value" => array(tlInputParameter::STRING_N, 0, 20), "targetTestCase" => array(tlInputParameter::STRING_N, 0, 30), "preconditions" => array(tlInputParameter::STRING_N, 0, 50), "requirement_doc_id" => array(tlInputParameter::STRING_N, 0, 32), "importance" => array(tlInputParameter::INT_N), "creation_date_from" => array(tlInputParameter::STRING_N), "creation_date_to" => array(tlInputParameter::STRING_N), "modification_date_from" => array(tlInputParameter::STRING_N), "modification_date_to" => array(tlInputParameter::STRING_N), "jolly" => array(tlInputParameter::STRING_N));
    $args = new stdClass();
    R_PARAMS($iParams, $args);
    // sanitize targetTestCase against XSS
    // remove all blanks
    // remove some html entities
    // remove ()
    $tt = array(' ', '<', '>', '(', ')');
    $args->targetTestCase = str_replace($tt, '', $args->targetTestCase);
    $args->userID = intval(isset($_SESSION['userID']) ? $_SESSION['userID'] : 0);
    if (is_null($args->tproject_id) || intval($args->tproject_id) <= 0) {
        $args->tprojectID = intval(isset($_SESSION['testprojectID']) ? $_SESSION['testprojectID'] : 0);
        $args->tprojectName = isset($_SESSION['testprojectName']) ? $_SESSION['testprojectName'] : 0;
    } else {
        $args->tprojectID = intval($args->tproject_id);
        $info = $tprojectMgr->get_by_id($args->tprojectID);
        $args->tprojectName = $info['name'];
    }
    if ($args->tprojectID <= 0) {
        throw new Exception("Error Processing Request - Invalid Test project id " . __FILE__);
    }
    // convert "creation date from" to iso format for database usage
    $k2w = array('creation_date_from' => '', 'creation_date_to' => " 23:59:59", 'modification_date_from' => '', 'modification_date_to' => " 23:59:59");
    $k2f = array('creation_date_from' => ' creation_ts >= ', 'creation_date_to' => 'creation_ts <= ', 'modification_date_from' => ' modification_ts >= ', 'modification_date_to' => ' modification_ts <= ');
    $dateFormat = config_get('date_format');
    $filter = null;
    foreach ($k2w as $key => $value) {
        if (isset($args->{$key}) && $args->{$key} != '') {
            $da = split_localized_date($args->{$key}, $dateFormat);
            if ($da != null) {
                $args->{$key} = $da['year'] . "-" . $da['month'] . "-" . $da['day'] . $value;
                // set date in iso format
                $filter[$key] = " AND TCV.{$k2f[$key]} '{$args->{$key}}' ";
            }
        }
    }
    return array($args, $filter);
}
function initializeGuiForResult(&$dbHandler, $argsObj, &$guiObj)
{
    $rcfg = config_get('results');
    $map_status_code = $rcfg['status_code'];
    $map_code_status = $rcfg['code_status'];
    $map_status_label = $rcfg['status_label'];
    $map_statuscode_css = array();
    foreach ($map_code_status as $code => $status) {
        if (isset($map_status_label[$status])) {
            $label = $map_status_label[$status];
            $map_statuscode_css[$code] = array();
            $map_statuscode_css[$code]['translation'] = lang_get($label);
            $map_statuscode_css[$code]['css_class'] = $map_code_status[$code] . '_text';
        }
    }
    $options = array();
    // convert starttime to iso format for database usage
    $dateFormat = config_get('date_format');
    $k2l = array('selected_start_date' => 'startTime', 'selected_end_date' => 'endTime');
    foreach ($k2l as $in => $opt) {
        if (isset($argsObj->{$in}) && sizeof($argsObj->{$in}) > 0) {
            $dd = split_localized_date(current($argsObj->{$in}), $dateFormat);
            if ($dd != null) {
                $options[$opt] = $dd['year'] . "-" . $dd['month'] . "-" . $dd['day'];
            }
        }
    }
    $options['startTime'] .= " " . (isset($argsObj->start_Hour) ? $argsObj->start_Hour : "00") . ":00:00";
    $options['endTime'] .= " " . (isset($argsObj->end_Hour) ? $argsObj->end_Hour : "00") . ":59:59";
    $mgr = new testproject($dbHandler);
    $guiObj->resultSet = $mgr->getTestCasesCreatedByUser($argsObj->tproject_id, $argsObj->user_id, $options);
    if (!is_null($guiObj->resultSet)) {
        // test case can exist multiple times, due to versions
        $rows = array();
        foreach ($guiObj->resultSet as $idx => $itemInfo) {
            list($columns, $sortByColumn) = getColumnsDefinition();
            foreach ($itemInfo as $tcase) {
                $current_row = array();
                $tcase_id = $tcase['tcase_id'];
                $tcversion_id = $tcase['tcversion_id'];
                $current_row[] = htmlspecialchars($tcase['login']);
                $current_row[] = htmlspecialchars($tcase['path']);
                // Create linked icons
                $edit_link = "<a href=\"javascript:openTCEditWindow({$tcase_id},{$tcversion_id});\">" . "<img title=\"{$guiObj->l18n['design']}\" src=\"{$guiObj->images['edit']}\" /></a> ";
                $current_row[] = "<!-- " . sprintf("%010d", $tcase['external_id']) . " -->" . $edit_link . htmlspecialchars($tcase['external_id']) . " : " . htmlspecialchars($tcase['tcase_name']) . sprintf($guiObj->l18n['tcversion_indicator'], $tcase['version']);
                $current_row[] = $tcase['importance'];
                $current_row[] = $tcase['creation_ts'];
                $current_row[] = $tcase['modification_ts'];
                $rows[] = $current_row;
            }
        }
        // Different table ID for different reports:
        $table_id = "tl_table_tc_created_per_user_";
        // Add test plan ID to table ID
        $table_id .= $guiObj->tproject_id;
        $matrix = new tlExtTable($columns, $rows, $table_id);
        $matrix->title = $guiObj->l18n['testproject'] . ": " . htmlspecialchars($guiObj->tproject_name);
        //
        // @TODO how this work ?
        // $matrix->addCustomBehaviour(arg1, arg2)
        // arg1: type that can be user defined, here we use 'importance'.
        // arg2: array with methods
        //       'render' => javascript render method (has to be present on inc_ext_table.tpl).
        //       'filter' => piece of name used on several files
        //                   1. on exttable.class.php is used on buildColumns() to call build{piece}FilterOptions()
        //                   2. on ext_extensions a method named Ext.ux.grid.filter.{piece}Filter
        //                      has to exists or rendering will fail
        //
        $matrix->addCustomBehaviour('importance', array('render' => 'importanceRenderer', 'filter' => 'Importance'));
        // Default grouping by first column, which is user for overview, build otherwise
        $matrix->setGroupByColumnName(lang_get($columns[0]['title_key']));
        // Define toolbar
        $matrix->showToolbar = true;
        $matrix->toolbarExpandCollapseGroupsButton = true;
        $matrix->toolbarShowAllColumnsButton = true;
        // TICKET 5562: Test Cases created per User - toolbar refresh button breaks filter behaivour
        $matrix->toolbarDefaultStateButton = false;
        $matrix->toolbarRefreshButton = false;
        $matrix->setSortByColumnName($sortByColumn);
        $matrix->sortDirection = 'DESC';
        $guiObj->tableSet[$guiObj->tproject_id] = $matrix;
    }
}
 private function init_filter_custom_fields()
 {
     $key = 'filter_custom_fields';
     $no_warning = true;
     // BUGID 3930
     global $g_locales_date_format;
     $locale = isset($_SESSION['locale']) ? $_SESSION['locale'] : 'en_GB';
     $date_format = str_replace('%', '', $g_locales_date_format[$locale]);
     // BUGID 3566: show/hide CF
     $collapsed = isset($_SESSION['cf_filter_collapsed']) ? $_SESSION['cf_filter_collapsed'] : 0;
     $collapsed = isset($_REQUEST['btn_toggle_cf']) ? !$collapsed : $collapsed;
     $_SESSION['cf_filter_collapsed'] = $collapsed;
     $btn_label = $collapsed ? lang_get('btn_show_cf') : lang_get('btn_hide_cf');
     if (!$this->req_mgr) {
         $this->req_mgr = new requirement_mgr($this->db);
     }
     // BUGID 2877 -  Custom Fields linked to Req version
     // $cfields = $this->req_mgr->get_linked_cfields(null, $this->args->testproject_id);
     $cfields = $this->req_mgr->get_linked_cfields(null, null, $this->args->testproject_id);
     $cf_prefix = $this->req_mgr->cfield_mgr->name_prefix;
     $cf_html_code = "";
     $selection = array();
     $this->filters[$key] = false;
     $this->active_filters[$key] = null;
     if (!is_null($cfields)) {
         // display and compute only when custom fields are in use
         foreach ($cfields as $cf_id => $cf) {
             // has a value been selected?
             $id = $cf['id'];
             $type = $cf['type'];
             $verbose_type = trim($this->req_mgr->cfield_mgr->custom_field_types[$type]);
             $cf_input_name = "{$cf_prefix}{$type}_{$id}";
             // BUGID 3716
             // custom fields did not retain value after apply
             $value = isset($_REQUEST[$cf_input_name]) ? $_REQUEST[$cf_input_name] : null;
             // BUGID 3884: added filtering for datetime custom fields
             if ($verbose_type == 'datetime') {
                 // if cf is a date field, convert the three given values to unixtime format
                 if (isset($_REQUEST[$cf_input_name . '_input']) && $_REQUEST[$cf_input_name . '_input'] != '' && isset($_REQUEST[$cf_input_name . '_hour']) && $_REQUEST[$cf_input_name . '_hour'] != '' && isset($_REQUEST[$cf_input_name . '_minute']) && $_REQUEST[$cf_input_name . '_minute'] != '' && isset($_REQUEST[$cf_input_name . '_second']) && $_REQUEST[$cf_input_name . '_second'] != '') {
                     $date = $_REQUEST[$cf_input_name . '_input'];
                     $hour = $_REQUEST[$cf_input_name . '_hour'];
                     $minute = $_REQUEST[$cf_input_name . '_minute'];
                     $second = $_REQUEST[$cf_input_name . '_second'];
                     $date_array = split_localized_date($date, $date_format);
                     $value = mktime($hour, $minute, $second, $date_array['month'], $date_array['day'], $date_array['year']);
                 }
             }
             if ($verbose_type == 'date') {
                 // if cf is a date field, convert the three given values to unixtime format
                 // BUGID 3883: only set values if different from 0
                 if (isset($_REQUEST[$cf_input_name . '_input']) && $_REQUEST[$cf_input_name . '_input'] != '') {
                     $date = $_REQUEST[$cf_input_name . '_input'];
                     $date_array = split_localized_date($date, $date_format);
                     $value = mktime(0, 0, 0, $date_array['month'], $date_array['day'], $date_array['year']);
                 }
             }
             if ($this->args->reset_filters) {
                 $value = null;
             }
             $value2display = $value;
             if (!is_null($value2display) && is_array($value2display)) {
                 $value2display = implode("|", $value2display);
             }
             $cf['value'] = $value2display;
             if ($value) {
                 $this->do_filtering = true;
                 $selection[$id] = $value;
             }
             $label = str_replace(TL_LOCALIZE_TAG, '', lang_get($cf['label'], null, $no_warning));
             $cf_size = self::CF_INPUT_SIZE;
             // set special size for list inputs
             if ($verbose_type == 'list' || $verbose_type == 'multiselection list') {
                 $cf_size = 3;
             }
             // don't show textarea inputs here, they are too large for filterpanel
             if ($verbose_type != 'text area') {
                 $cf_html_code .= '<tr class="cfRow"><td>' . htmlspecialchars($label) . '</td><td>' . $this->req_mgr->cfield_mgr->string_custom_field_input($cf, '', $cf_size, true) . '</td></tr>';
             }
         }
         // BUGID 3566: show/hide CF
         $this->filters[$key] = array('items' => $cf_html_code, 'btn_label' => $btn_label, 'collapsed' => $collapsed);
         $this->active_filters[$key] = count($selection) ? $selection : null;
     }
 }
Exemplo n.º 6
0
 function _build_cfield($hash, $cf_map)
 {
     // BUGID 3930
     global $g_locales_date_format;
     $locale = isset($_SESSION['locale']) ? $_SESSION['locale'] : 'en_GB';
     $date_format = str_replace('%', '', $g_locales_date_format[$locale]);
     // carved in the stone
     $html_date_input_suffix = array('input' => true, 'hour' => true, 'minute' => true, 'second' => true);
     $cf_prefix = $this->name_prefix;
     $len_cfp = tlStringLen($cf_prefix);
     $cftype_pos = 2;
     $cfid_pos = 3;
     $cfield = null;
     // -------------------------------------------------------------------------
     if (!is_null($cf_map)) {
         foreach ($cf_map as $key => $value) {
             $cfield[$key] = array("type_id" => $value['type'], "cf_value" => '');
         }
     }
     // -------------------------------------------------------------------------
     // -------------------------------------------------------------------------
     // Overwrite with values if custom field id exist
     if (!is_null($hash)) {
         foreach ($hash as $key => $value) {
             if (strncmp($key, $cf_prefix, $len_cfp) == 0) {
                 // Notes on DATE PART - _build_cfield
                 //
                 // When using Custom Fields on Test Spec:
                 // key has this format (for every type except date )
                 // custom_field_0_10 for every type except for type date.
                 //
                 // For date custom fields:
                 // custom_field_8_10_day, custom_field_8_10_month, custom_field_8_10_year
                 //
                 // After explode()
                 // Position 2: CF type
                 // Position 3: CF id
                 // Position 4: only available for date CF, is date part indicator
                 //
                 // When using Custom Fields on Execution
                 // another piece is added (TC id) then for a date CF,
                 // date part indicator is Position 5, instead of 4
                 //
                 // When using Custom Fields on Testplan Design
                 // another piece is added (testplan_tcversion.id) then for a date CF,
                 // date part indicator is Position 5, instead of 4
                 //
                 $dummy = explode('_', $key);
                 $last_idx = count($dummy) - 1;
                 $the_value = $value;
                 if (isset($html_date_input_suffix[$dummy[$last_idx]])) {
                     $the_value = array();
                     if (isset($cfield[$dummy[$cfid_pos]])) {
                         $the_value = $cfield[$dummy[$cfid_pos]]['cf_value'];
                     }
                     $the_value[$dummy[$last_idx]] = $value;
                 }
                 $cfield[$dummy[$cfid_pos]] = array("type_id" => $dummy[$cftype_pos], "cf_value" => $the_value);
             }
         }
     }
     //if( !is_null($hash) )
     if (!is_null($cfield)) {
         foreach ($cfield as $field_id => $type_and_value) {
             $value = $type_and_value['cf_value'];
             $verbose_type = trim($this->custom_field_types[$type_and_value['type_id']]);
             switch ($verbose_type) {
                 case 'multiselection list':
                 case 'checkbox':
                     if (count($value) > 1) {
                         $value = implode('|', $value);
                     } else {
                         $value = is_array($value) ? $value[0] : $value;
                     }
                     $cfield[$field_id]['cf_value'] = $value;
                     break;
                 case 'date':
                     if ($value == 0 || $value == '') {
                         $cfield[$field_id]['cf_value'] = '';
                     } else {
                         $parsed_value = split_localized_date($value['input'], $date_format);
                         if ($parsed_value != null) {
                             $parsed_value = mktime(0, 0, 0, $parsed_value['month'], $parsed_value['day'], $parsed_value['year']);
                             $cfield[$field_id]['cf_value'] = $parsed_value;
                         } else {
                             $cfield[$field_id]['cf_value'] = '';
                         }
                     }
                     break;
                 case 'datetime':
                     if ($value['input'] == '') {
                         $cfield[$field_id]['cf_value'] = '';
                     } else {
                         $parsed_value = split_localized_date($value['input'], $date_format);
                         if ($parsed_value != null) {
                             if ($value['hour'] == -1 || $value['minute'] == -1 || $value['second'] == -1) {
                                 $value['hour'] = $value['minute'] = $value['second'] = 0;
                             }
                             $cfield[$field_id]['cf_value'] = mktime($value['hour'], $value['minute'], $value['second'], $parsed_value['month'], $parsed_value['day'], $parsed_value['year']);
                         } else {
                             $cfield[$field_id]['cf_value'] = '';
                         }
                     }
                     break;
                 default:
                     $dynamic_call = 'build_cfield_' . str_replace(' ', '_', $verbose_type);
                     if (function_exists($dynamic_call)) {
                         $cfield[$field_id]['cf_value'] = $dynamic_call($value);
                     } else {
                         if (method_exists($this, $dynamic_call)) {
                             $cfield[$field_id]['cf_value'] = $this->{$dynamic_call}($value);
                         } else {
                             $cfield[$field_id]['cf_value'] = $value;
                         }
                     }
                     break;
             }
         }
         // foreach
     }
     return $cfield;
 }
Exemplo n.º 7
0
/**
 * Check if a localized timestamp is valid
 * uses split_localized_date()
 *
 */
function is_valid_date($timestamp, $dateFormat)
{
    $date_array = split_localized_date($timestamp, $dateFormat);
    $status_ok = false;
    if ($date_array != null) {
        $status_ok = checkdate($date_array['month'], $date_array['day'], $date_array['year']);
    }
    return $status_ok;
}
 /**
  *
  */
 protected function init_filter_custom_fields($application_areas = null)
 {
     $key = 'filter_custom_fields';
     $locale = isset($_SESSION['locale']) ? $_SESSION['locale'] : 'en_GB';
     $localesDateFormat = config_get('locales_date_format');
     $date_format = str_replace('%', '', $localesDateFormat[$locale]);
     $collapsed = isset($_SESSION['cf_filter_collapsed']) ? $_SESSION['cf_filter_collapsed'] : 0;
     $collapsed = isset($_REQUEST['btn_toggle_cf']) ? !$collapsed : $collapsed;
     $_SESSION['cf_filter_collapsed'] = $collapsed;
     $btn_label = $collapsed ? lang_get('btn_show_cf') : lang_get('btn_hide_cf');
     $cfields = $this->getCustomFields($application_areas);
     $cf_prefix = $this->cfield_mgr->name_prefix;
     $cf_html_code = "";
     $selection = array();
     $this->filters[$key] = false;
     $this->active_filters[$key] = null;
     if (!is_null($cfields)) {
         $cfInputOpt = array('name_suffix' => '', 'field_size' => self::CF_INPUT_SIZE, 'show_on_filters' => true, 'remove_required' => true);
         foreach ($cfields as $cf_id => $cf) {
             // has a value been selected?
             $id = $cf['id'];
             $type = $cf['type'];
             $verbose_type = trim($this->cfield_mgr->custom_field_types[$type]);
             $cf_input_name = "{$cf_prefix}{$type}_{$id}";
             // set special size for list inputs
             if ($verbose_type == 'list' || $verbose_type == 'multiselection list') {
                 $cfInputOpt['field_size'] = 3;
             }
             // custom fields on test spec did not retain value after apply
             // IMPORTANT/CRITIC issue:  trim() on array makes array = null !!!
             $value = isset($_REQUEST[$cf_input_name]) ? $_REQUEST[$cf_input_name] : null;
             if ($this->args->reset_filters) {
                 $value = null;
             } else {
                 if ($verbose_type == 'datetime') {
                     // convert the three given values to unixtime format
                     if (isset($_REQUEST[$cf_input_name . '_input']) && $_REQUEST[$cf_input_name . '_input'] != '' && isset($_REQUEST[$cf_input_name . '_hour']) && $_REQUEST[$cf_input_name . '_hour'] != '' && isset($_REQUEST[$cf_input_name . '_minute']) && $_REQUEST[$cf_input_name . '_minute'] != '' && isset($_REQUEST[$cf_input_name . '_second']) && $_REQUEST[$cf_input_name . '_second'] != '') {
                         $date = $_REQUEST[$cf_input_name . '_input'];
                         $hour = $_REQUEST[$cf_input_name . '_hour'];
                         $minute = $_REQUEST[$cf_input_name . '_minute'];
                         $second = $_REQUEST[$cf_input_name . '_second'];
                         $date_array = split_localized_date($date, $date_format);
                         $value = mktime($hour, $minute, $second, $date_array['month'], $date_array['day'], $date_array['year']);
                     }
                 }
                 if ($verbose_type == 'date') {
                     // convert the three given values to unixtime format, only set values if different from 0
                     if (isset($_REQUEST[$cf_input_name . '_input']) && $_REQUEST[$cf_input_name . '_input'] != '') {
                         $date = $_REQUEST[$cf_input_name . '_input'];
                         $date_array = split_localized_date($date, $date_format);
                         $value = mktime(0, 0, 0, $date_array['month'], $date_array['day'], $date_array['year']);
                     }
                 }
             }
             $value2display = $value;
             if (!is_null($value2display) && is_array($value2display)) {
                 $value2display = implode("|", $value2display);
             } else {
                 $value = trim($value);
                 $value2display = $value;
             }
             $cf['value'] = $value2display;
             if (!is_null($value) && $value != '') {
                 $this->do_filtering = true;
                 $selection[$id] = $value;
             }
             $label = str_replace(TL_LOCALIZE_TAG, '', lang_get($cf['label'], null, LANG_GET_NO_WARNING));
             // don't show textarea inputs here, they are too large for filterpanel
             if ($verbose_type != 'text area') {
                 $cf_html_code .= '<tr class="cfRow"><td>' . htmlspecialchars($label) . '</td><td>' . $this->cfield_mgr->string_custom_field_input($cf, $cfInputOpt) . '</td></tr>';
             }
         }
         // show/hide CF
         $this->filters[$key] = array('items' => $cf_html_code, 'btn_label' => $btn_label, 'collapsed' => $collapsed);
         $this->active_filters[$key] = count($selection) ? $selection : null;
     }
 }
Exemplo n.º 9
0
/**
 * 
 *
 */
function getFilters(&$argsObj = null, $dateFormat = null)
{
    $filters = new stdClass();
    $filters->startTime = null;
    $filters->endTime = null;
    $filters->users = null;
    if (!is_null($argsObj)) {
        if ($argsObj->startDate != "") {
            $date_array = split_localized_date($argsObj->startDate, $dateFormat);
            if ($date_array != null) {
                // convert localized date to date that strtotime understands -> en_US: m/d/Y:
                $filters->startTime = strToTime($date_array['month'] . "/" . $date_array['day'] . "/" . $date_array['year']);
            }
            if ($filters->startTime == "") {
                $filters->startTime = null;
            }
        }
        if ($argsObj->endDate != "") {
            $date_array = split_localized_date($argsObj->endDate, $dateFormat);
            if ($date_array != null) {
                // convert localized date to date that strtotime understands -> en_US: m/d/Y:
                // end time must end at selected day at 23:59:59
                $filters->endTime = strToTime($date_array['month'] . "/" . $date_array['day'] . "/" . $date_array['year'] . ", 23:59:59");
            }
            if (!$filters->endTime) {
                $filters->endTime = null;
            }
        }
        if (!is_null($argsObj->testers)) {
            $filters->users = implode(",", $argsObj->testers);
            if (!$filters->users) {
                $filters->users = null;
            }
        }
    }
    return $filters;
}
Exemplo n.º 10
0
/**
 *
 *
 */
function init_args($dateFormat)
{
    $args = new stdClass();
    // BUGID 3716
    $iParams = array("keyword_id" => array(tlInputParameter::INT_N), "version" => array(tlInputParameter::INT_N, 999), "custom_field_id" => array(tlInputParameter::INT_N), "name" => array(tlInputParameter::STRING_N, 0, 50), "summary" => array(tlInputParameter::STRING_N, 0, 50), "steps" => array(tlInputParameter::STRING_N, 0, 50), "expected_results" => array(tlInputParameter::STRING_N, 0, 50), "custom_field_value" => array(tlInputParameter::STRING_N, 0, 20), "targetTestCase" => array(tlInputParameter::STRING_N, 0, 30), "preconditions" => array(tlInputParameter::STRING_N, 0, 50), "requirement_doc_id" => array(tlInputParameter::STRING_N, 0, 32), "importance" => array(tlInputParameter::INT_N), "creation_date_from" => array(tlInputParameter::STRING_N), "creation_date_to" => array(tlInputParameter::STRING_N), "modification_date_from" => array(tlInputParameter::STRING_N), "modification_date_to" => array(tlInputParameter::STRING_N));
    $args = new stdClass();
    R_PARAMS($iParams, $args);
    // BUGID 4066 - take care of proper escaping when magic_quotes_gpc is enabled
    $_REQUEST = strings_stripSlashes($_REQUEST);
    $args->userID = isset($_SESSION['userID']) ? $_SESSION['userID'] : 0;
    $args->tproject_id = isset($_REQUEST['tproject_id']) ? intval($_REQUEST['tproject_id']) : 0;
    // BUGID 3716
    // convert "creation date from" to iso format for database usage
    if (isset($args->creation_date_from) && $args->creation_date_from != '') {
        $date_array = split_localized_date($args->creation_date_from, $dateFormat);
        if ($date_array != null) {
            // set date in iso format
            $args->creation_date_from = $date_array['year'] . "-" . $date_array['month'] . "-" . $date_array['day'];
        }
    }
    // convert "creation date to" to iso format for database usage
    if (isset($args->creation_date_to) && $args->creation_date_to != '') {
        $date_array = split_localized_date($args->creation_date_to, $dateFormat);
        if ($date_array != null) {
            // set date in iso format
            // date to means end of selected day -> add 23:59:59 to selected date
            $args->creation_date_to = $date_array['year'] . "-" . $date_array['month'] . "-" . $date_array['day'] . " 23:59:59";
        }
    }
    // convert "modification date from" to iso format for database usage
    if (isset($args->modification_date_from) && $args->modification_date_from != '') {
        $date_array = split_localized_date($args->modification_date_from, $dateFormat);
        if ($date_array != null) {
            // set date in iso format
            $args->modification_date_from = $date_array['year'] . "-" . $date_array['month'] . "-" . $date_array['day'];
        }
    }
    //$args->modification_date_to = strtotime($args->modification_date_to);
    // convert "creation date to" to iso format for database usage
    if (isset($args->modification_date_to) && $args->modification_date_to != '') {
        $date_array = split_localized_date($args->modification_date_to, $dateFormat);
        if ($date_array != null) {
            // set date in iso format
            // date to means end of selected day -> add 23:59:59 to selected date
            $args->modification_date_to = $date_array['year'] . "-" . $date_array['month'] . "-" . $date_array['day'] . " 23:59:59";
        }
    }
    return $args;
}
Exemplo n.º 11
0
/**
 * initialize Gui
 */
function initializeGui(&$dbHandler, &$argsObj, $dateFormat)
{
    $reports_cfg = config_get('reportsCfg');
    $gui = new stdClass();
    $tplan_mgr = new testplan($dbHandler);
    $tproject_mgr = new testproject($dbHandler);
    $getOpt = array('outputFormat' => 'map');
    $gui->platformSet = $tplan_mgr->getPlatforms($argsObj->tplan_id, $getOpt);
    $gui->title = lang_get('query_metrics_report');
    $gui->showPlatforms = true;
    if (is_null($gui->platformSet)) {
        $gui->platformSet = array('');
        $gui->showPlatforms = false;
    }
    $gui->resultsCfg = config_get('results');
    // BUGID 3716, BUGID 3930
    // convert starttime to iso format for database usage
    if (isset($_REQUEST['selected_start_date']) && $_REQUEST['selected_start_date'] != '') {
        $date_array = split_localized_date($_REQUEST['selected_start_date'], $dateFormat);
        if ($date_array != null) {
            // set date in iso format
            $gui->startTime = $date_array['year'] . "-" . $date_array['month'] . "-" . $date_array['day'];
        }
    }
    // convert starttime to iso format for database usage
    if (isset($_REQUEST['selected_end_date']) && $_REQUEST['selected_end_date'] != '') {
        $date_array = split_localized_date($_REQUEST['selected_end_date'], $dateFormat);
        if ($date_array != null) {
            // set date in iso format
            $gui->endTime = $date_array['year'] . "-" . $date_array['month'] . "-" . $date_array['day'];
        }
    }
    $start_hour = isset($_REQUEST['start_Hour']) ? $_REQUEST['start_Hour'] : "00";
    $gui->startTime = $gui->startTime . " " . $start_hour . ":00:00";
    $end_hour = isset($_REQUEST['end_Hour']) ? $_REQUEST['end_Hour'] : "00";
    $gui->endTime = $gui->endTime . " " . $end_hour . ":59:59";
    $gui_open = config_get('gui_separator_open');
    $gui_close = config_get('gui_separator_close');
    $gui->str_option_any = $gui_open . lang_get('any') . $gui_close;
    $gui->str_option_none = $gui_open . lang_get('nobody') . $gui_close;
    $gui->search_notes_string = $argsObj->search_notes_string;
    $gui->tplan_id = $argsObj->tplan_id;
    $gui->tproject_id = $argsObj->tproject_id;
    $tplan_info = $tplan_mgr->get_by_id($gui->tplan_id);
    $tproject_info = $tproject_mgr->get_by_id($gui->tproject_id);
    $gui->tplan_name = $tplan_info['name'];
    $gui->tproject_name = $tproject_info['name'];
    $testsuiteIds = null;
    $testsuiteNames = null;
    $tsuites_qty = sizeOf($argsObj->testsuitesSelected);
    for ($id = 0; $id < $tsuites_qty; $id++) {
        list($suiteId, $suiteName) = preg_split("/\\,/", $argsObj->testsuitesSelected[$id], 2);
        $testsuiteIds[$id] = $suiteId;
        $testsuiteNames[$id] = $suiteName;
    }
    $buildsToQuery = -1;
    if (sizeof($argsObj->buildsSelected)) {
        $buildsToQuery = implode(",", $argsObj->buildsSelected);
    }
    // statusForClass is used for results.class.php
    // lastStatus is used to be displayed
    $statusForClass = 'a';
    // amitkhullar - added this parameter to get the latest results.
    $latest_resultset = $argsObj->display->latest_results;
    // BUGID 2500
    // $assignee = $argsObj->ownerSelected ? TL_USER_ANYBODY : null;
    // $tester = $argsObj->executorSelected ? TL_USER_ANYBODY : null;
    $assignee = $argsObj->ownerSelected > 0 ? $argsObj->ownerSelected : TL_USER_ANYBODY;
    $tester = $argsObj->executorSelected > 0 ? $argsObj->executorSelected : TL_USER_ANYBODY;
    // BUGID 4027
    $re = new newResults($dbHandler, $tplan_mgr, $tproject_info, $tplan_info, $testsuiteIds, $buildsToQuery, $argsObj->platformsSelected, $statusForClass, $latest_resultset, $argsObj->keywordSelected, $assignee, $gui->startTime, $gui->endTime, $tester, $argsObj->search_notes_string, null);
    $gui->suiteList = $re->getSuiteList();
    // test executions results
    // Filter test cases on selected platforms
    foreach ($gui->suiteList as $suiteid => $tcases) {
        $filtered = array();
        foreach ($tcases as $index => $tcase) {
            if ($tcase['platform_id'] == 0 || $argsObj->platformsSelected[0] == ALL_PLATFORMS || array_search($tcase['platform_id'], $argsObj->platformsSelected) !== false) {
                array_push($filtered, $tcase);
            }
        }
        unset($gui->suiteList[$suiteid]);
        $gui->suiteList[$suiteid] = $filtered;
    }
    $gui->flatArray = $re->getFlatArray();
    $gui->mapOfSuiteSummary = $re->getAggregateMap();
    $gui->totals = new stdClass();
    $gui->totals->items = $re->getTotalsForPlan();
    $gui->totals->labels = array();
    foreach ($gui->totals->items as $key => $value) {
        $l18n = $key == 'total' ? 'th_total_cases' : $gui->resultsCfg['status_label'][$key];
        $gui->totals->labels[$key] = lang_get($l18n);
    }
    // BUGID 2012 - franciscom
    $gui->keywords = new stdClass();
    $gui->keywords->items[0] = $gui->str_option_any;
    if (!is_null($tplan_keywords_map = $tplan_mgr->get_keywords_map($gui->tplan_id))) {
        $gui->keywords->items += $tplan_keywords_map;
    }
    $gui->keywords->qty = count($gui->keywords->items);
    $gui->keywordSelected = $gui->keywords->items[$argsObj->keywordSelected];
    $gui->builds_html = $tplan_mgr->get_builds_for_html_options($gui->tplan_id);
    $gui->users = getUsersForHtmlOptions($dbHandler, ALL_USERS_FILTER, array(TL_USER_ANYBODY => $gui->str_option_any));
    $gui->ownerSelected = $gui->users[$argsObj->ownerSelected];
    $gui->executorSelected = $gui->users[$argsObj->executorSelected];
    $gui->testsuitesSelected = $testsuiteNames;
    $gui->buildsSelected = $argsObj->buildsSelected;
    $gui->platformsSelected = $argsObj->platformsSelected;
    $gui->display = $argsObj->display;
    // init display rows attribute and some status localized labels
    $gui->displayResults = array();
    $gui->lastStatus = array();
    foreach ($reports_cfg->exec_status as $verbose => $label) {
        $gui->displayResults[$gui->resultsCfg['status_code'][$verbose]] = false;
    }
    foreach ($gui->resultsCfg['status_label'] as $status_verbose => $label_key) {
        $gui->statusLabels[$gui->resultsCfg['status_code'][$status_verbose]] = lang_get($label_key);
    }
    $lastStatus_localized = null;
    foreach ($argsObj->lastStatus as $key => $status_code) {
        $verbose = $gui->resultsCfg['code_status'][$status_code];
        $gui->displayResults[$status_code] = true;
        $lastStatus_localized[] = lang_get($gui->resultsCfg['status_label'][$verbose]);
    }
    $gui->lastStatus = $lastStatus_localized;
    return $gui;
}
/**
* initialize Gui
*/
function initializeGui(&$db, &$args, $dateFormat)
{
    $gui = new stdClass();
    $gui->glueChar = config_get('testcase_cfg')->glue_character;
    $gui->tproject_id = $args->tproject_id;
    $gui->tproject_name = $args->tproject_name;
    $gui->warning_msg = '';
    $gui->tableSet = null;
    $history_img = TL_THEME_IMG_DIR . "history_small.png";
    $exec_img = TL_THEME_IMG_DIR . "exec_icon.png";
    $edit_img = TL_THEME_IMG_DIR . "edit_icon.png";
    $l18n = init_labels(array('tcversion_indicator' => null, 'goto_testspec' => null, 'version' => null, 'testplan' => null, 'assigned_tc_overview' => null, 'testcases_created_per_user' => null, 'design' => null, 'execution' => null, 'execution_history' => null, 'low_priority' => null, 'medium_priority' => null, 'high_priority' => null));
    $gui->pageTitle = sprintf($l18n['testcases_created_per_user'], $gui->tproject_name);
    $results_config = config_get('results');
    $map_status_code = $results_config['status_code'];
    $map_code_status = $results_config['code_status'];
    $map_status_label = $results_config['status_label'];
    $map_statuscode_css = array();
    foreach ($map_code_status as $code => $status) {
        if (isset($map_status_label[$status])) {
            $label = $map_status_label[$status];
            $map_statuscode_css[$code] = array();
            $map_statuscode_css[$code]['translation'] = lang_get($label);
            $map_statuscode_css[$code]['css_class'] = $map_code_status[$code] . '_text';
        }
    }
    $options = new stdClass();
    // convert starttime to iso format for database usage
    if (isset($args->selected_start_date) && sizeof($args->selected_start_date) > 0) {
        $date_array = split_localized_date($args->selected_start_date[0], $dateFormat);
        if ($date_array != null) {
            // set date in iso format
            $options->startTime = $date_array['year'] . "-" . $date_array['month'] . "-" . $date_array['day'];
        }
    }
    // convert starttime to iso format for database usage
    if (isset($args->selected_end_date) && sizeof($args->selected_end_date) > 0) {
        $date_array = split_localized_date($args->selected_end_date[0], $dateFormat);
        if ($date_array != null) {
            // set date in iso format
            $options->endTime = $date_array['year'] . "-" . $date_array['month'] . "-" . $date_array['day'];
        }
    }
    $start_hour = isset($args->start_Hour) ? $args->start_Hour : "00";
    $options->startTime = $options->startTime . " " . $start_hour . ":00:00";
    $end_hour = isset($args->end_Hour) ? $args->end_Hour : "00";
    $options->endTime = $options->endTime . " " . $end_hour . ":59:59";
    $options->mode = 'full_path';
    // TBD: remove it
    $options->tplan_id = $args->tplan_id;
    // used to retrieve test cases from
    $tcase_mgr = new testcase($db);
    $gui->resultSet = $tcase_mgr->get_created_per_user($args->user_id, $args->tproject_id, $options);
    if (!is_null($gui->resultSet)) {
        $tables = tlObjectWithDB::getDBTables(array('nodes_hierarchy'));
        $tplanSet = array_keys($gui->resultSet);
        $sql = "SELECT name,id FROM {$tables['nodes_hierarchy']} " . "WHERE id IN (" . implode(',', $tplanSet) . ")";
        $gui->tplanNames = $db->fetchRowsIntoMap($sql, 'id');
        $optColumns = array('priority' => $args->priority_enabled);
        // For each test case set under a test plan ID, create the rows and columns
        foreach ($gui->resultSet as $tplan_id => $tcase_set) {
            list($columns, $sortByColumn) = getColumnsDefinition($optColumns);
            $rows = array();
            foreach ($tcase_set as $tcase_platform) {
                foreach ($tcase_platform as $tcase) {
                    $current_row = array();
                    $tcase_id = $tcase['testcase_id'];
                    $tcversion_id = $tcase['tcversion_id'];
                    $current_row[] = htmlspecialchars($tcase['login']);
                    $current_row[] = htmlspecialchars($tcase['tcase_full_path']);
                    // Create linked icons
                    $exec_history_link = "<a href=\"javascript:openExecHistoryWindow({$tcase_id});\">" . "<img title=\"{$l18n['execution_history']}\" src=\"{$history_img}\" /></a> ";
                    $edit_link = "<a href=\"javascript:openTCEditWindow({$tcase_id});\">" . "<img title=\"{$l18n['design']}\" src=\"{$edit_img}\" /></a> ";
                    $current_row[] = "<!-- " . sprintf("%010d", $tcase['tc_external_id']) . " -->" . $exec_history_link . $edit_link . htmlspecialchars($tcase['prefix']) . $gui->glueChar . $tcase['tc_external_id'] . " : " . htmlspecialchars($tcase['name']) . sprintf($l18n['tcversion_indicator'], $tcase['version']);
                    $last_execution = $tcase_mgr->get_last_execution($tcase_id, $tcversion_id, $tplan_id, $tcase['build_id'], $tcase['platform_id']);
                    $status = $last_execution[$tcversion_id]['status'];
                    if (!$status) {
                        $status = $map_status_code['not_run'];
                    }
                    $current_row[] = array("value" => $status, "text" => $map_statuscode_css[$status]['translation'], "cssClass" => $map_statuscode_css[$status]['css_class']);
                    $current_row[] = $tcase['creation_ts'];
                    $current_row[] = $tcase['modification_ts'];
                    // add this row to the others
                    $rows[] = $current_row;
                }
            }
            // Different table ID for different reports:
            $table_id = "tl_table_tc_created_per_user_";
            // Add test plan ID to table ID
            $table_id .= $tplan_id;
            $matrix = new tlExtTable($columns, $rows, $table_id);
            $matrix->title = $l18n['testplan'] . ": " . htmlspecialchars($gui->tplanNames[$tplan_id]['name']);
            // Default grouping by first column, which is user for overview, build otherwise
            $matrix->setGroupByColumnName(lang_get($columns[0]['title_key']));
            // Make table collapsible if more than 1 table is shown and surround by frame
            if (count($tplanSet) > 1) {
                $matrix->collapsible = true;
                $matrix->frame = true;
            }
            // Define toolbar
            $matrix->showToolbar = true;
            $matrix->toolbarExpandCollapseGroupsButton = true;
            $matrix->toolbarShowAllColumnsButton = true;
            $matrix->setSortByColumnName($sortByColumn);
            $matrix->sortDirection = 'DESC';
            $gui->tableSet[$tplan_id] = $matrix;
        }
    }
    return $gui;
}
function helper2ISO($userInput)
{
    $dateFormatMask = config_get('date_format');
    $zy = array();
    $key2loop = array('selected_start_date' => 'startTime', 'selected_end_date' => 'endTime');
    foreach ($key2loop as $target => $prop) {
        if (isset($userInput[$target]) && $userInput[$target] != '') {
            $dummy = split_localized_date($userInput[$target], $dateFormatMask);
            if ($dummy != null) {
                $zy[$prop] = $dummy['year'] . "-" . $dummy['month'] . "-" . $dummy['day'];
            }
        }
    }
    $dummy = isset($userInput['start_Hour']) ? $userInput['start_Hour'] : "00";
    $zy['startTime'] .= " " . $dummy . ":00:00";
    $dummy = isset($userInput['end_Hour']) ? $userInput['end_Hour'] : "00";
    $zy['endTime'] .= " " . $dummy . ":59:59";
    return array($zy['startTime'], $zy['endTime']);
}
function init_args($dateFormat)
{
    $args = new stdClass();
    $_REQUEST = strings_stripSlashes($_REQUEST);
    $strnull = array('requirement_document_id', 'name', 'scope', 'reqStatus', 'custom_field_value', 'targetRequirement', 'version', 'tcid', 'reqType', 'relation_type', 'creation_date_from', 'creation_date_to', 'log_message', 'modification_date_from', 'modification_date_to');
    foreach ($strnull as $keyvar) {
        $args->{$keyvar} = isset($_REQUEST[$keyvar]) ? trim($_REQUEST[$keyvar]) : null;
        $args->{$keyvar} = !is_null($args->{$keyvar}) && strlen($args->{$keyvar}) > 0 ? trim($args->{$keyvar}) : null;
    }
    $int0 = array('custom_field_id', 'coverage');
    foreach ($int0 as $keyvar) {
        $args->{$keyvar} = isset($_REQUEST[$keyvar]) ? intval($_REQUEST[$keyvar]) : 0;
    }
    // convert "creation date from" to iso format for database usage
    if (isset($args->creation_date_from) && $args->creation_date_from != '') {
        $date_array = split_localized_date($args->creation_date_from, $dateFormat);
        if ($date_array != null) {
            // set date in iso format
            $args->creation_date_from = $date_array['year'] . "-" . $date_array['month'] . "-" . $date_array['day'];
        }
    }
    // convert "creation date to" to iso format for database usage
    if (isset($args->creation_date_to) && $args->creation_date_to != '') {
        $date_array = split_localized_date($args->creation_date_to, $dateFormat);
        if ($date_array != null) {
            // set date in iso format
            // date to means end of selected day -> add 23:59:59 to selected date
            $args->creation_date_to = $date_array['year'] . "-" . $date_array['month'] . "-" . $date_array['day'] . " 23:59:59";
        }
    }
    // convert "modification date from" to iso format for database usage
    if (isset($args->modification_date_from) && $args->modification_date_from != '') {
        $date_array = split_localized_date($args->modification_date_from, $dateFormat);
        if ($date_array != null) {
            // set date in iso format
            $args->modification_date_from = $date_array['year'] . "-" . $date_array['month'] . "-" . $date_array['day'];
        }
    }
    //$args->modification_date_to = strtotime($args->modification_date_to);
    // convert "creation date to" to iso format for database usage
    if (isset($args->modification_date_to) && $args->modification_date_to != '') {
        $date_array = split_localized_date($args->modification_date_to, $dateFormat);
        if ($date_array != null) {
            // set date in iso format
            // date to means end of selected day -> add 23:59:59 to selected date
            $args->modification_date_to = $date_array['year'] . "-" . $date_array['month'] . "-" . $date_array['day'] . " 23:59:59";
        }
    }
    $args->userID = isset($_SESSION['userID']) ? $_SESSION['userID'] : 0;
    $args->tprojectID = isset($_SESSION['testprojectID']) ? $_SESSION['testprojectID'] : 0;
    return $args;
}
Exemplo n.º 15
0
/**
 *
 *
 */
function init_args($dateFormat)
{
    $args = new stdClass();
    $iParams = array("keyword_id" => array(tlInputParameter::INT_N), "version" => array(tlInputParameter::INT_N, 999), "custom_field_id" => array(tlInputParameter::INT_N), "name" => array(tlInputParameter::STRING_N, 0, 50), "created_by" => array(tlInputParameter::STRING_N, 0, 50), "edited_by" => array(tlInputParameter::STRING_N, 0, 50), "summary" => array(tlInputParameter::STRING_N, 0, 50), "steps" => array(tlInputParameter::STRING_N, 0, 50), "expected_results" => array(tlInputParameter::STRING_N, 0, 50), "custom_field_value" => array(tlInputParameter::STRING_N, 0, 20), "targetTestCase" => array(tlInputParameter::STRING_N, 0, 30), "preconditions" => array(tlInputParameter::STRING_N, 0, 50), "requirement_doc_id" => array(tlInputParameter::STRING_N, 0, 32), "importance" => array(tlInputParameter::INT_N), "creation_date_from" => array(tlInputParameter::STRING_N), "creation_date_to" => array(tlInputParameter::STRING_N), "modification_date_from" => array(tlInputParameter::STRING_N), "modification_date_to" => array(tlInputParameter::STRING_N));
    $args = new stdClass();
    R_PARAMS($iParams, $args);
    $_REQUEST = strings_stripSlashes($_REQUEST);
    $args->userID = isset($_SESSION['userID']) ? $_SESSION['userID'] : 0;
    $args->tprojectID = isset($_SESSION['testprojectID']) ? $_SESSION['testprojectID'] : 0;
    // convert "creation date from" to iso format for database usage
    $k2w = array('creation_date_from' => '', 'creation_date_to' => " 23:59:59", 'modification_date_from' => '', 'modification_date_to' => " 23:59:59");
    $k2f = array('creation_date_from' => ' creation_ts >= ', 'creation_date_to' => 'creation_ts <= ', 'modification_date_from' => ' modification_ts >= ', 'modification_date_to' => ' modification_ts <= ');
    $filter = null;
    foreach ($k2w as $key => $value) {
        if (isset($args->{$key}) && $args->{$key} != '') {
            $da = split_localized_date($args->{$key}, $dateFormat);
            if ($da != null) {
                $args->{$key} = $da['year'] . "-" . $da['month'] . "-" . $da['day'] . $value;
                // set date in iso format
                $filter[$key] = " AND TCV.{$k2f[$key]} '{$args->{$key}}' ";
            }
        }
    }
    return array($args, $filter);
}