Enable new print option

The release related discussions, plans and questions.

Enable new print option

Postby klee » Wed Apr 23, 2008 2:43 pm

Hi all,

Using testlink 1.7.2, made the following changes:

1. custom_string.txt
// Add new print option
$TLS_opt_show_tc_reqts = "Show Test Case Requirements";
$TLS_reqts = "Requirement";

2. selectData.php
// Add new option - reqts
$arrCheckboxes = array(
array( 'value' => 'header', 'description' => lang_get('opt_show_doc_header'), 'checked' => 'n'),
array( 'value' => 'toc', 'description' => lang_get('opt_show_toc'), 'checked' => 'n'),
array( 'value' => 'summary', 'description' => lang_get('opt_show_tc_summary'), 'checked' => 'n'),
// New option
array( 'value' => 'reqts', 'description' => lang_get('opt_show_tc_reqts'), 'checked' => 'n'),
array( 'value' => 'body', 'description' => lang_get('opt_show_tc_body'), 'checked' => 'n'),
array( 'value' => 'author', 'description' => lang_get('opt_show_tc_author'), 'checked' => 'n'),
array( 'value' => 'passfail', 'description' => lang_get('opt_show_passfail'), 'checked' => 'n'),
);

3. printData.php
// Add reqts for print test cases
$printingOptions = array ( 'toc' => 0,'body' => 0,'summary' => 0,'reqts' =>0, 'header' => 0, 'passfail' => 0, 'author' => 0);

4. print.inc.php
function renderTestCaseForPrinting(...)
{
<clipped>
if ($printingOptions['body'] || $printingOptions['summary'])
{
if ($tcInfo)
{
if ($printingOptions['summary'])
{
<clipped>
$query = "SELECT requirements.id,requirements.title
FROM requirements, req_coverage
WHERE req_coverage.testcase_id ='".($id)."'
AND req_coverage.req_id = requirements.id";

$result = mysql_query($query)
or die ("Query '$query' failed with error message: \"" . mysql_error () . '"');

if (mysql_num_rows($result) < 1) {
$testcasetitle = "No associated requirements";
} else {
while ($row = mysql_fetch_assoc($result)) {
$testcasetitle = $row['title'];
//$code .= "<tr><td colspan=\"2\"><u>".
// lang_get("reqts")."</u>: " . $testcasetitle ."</td></tr>";
$code .= "<tr><td colspan=\"2\"><u>".
("Requirement")."</u>: " . $testcasetitle . "</td></tr>";
}
<clipped>
}
}
}

The problem is I'm not able to enable the "Print Options" - "Show Test Case Requirements" functionality. I had to place the above item (4) code, as you can see, under $printingOptions['summary'] block in-order to have it work. I've tried to have it in its own (if statement) block but with no success. Where would I need to place it? What am I missing?

Recommendations appreciated in advance.
klee
TestLink user
 
Posts: 11
Joined: Tue Feb 21, 2006 3:55 pm

Re: Enable new print option

Postby Drakoss » Sun Aug 17, 2008 5:22 am

klee wrote:Hi all,


The problem is I'm not able to enable the "Print Options" - "Show Test Case Requirements" functionality. I had to place the above item (4) code, as you can see, under $printingOptions['summary'] block in-order to have it work. I've tried to have it in its own (if statement) block but with no success. Where would I need to place it? What am I missing?

Recommendations appreciated in advance.


Your code is fine, the documentation in the selectData.php is in-complete.

You also need to edit \gui\javascript\testlink_libarary.js and add your option there:

Code: Select all
function tree_getPrintPreferences()
{
   var params = [];
   var fields = ['header','summary','toc','body','passfail',
                 'tcspec_refresh_on_action','author','showbugs'];


If you don't do this, the parameter is never passed to print.inc.php. I ran into the same problem and did a grep search for passfail and found it.

I have a modified print.inc.php that I will share here when I get done with it, it shows execution history, build history, pass/fail, notes, author information, editor information, and soon bug info.

When I finish it, I will post it.

Drak
Drakoss
TestLink user
 
Posts: 3
Joined: Sun Aug 17, 2008 5:15 am

Re: Enable new print option

Postby havlatm » Mon Aug 18, 2008 10:49 am

Drakoss wrote:I have a modified print.inc.php that I will share here when I get done with it, it shows execution history, build history, pass/fail, notes, author information, editor information, and soon bug info.

When I finish it, I will post it.

Drak


Hello Drak,
your contribution is welcome. I recommend to add your files via attachment of our tracker. Thanks,
Martin
havlatm
Member of TestLink Community
 
Posts: 940
Joined: Mon Oct 31, 2005 1:24 am
Location: Czech

Re: Enable new print option

Postby Drakoss » Mon Aug 18, 2008 3:59 pm

havlatm wrote:
Hello Drak,
your contribution is welcome. I recommend to add your files via attachment of our tracker. Thanks,
Martin


I will certainly do so. I ended up modifying more than just print.inc so the tracker would probably be the place to do it. I am afraid my coding and commenting doesn't meet your standards. I will upload when I am finished and if you have any questions you can communicate them via the tracker or email.

BTW this is a great product, we haven't officially started using it where I work, but I did demo it to my managers and they are on board with it. Just have to work out a few details before we go live. Unfortunately policy forbids me from posting in your company forum.

Drak
Drakoss
TestLink user
 
Posts: 3
Joined: Sun Aug 17, 2008 5:15 am

Re: Enable new print option

Postby Drakoss » Tue Aug 19, 2008 8:24 pm

havlatm wrote:
Hello Drak,
your contribution is welcome. I recommend to add your files via attachment of our tracker. Thanks,
Martin


Done deal,

For those of you who want to see this or implement on 1.7.4 the files and instructions are under this case:

http://www.testlink.org/mantis/view.php?id=1678
Drakoss
TestLink user
 
Posts: 3
Joined: Sun Aug 17, 2008 5:15 am


Return to TestLink 1.7 (Closed)



Who is online

Users browsing this forum: No registered users and 6 guests

cron