Beispiel #1
0
/**
 * Print header for the specified project version.
 * @param int $p_version_id a valid version id
 * @return null
 */
function print_version_header( $p_version_id ) {
	$t_project_id   = version_get_field( $p_version_id, 'project_id' );
	$t_version_name = version_get_field( $p_version_id, 'version' );
	$t_project_name = project_get_field( $t_project_id, 'name' );

	$t_release_title = '<a href="changelog_page.php?project_id=' . $t_project_id . '">' . string_display_line( $t_project_name ) . '</a> - <a href="changelog_page.php?version_id=' . $p_version_id . '">' . string_display_line( $t_version_name ) . '</a>';

	if ( config_get( 'show_changelog_dates' ) ) {
		$t_version_released = version_get_field( $p_version_id, 'released' );
		$t_release_timestamp = version_get_field( $p_version_id, 'date_order' );

		if ( (bool) $t_version_released ) {
			$t_release_date = ' (' . lang_get('released') . ' ' . string_display_line( date( config_get( 'short_date_format' ), $t_release_timestamp ) ) . ')';
		} else {
			$t_release_date = ' (' . lang_get( 'not_released' ) . ')';
		}
	} else {
		$t_release_date = '';
	}

	echo '<br />', $t_release_title, $t_release_date, lang_get( 'word_separator' ), print_bracket_link( 'view_all_set.php?type=1&temporary=y&' . FILTER_PROPERTY_PROJECT_ID . '=' . $t_project_id . '&' . filter_encode_field_and_value( FILTER_PROPERTY_FIXED_IN_VERSION, $t_version_name ), lang_get( 'view_bugs_link' ) ), '<br />';

	$t_release_title_without_hyperlinks = $t_project_name . ' - ' . $t_version_name . $t_release_date;
	echo utf8_str_pad( '', utf8_strlen( $t_release_title_without_hyperlinks ), '=' ), '<br />';
}
Beispiel #2
0
function print_version_header($p_version_id)
{
    $t_project_id = version_get_field($p_version_id, 'project_id');
    $t_version_name = version_get_field($p_version_id, 'version');
    $t_project_name = project_get_field($t_project_id, 'name');
    $t_release_title = string_display($t_project_name) . ' - ' . string_display($t_version_name);
    echo '<tt>';
    echo '<br />', $t_release_title, '<br />';
    echo str_pad('', strlen($t_release_title), '='), '<br />';
}
function print_version_header($p_version_id)
{
    $t_project_id = version_get_field($p_version_id, 'project_id');
    $t_version_name = version_get_field($p_version_id, 'version');
    $t_project_name = project_get_field($t_project_id, 'name');
    $t_release_title = string_display($t_project_name) . ' - ' . string_display($t_version_name);
    echo $t_release_title, '<br />';
    echo str_pad('', strlen($t_release_title), '='), '<br />';
    $t_description = version_get_field($p_version_id, 'description');
    if ($t_description !== false && !is_blank($t_description)) {
        echo string_display("<br />{$t_description}<br /><br />");
    }
}
/**
 * @param $print_flag
 */
function calculate_page_content($print_flag)
{
    $specmanagement_database_api = new specmanagement_database_api();
    $specmanagement_print_api = new specmanagement_print_api();
    $specmanagement_editor_api = new specmanagement_editor_api();
    $version_id = $_POST['version_id'];
    $version_spec_bug_ids = $specmanagement_database_api->get_version_spec_bugs(version_get_field($version_id, 'version'));
    if (!is_null($version_spec_bug_ids)) {
        /** get bug and work package data */
        $plugin_version_obj = $specmanagement_database_api->get_plugin_version_row_by_version_id($version_id);
        $p_version_id = $plugin_version_obj[0];
        foreach ($version_spec_bug_ids as $version_spec_bug_id) {
            $p_source_row = $specmanagement_database_api->get_source_row($version_spec_bug_id);
            if (is_null($p_source_row[2])) {
                $specmanagement_database_api->update_source_row($version_spec_bug_id, $p_version_id, '');
            }
        }
        $work_packages = $specmanagement_database_api->get_document_spec_workpackages($p_version_id);
        asort($work_packages);
        $no_work_package_bug_ids = $specmanagement_database_api->get_workpackage_spec_bugs($p_version_id, '');
        /** get type options */
        $type_string = $specmanagement_database_api->get_type_string($specmanagement_database_api->get_type_by_version($version_id));
        $type_id = $specmanagement_database_api->get_type_id($type_string);
        $type_row = $specmanagement_database_api->get_type_row($type_id);
        $type_options = explode(';', $type_row[2]);
        /** generate and print page content */
        $specmanagement_editor_api->print_document_head($type_string, $version_id, $version_spec_bug_ids, $print_flag);
        if ($type_options[2] == '1') {
            $specmanagement_editor_api->print_directory($p_version_id, $work_packages, $no_work_package_bug_ids, $type_options[0], $print_flag);
        }
        $specmanagement_editor_api->print_editor_table_head($print_flag);
        $specmanagement_editor_api->generate_content($p_version_id, $work_packages, $no_work_package_bug_ids, $type_options[0], true, $print_flag);
        echo '</table>';
        if ($type_options[1] == '1') {
            $specmanagement_editor_api->print_expenses_overview($work_packages, $p_version_id, $print_flag, $no_work_package_bug_ids);
        }
    } else {
        echo '<br/>';
        $specmanagement_editor_api->print_editor_table_head($print_flag);
        echo '<tr><td class="center">';
        echo plugin_lang_get('editor_no_issues');
        echo '</td></tr>';
        $specmanagement_print_api->printTableFoot();
    }
}
/**
 * @param $types
 */
function print_document_selection($types)
{
    $project_id = gpc_get_int('project_id', helper_get_current_project());
    $specmanagement_database_api = new specmanagement_database_api();
    echo '<select name="version_id">';
    foreach ($types as $type) {
        $type_string = string_html_specialchars($type);
        $type_id = $specmanagement_database_api->get_type_id($type);
        $version_id_array = get_version_ids($type_id, $project_id);
        foreach ($version_id_array as $version_id) {
            $version_spec_project_id = version_get_field($version_id, 'project_id');
            if (project_includes_user($version_spec_project_id, auth_get_current_user_id()) || user_is_administrator(auth_get_current_user_id())) {
                $version_string = version_full_name($version_id);
                echo '<option value="' . $version_id . '">';
                echo $type_string . " - " . $version_string;
                echo '</option>';
            }
        }
    }
    echo '</select>';
}
Beispiel #6
0
/**
 * Submit the specified version details.
 *
 * @param string $p_username  The name of the user trying to update the issue.
 * @param string $p_password  The password of the user.
 * @param integer $p_version_id A version's id
 * @param Array $p_version  A ProjectVersionData structure containing information about the new verison.
 * @return bool returns true or false depending on the success of the update action
 */
function mc_project_version_update($p_username, $p_password, $p_version_id, $p_version)
{
    $t_user_id = mci_check_login($p_username, $p_password);
    if ($t_user_id === false) {
        return new soap_fault('Client', '', 'Access Denied', 'Username/password combination was incorrect');
    }
    if (!mci_has_administrator_access($t_user_id)) {
        return new soap_fault('Client', '', 'Access Denied', 'User does not have administrator access');
    }
    if (is_blank($p_version_id)) {
        return new soap_fault('Client', '', 'Mandatory field "version_id" was missing');
    }
    if (!version_exists($p_version_id)) {
        return new soap_fault('Client', '', "Version '{$p_version_id}' does not exist.");
    }
    extract($p_version, EXTR_PREFIX_ALL, 'v');
    if (is_blank($v_project_id)) {
        return new soap_fault('Client', '', 'Mandatory field "project_id" was missing');
    }
    if (!project_exists($v_project_id)) {
        return new soap_fault('Client', '', "Version '{$v_project_id}' does not exist.");
    }
    if (is_blank($v_name)) {
        return new soap_fault('Client', '', 'Mandatory field "name" was missing');
    }
    # check for duplicates
    $t_old_version_name = version_get_field($p_version_id, 'version');
    if (strtolower($t_old_version_name) != strtolower($v_name) && !version_is_unique($v_name, $v_project_id)) {
        return new soap_fault('Client', '', 'Version exists for project', 'The version you attempted to update already exists for this project');
    }
    if ($v_released === false) {
        $v_released = VERSION_FUTURE;
    } else {
        $v_released = VERSION_RELEASED;
    }
    $t_version_data = new VersionData();
    $t_version_data->id = $p_version_id;
    $t_version_data->project_id = $v_project_id;
    $t_version_data->version = $v_name;
    $t_version_data->description = $v_description;
    $t_version_data->released = $v_released;
    $t_version_data->date_order = date("Y-m-d H:i:s", strtotime($v_date_order));
    return version_update($t_version_data);
}
        version_add($project_id, $new_version_name_trimmed, false, '', $new_version_date_timestamp);
    }
}
/**
 * Change all existing versions
 */
if ($update && isset($_POST['version_ids'])) {
    $version_ids = $_POST['version_ids'];
    $versions = $_POST['version'];
    $date_order = $_POST['date_order'];
    $type = $_POST['type'];
    $description = $_POST['description'];
    for ($version_index = 0; $version_index < count($version_ids); $version_index++) {
        $version = version_get($version_ids[$version_index]);
        $version_id = $version->id;
        $project_id = version_get_field($version_id, 'project_id');
        $released = null;
        $obsolete = null;
        if (isset($_POST['released' . $version_index])) {
            $released = $_POST['released' . $version_index];
        }
        if (isset($_POST['obsolete' . $version_index])) {
            $obsolete = $_POST['obsolete' . $version_index];
        }
        if (!is_null($versions)) {
            $new_version = $versions[$version_index];
            $version->version = trim($new_version);
        }
        if (is_null($released)) {
            $version->released = false;
        } else {
Beispiel #8
0
/**
 * Remove a version from the project
 * @param int $p_version_id
 * @param string $p_new_version
 * @return true
 */
function version_remove($p_version_id, $p_new_version = '')
{
    $c_version_id = db_prepare_int($p_version_id);
    version_ensure_exists($p_version_id);
    $t_old_version = version_get_field($p_version_id, 'version');
    $t_project_id = version_get_field($p_version_id, 'project_id');
    $c_project_id = db_prepare_int($t_project_id);
    $t_project_version_table = db_get_table('project_version');
    $t_bug_table = db_get_table('bug');
    $query = "DELETE FROM {$t_project_version_table}\n\t\t\t\t  WHERE id=" . db_param();
    db_query_bound($query, array($c_version_id));
    $t_project_list = array($c_project_id);
    if (config_get('subprojects_inherit_versions')) {
        $t_project_list = array_merge($t_project_list, project_hierarchy_get_all_subprojects($c_project_id, true));
    }
    $t_project_list = implode(',', $t_project_list);
    $query = "UPDATE {$t_bug_table}\n\t\t\t\t  SET version=" . db_param() . "\n\t\t\t\t  WHERE project_id IN ( {$t_project_list} ) AND version=" . db_param();
    db_query_bound($query, array($p_new_version, $t_old_version));
    $query = "UPDATE {$t_bug_table}\n\t\t\t\t  SET fixed_in_version=" . db_param() . "\n\t\t\t\t  WHERE ( project_id IN ( {$t_project_list} ) ) AND ( fixed_in_version=" . db_param() . ')';
    db_query_bound($query, array($p_new_version, $t_old_version));
    $query = "UPDATE {$t_bug_table}\n\t\t\t\t  SET target_version=" . db_param() . "\n\t\t\t\t  WHERE ( project_id IN ( {$t_project_list} ) ) AND ( target_version=" . db_param() . ')';
    db_query_bound($query, array($p_new_version, $t_old_version));
    # db_query errors on failure so:
    return true;
}
Beispiel #9
0
function version_remove($p_version_id, $p_new_version = '')
{
    $c_version_id = db_prepare_int($p_version_id);
    $c_new_version = db_prepare_string($p_new_version);
    version_ensure_exists($p_version_id);
    $t_old_version = version_get_field($p_version_id, 'version');
    $t_project_id = version_get_field($p_version_id, 'project_id');
    $c_old_version = db_prepare_string($t_old_version);
    $c_project_id = db_prepare_int($t_project_id);
    $t_project_version_table = config_get('mantis_project_version_table');
    $t_bug_table = config_get('mantis_bug_table');
    $query = "DELETE FROM {$t_project_version_table}\r\n\t\t\t\t  WHERE id='{$c_version_id}'";
    db_query($query);
    $query = "UPDATE {$t_bug_table}\r\n\t\t\t\t  SET version='{$c_new_version}'\r\n\t\t\t\t  WHERE project_id='{$c_project_id}' AND version='{$c_old_version}'";
    db_query($query);
    $query = "UPDATE {$t_bug_table}\r\n\t\t\t\t  SET fixed_in_version='{$c_new_version}'\r\n\t\t\t\t  WHERE ( project_id='{$c_project_id}' ) AND ( fixed_in_version='{$c_old_version}' )";
    db_query($query);
    # db_query() errors on failure so:
    return true;
}
/**
 * Delete a version.
 *
 * @param string  $p_username   The name of the user trying to delete the version.
 * @param string  $p_password   The password of the user.
 * @param integer $p_version_id A version's id.
 * @return boolean returns true or false depending on the success of the delete action
 */
function mc_project_version_delete($p_username, $p_password, $p_version_id)
{
    global $g_project_override;
    $t_user_id = mci_check_login($p_username, $p_password);
    if ($t_user_id === false) {
        return mci_soap_fault_login_failed();
    }
    if (is_blank($p_version_id)) {
        return SoapObjectsFactory::newSoapFault('Client', 'Mandatory field "version_id" was missing');
    }
    if (!version_exists($p_version_id)) {
        return SoapObjectsFactory::newSoapFault('Client', 'Version \'' . $p_version_id . '\' does not exist.');
    }
    $t_project_id = version_get_field($p_version_id, 'project_id');
    $g_project_override = $t_project_id;
    if (!mci_has_readwrite_access($t_user_id, $t_project_id)) {
        return mci_soap_fault_access_denied($t_user_id);
    }
    if (!mci_has_access(config_get('manage_project_threshold'), $t_user_id, $t_project_id)) {
        return mci_soap_fault_access_denied($t_user_id);
    }
    return version_remove($p_version_id);
}
Beispiel #11
0
        error_parameters($f_project);
        trigger_error(ERROR_PROJECT_NOT_FOUND, ERROR);
    }
}
$f_version = gpc_get_string('version', '');
if (is_blank($f_version)) {
    $f_version_id = gpc_get_int('version_id', -1);
    # If both version_id and project_id parameters are supplied, then version_id take precedence.
    if ($f_version_id == -1) {
        if ($f_project_id == -1) {
            $t_project_id = helper_get_current_project();
        } else {
            $t_project_id = $f_project_id;
        }
    } else {
        $t_project_id = version_get_field($f_version_id, 'project_id');
    }
} else {
    if ($f_project_id == -1) {
        $t_project_id = helper_get_current_project();
    } else {
        $t_project_id = $f_project_id;
    }
    $f_version_id = version_get_id($f_version, $t_project_id);
    if ($f_version_id === false) {
        error_parameters($f_version);
        trigger_error(ERROR_VERSION_NOT_FOUND, ERROR);
    }
}
if (ALL_PROJECTS == $t_project_id) {
    $t_project_ids_to_check = user_get_all_accessible_projects($t_user_id, ALL_PROJECTS);
Beispiel #12
0
 }
 $t_html_message = ob_get_contents();
 ob_end_clean();
 $t_id_list = array();
 if (plugin_config_get('notify_handler', PLUGINS_RELEASEMGT_NOTIFY_HANDLER_DEFAULT) == ON) {
     $t_user_list = project_get_all_user_rows($t_project_id, config_get('handle_bug_threshold'));
     foreach ($t_user_list as $t_user) {
         $t_id_list[] = $t_user['id'];
     }
 }
 // Get reporter
 if (plugin_config_get('notify_reporter', PLUGINS_RELEASEMGT_NOTIFY_REPORTER_DEFAULT) == ON) {
     if ($t_version == 0) {
         $t_query = 'SELECT reporter_id FROM ' . db_get_table('mantis_bug_table') . ' WHERE project_id=' . db_prepare_int($t_project_id) . ' AND fixed_in_version=\'\'';
     } else {
         $t_query = 'SELECT reporter_id FROM ' . db_get_table('mantis_bug_table') . ' WHERE project_id=' . db_prepare_int($t_project_id) . ' AND fixed_in_version=\'' . db_prepare_string(version_get_field($t_version, 'version')) . '\'';
     }
     $t_result = db_query($t_query);
     while ($t_row = db_fetch_array($t_result)) {
         $t_id_list[] = $t_row['reporter_id'];
     }
 }
 for ($i = 0; $i < count($t_id_list); $i++) {
     $t_id_list[$i] = user_get_email($t_id_list[$i]);
 }
 // Add users
 $t_emails = explode(',', plugin_config_get('notify_email', PLUGINS_RELEASEMGT_NOTIFY_EMAIL_DEFAULT));
 foreach ($t_emails as $t_email) {
     if (trim($t_email) != '') {
         $t_id_list[] = trim($t_email);
     }
/**
 * information about unreachable issues cause of missing project assignment
 *
 * @param $data_row
 */
function remark_unreachable_issues($data_row)
{
    $user_id = $data_row['user_id'];
    $assigned_project_id = $data_row['assigned_project_id'];
    $assigned_to_project = userprojectapi::get_assigned_to_project($user_id, $assigned_project_id);
    $unreachable_issue = userprojectapi::get_unreachable_issue($assigned_to_project);
    if ($unreachable_issue) {
        $target_version_id = $data_row['target_version_id'];
        $target_version = '';
        if (strlen($target_version_id) > 0) {
            $target_version = version_get_field($target_version_id, 'version');
        }
        echo '<a href="search.php?project_id=' . $assigned_project_id . userprojectapi::prepare_filter_string() . '&amp;handler_id=' . userprojectapi::get_link_user_id($user_id) . '&amp;sticky_issues=on' . '&amp;target_version=' . $target_version . '&amp;sortby=last_updated' . '&amp;dir=DESC' . '&amp;hide_status_id=-2' . '&amp;match_type=0">';
        echo wordwrap(plugin_lang_get('remark_noProject'), 30, '<br />');
        echo '</a>';
        echo '<br/>' . PHP_EOL;
    }
}
 /**
  * @param $type_string
  * @param $version_id
  * @param $print_flag
  */
 public function print_editor_table_title($type_string, $version_id, $print_flag)
 {
     echo '<tr>';
     echo '<td class="document_title_label">' . plugin_lang_get('head_title') . '</td>';
     echo '<td class="document_title" colspan="2">' . $type_string . ' - ' . version_get_field($version_id, 'version') . '</td>';
     if (!$print_flag) {
         echo '<td class="document_title_controls">';
         echo '<form action="' . plugin_page('editor') . '" method="post">';
         echo '<span class="input">';
         echo '<input type="hidden" name="version_id" value="' . $version_id . '" />';
         echo '<input type="submit" name="print" class="button" value="' . plugin_lang_get('editor_printhtml') . '"/>';
         echo '</span>';
         echo '</form>';
         //echo '<form method="post" name="form_set_source" action="' . plugin_page ( 'editorpdf' ) . '">';
         //echo '<span class="input">';
         //echo '<input type="hidden" name="version_id" value="' . $version_id . '" />';
         //echo '&nbsp<input type="submit" name="printtopdf" class="button" value="' . plugin_lang_get ( 'editor_printpdf' ) . '"/>';
         //echo '</span>';
         //echo '</form>';
         echo '</td>';
     }
     echo '</tr>';
 }
Beispiel #15
0
/**
 * Delete a version.
 *
 * @param string $p_username  The name of the user trying to delete the version.
 * @param string $p_password  The password of the user.
 * @param integer $p_version_id A version's id
 * @return bool returns true or false depending on the success of the delete action
 */
function mc_project_version_delete($p_username, $p_password, $p_version_id)
{
    $t_user_id = mci_check_login($p_username, $p_password);
    if ($t_user_id === false) {
        return mci_soap_fault_login_failed();
    }
    if (is_blank($p_version_id)) {
        return new soap_fault('Client', '', 'Mandatory field "version_id" was missing');
    }
    if (!version_exists($p_version_id)) {
        return new soap_fault('Client', '', "Version '{$p_version_id}' does not exist.");
    }
    $t_project_id = version_get_field($p_version_id, 'project_id');
    if (!mci_has_readwrite_access($t_user_id, $t_project_id)) {
        return mci_soap_fault_access_denied($t_user_id);
    }
    if (!mci_has_access(config_get('manage_project_threshold'), $t_user_id, $t_project_id)) {
        return mci_soap_fault_access_denied($t_user_id);
    }
    return version_remove($p_version_id);
}
Beispiel #16
0
/**
 * Remove a version from the project
 * @param integer $p_version_id  A valid version identifier.
 * @param string  $p_new_version A version string to update issues using the old version with.
 * @return void
 */
function version_remove( $p_version_id, $p_new_version = '' ) {
	version_ensure_exists( $p_version_id );

	$t_old_version = version_get_field( $p_version_id, 'version' );
	$t_project_id = version_get_field( $p_version_id, 'project_id' );

	$t_query = 'DELETE FROM {project_version} WHERE id=' . db_param();
	db_query( $t_query, array( (int)$p_version_id ) );

	$t_project_list = array( $t_project_id );
	if( config_get( 'subprojects_inherit_versions' ) ) {
		$t_project_list = array_merge( $t_project_list, project_hierarchy_get_all_subprojects( $t_project_id, true ) );
	}
	$t_project_list = implode( ',', $t_project_list );

	$t_query = 'UPDATE {bug} SET version=' . db_param() . '
				  WHERE project_id IN ( ' . $t_project_list . ' ) AND version=' . db_param();
	db_query( $t_query, array( $p_new_version, $t_old_version ) );

	$t_query = 'UPDATE {bug} SET fixed_in_version=' . db_param() . '
				  WHERE ( project_id IN ( ' . $t_project_list . ' ) ) AND ( fixed_in_version=' . db_param() . ')';
	db_query( $t_query, array( $p_new_version, $t_old_version ) );

	$t_query = 'UPDATE {bug} SET target_version=' . db_param() . '
				  WHERE ( project_id IN ( ' . $t_project_list . ' ) ) AND ( target_version=' . db_param() . ')';
	db_query( $t_query, array( $p_new_version, $t_old_version ) );
}
Beispiel #17
0
</td>
	</tr>
<?php 
    $t_bug_list = array();
    $t_total_owing = 0;
    $t_total_paid = 0;
    for ($i = 0; $i < $t_sponsor_count; ++$i) {
        $t_sponsor_row = $t_sponsors[$i];
        $t_bug = bug_get($t_sponsor_row['bug']);
        $t_sponsor = sponsorship_get($t_sponsor_row['sponsor']);
        $t_buglist[] = $t_sponsor_row['bug'] . ':' . $t_sponsor_row['sponsor'];
        # describe bug
        $t_status = string_attribute(get_enum_element('status', $t_bug->status, auth_get_current_user_id(), $t_bug->project_id));
        $t_resolution = string_attribute(get_enum_element('resolution', $t_bug->resolution, auth_get_current_user_id(), $t_bug->project_id));
        $t_version_id = version_get_id($t_bug->fixed_in_version, $t_bug->project_id);
        if (false !== $t_version_id && VERSION_RELEASED == version_get_field($t_version_id, 'released')) {
            $t_released_label = '<a title="' . lang_get('released') . '">' . $t_bug->fixed_in_version . '</a>';
        } else {
            $t_released_label = $t_bug->fixed_in_version;
        }
        # choose color based on status
        $t_status_label = html_get_status_css_class($t_bug->status, auth_get_current_user_id(), $t_bug->project_id);
        echo '<tr class="' . $t_status_label . '">';
        echo '<td><a href="' . string_get_bug_view_url($t_sponsor_row['bug']) . '">' . bug_format_id($t_sponsor_row['bug']) . '</a></td>';
        echo '<td>' . string_display_line(project_get_field($t_bug->project_id, 'name')) . '&#160;</td>';
        echo '<td class="right">' . $t_released_label . '&#160;</td>';
        echo '<td><a title="' . $t_resolution . '"><span class="underline">' . $t_status . '</span>&#160;</a></td>';
        # summary
        echo '<td>' . string_display_line($t_bug->summary);
        if (VS_PRIVATE == $t_bug->view_state) {
            printf(' <img src="%s" alt="(%s)" title="%s" />', $t_icon_path . 'protected.gif', lang_get('private'), lang_get('private'));
/**
 * @param PDF $pdf
 * @param $type_string
 * @param $version_id
 * @param $version_spec_bug_ids
 * @return PDF
 */
function generate_document_head(PDF $pdf, $type_string, $version_id, $version_spec_bug_ids)
{
    $specmanagement_database_api = new specmanagement_database_api();
    $specmanagement_editor_api = new specmanagement_editor_api();
    $project_id = helper_get_current_project();
    $parent_project_id = $specmanagement_database_api->get_main_project_by_hierarchy($project_id);
    $head_project_id = $project_id;
    if ($parent_project_id == 0) {
        $parent_project_id = version_get_field($version_id, 'project_id');
        $head_project_id = version_get_field($version_id, 'project_id');
    }
    $table_column_widths = array(95, 95);
    $pdf->Cell(array_sum($table_column_widths), 0, '', 'T');
    $pdf->Ln();
    generate_document_head_row($pdf, 'head_version', version_get_field($version_id, 'version'));
    generate_document_head_row($pdf, 'manversions_thdoctype', $type_string);
    generate_document_head_row($pdf, 'head_customer', project_get_name($parent_project_id));
    generate_document_head_row($pdf, 'head_project', project_get_name($head_project_id));
    generate_document_head_row($pdf, 'head_date', date('d\\.m\\.Y'));
    generate_document_head_row($pdf, 'head_person_in_charge', $specmanagement_editor_api->calculate_person_in_charge($version_id));
    if (!is_null($version_spec_bug_ids)) {
        $process = $specmanagement_editor_api->get_process($version_spec_bug_ids);
        if (is_array($process)) {
            $sum_pt_all = $process[0];
            $sum_pt_bug = $process[1];
            $pt_process = 0;
            if ($sum_pt_all != 0) {
                $pt_process = round($sum_pt_bug * 100 / $sum_pt_all, 2);
            }
            $process_string = $sum_pt_bug . '/' . $sum_pt_all . ' ' . plugin_lang_get('editor_duration_unit') . ' (' . $pt_process . ' %)';
        } else {
            $process_string = $process . ' %';
        }
        generate_document_head_row($pdf, 'head_process', $process_string);
    }
    return $pdf;
}