Mantis Bugtracker 

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0003989TestLinkCustom fieldspublic2010-11-08 18:312010-11-14 12:07
Assigned ToJulian 
PrioritynormalSeveritymajorReproducibilityhave not tried
PlatformOSOS Version
Product Version1.9 RC 1 
Fixed in Version1.9 (Prague) 
Summary0003989: Save value for custom field only if a value is set
DescriptionCurrently empty string is saved for custom fields.

-> only save if something is set on input field
-> remove entry on cf table if content of Custom Field input field is removed
TagsNo tags attached.
Database (MySQL,Postgres,etc)-
PHP Version
QA Team - Task Workflow Status
Attached Filespng file icon cf_empty_values.png [^] (25,346 bytes) 2010-11-08 19:05

xml file icon customFields.xml [^] (71,242 bytes) 2010-11-09 15:07

- Relationships

-  Notes
Julian (reporter)
2010-11-09 15:10

Code has been commited for 1.9 branch and head.
Mantis behaviour of custom fields now works in the same way for testlink (default behaviour) [as proposed by fman]:
- All defined custom fields are shown even though there is no entry on DB ($tlCfg->custom_fields->show_custom_fields_without_value = true)

New Behaviour as described above if config parameter is set to:
$tlCfg->custom_fields->show_custom_fields_without_value = false
-> only custom fields are shown that are stored on DB

Extensive tests have been done for this feature:

the following has been tested for newly added config parameter
set to "true" AND "false"

Test Case Definition (edit/view) OK
Test Suite Definition (edit/view) OK
Req Definitinon (edit/view) OK
Req Spec Defintion (edit/view) OK

Add Testcases to test plan (edit only) OK

Test Plan edit OK

Test Execution
- Test Plan CFs on Test Plan Notes Panel (view only) OK
- Test Suite CFs on Test Suite Notes Panel (view only) OK
- Test Case Design CFs on Exec (view only on test case description) OK
- Test Plan Design CFs on Exec (view only on test case description) OK
- Test Case Execution CFs (view/edit) OK

I attached the exported custom fields used for tests.
amitkhullar (reporter)
2010-11-10 09:06
edited on: 2010-11-10 09:17

Hi Julian,

One issue I have found is that you have used ||(OR) clause instead of && (AND) on different pages updated

// BUGID 3989
if(isset($cf_info['node_id']) || $show_cf)

which cause the cf to be displayed even if the values are null and config option is set to false.

or probably the line should be
if((isset($cf_info['node_id']) && $cf_info['value']) || $show_cf)

Please look into this.

Julian (reporter)
2010-11-10 09:12

sure. if an empty value already exists on DB -> show.

to avoid this problem delete from "custom field tables" where value = ""
fman (administrator)
2010-11-10 09:26

there is just a thing that is not clear for me.
The implementation has changed JUST display or also write to DB ?
(do not want to dig code myself to get the answer)
Because if affects how data is written to db config parameter name has to be changed to express that YOU DO NOT WRITE empty.
Julian (reporter)
2010-11-10 09:38

empty values are not written anymore that is right.
but every defined field is shown as if there is an empty value on DB. (if config parameter is set to true)

Here is how it works:

check if there is already a value for this cf on db
1. if there is an old_value on db AND new_value != "" -> update exisisting value
2. if there is no old_value on db AND new_value != "" -> insert new_value
3. if there is an old_value on db AND new_value == "" -> delete row

not sure if parameter must be changed.
fman (administrator)
2010-11-10 09:59

My request was:
>> If this disturbs you, add a new config options
>> FALSE BY default that enable this behaviour (i.e do not write to DB)
Julian (reporter)
2010-11-10 10:49

reason for storing also empty values is to later be able to work with custom fields that have a default value (column on DB exists - not configurable on UI)

-> right now feature does not exist. if this feature is necessary we need to create another issue and look for a solution.
Julian (reporter)
2010-11-12 07:58

this issue has been resolved according to commment 12366.

This solution is ok until we decide to implement default value for custom fields. -> see #3996
fman (administrator)
2010-11-14 12:07

1.9 (Prague) Released

- Issue History
Date Modified Username Field Change
2010-11-08 18:31 Julian New Issue
2010-11-08 19:05 Julian File Added: cf_empty_values.png
2010-11-08 19:11 amitkhullar Relationship added has duplicate 0002402
2010-11-09 15:07 Julian File Added: customFields.xml
2010-11-09 15:10 Julian Note Added: 0012348
2010-11-10 09:06 amitkhullar Note Added: 0012358
2010-11-10 09:12 Julian Note Added: 0012360
2010-11-10 09:13 fman Fixed in Version => 1.9 (Prague)
2010-11-10 09:17 amitkhullar Note Edited: 0012358 View Revisions
2010-11-10 09:26 fman Note Added: 0012364
2010-11-10 09:38 Julian Note Added: 0012366
2010-11-10 09:59 fman Note Added: 0012367
2010-11-10 10:49 Julian Note Added: 0012371
2010-11-10 12:03 Julian Relationship added child of 0003996
2010-11-12 07:55 Julian Assigned To => Julian
2010-11-12 07:55 Julian Status new => assigned
2010-11-12 07:58 Julian Note Added: 0012423
2010-11-12 07:58 Julian Status assigned => resolved
2010-11-12 07:58 Julian Resolution open => fixed
2010-11-14 12:07 fman Note Added: 0012456
2010-11-14 12:07 fman Status resolved => closed

Copyright © 2000 - 2020 MantisBT Team
Powered by Mantis Bugtracker