Customise tabular reports with Bugzilla - bugzilla

I want add more columns to the tabular report.
I am using bugzilla version 4.2.5.
Can you please help with the files that i have to do modification to?
Thanks,
Ramya

if the required field is not there in column list("Change Columns") we have to add the new field by editing the following files.
1)colchange.cgi
2)list/change-columns.html.tmpl
3)field-descs.none.tmpl
All the coloumns of the buglist are directly taken from the DB fields.
For eg:
ID of the buglist page is directly taken from the field bug_id of table bugs.
New fields can be added and arranged the order in which they have to
display in the file colchange.cgi.
Corresponding template file of colchange.cgi is
list/change-columns.html.tmpl.
If we need any modification in the change coloumn page we have to
modify the template file list/change-columns.html.tmpl.
New fields added should be defined in the file field-descs.none.tmpl.
Modify the following files:
1)buglist.cgi
2)colchange.cgi
3)field-descs.none.tmpl
Added the corresponding coloumn to be displayed in the file colchange.cgi and pass the variables to the template file list/list.html.tmpl.
Defined the name that should be displayed in front end in the file
field-descs.none.tmpl.
Modify the file buglist.cgi for the query that should give the
value for the corresponding field
.

There are two ways to do this.
When you display a report, you will find a link at the bottom that says "Change Columns". That's the wasiest way.
If you wan tot change the default columns the edit the following statement in /usr/local/bugzilla-4.2.5/Bugzilla/Constants.pm and add or remove default columns.
use constant DEFAULT_COLUMN_LIST => (
"product", "component", "assigned_to",
"bug_status", "resolution", "short_desc", "changeddate"
);
EDIT: Just realized that this question is two years old. I hope that it helps someone else who stumbles on it.

Related

Input field border in other color for NOT NULL fields

I would like to have the input field border in another color if the underlying field is NOT NULL.
After studying the CakePHP documentation I think I can somehow implement it with the Custom Widgets but how do I get the information if the field is NULL or NOT NULL, or does CakePHP already offer something pre-build which I didn't find?
Update:
I display all tables in the edit mode with one script. With this I want to avoid 50 edit.php scripts serving each table in the database. In this one script I generate on the fly the edit form. This means, this script is NEVER assigned to exactly one table. This is not the problem as I can parse all fields and display them properly for every special database type [date, varchar, set, int, time, ...].
Even the field description is read automatically from the table field comment which is then displayed as title tag when the mouse is moved over the ? symbol.
And now, as the next step, I would like to show a different border for a input field which is NOT NULL. This means, the different border should be shown for all fields which are displayed for the table.
I am using CakePHP 4.1.4
I found this solution:
Due to the fact the function has to evaluate the table schema in order to generate on the fly the form, the function knows which fields are NOT NULL. Then, when it creates the field with $this->Form->control(..) it adds simple in the options argument ["style" => "border: color width type"] for these fields, which are NOT NULL..
If somebody has a more elegant way, please post it as an answer so I can learn something and I'll accept it.

Send file to server through iText PDF?

I'm dynamically creating some PDF files through my application, using iText, and I need to use several components (TextField, CheckBox, RadioButtons etc), and then submit the values to server. But, one of the requirements says that the user needs to be able to select and send files along with the other values. I did not find a specific component to this, and so I'm asking for some help with this situation.
Is there a way to create some kind of Input File, File Chooser, etc, and attach it on the generated PDF file? And then send this selected file to server?
Thanks
This is explained in the official documentation, more specifically in the example FdfServlet of chapter 9 of my book. However, in this example, we add a file selection field to an existing PDF, so I've made you an example that explains how to create such a field when creating a document from scratch: FileSelectionExample
A file selection field is created just like any other text field, except that you have to set a flag using the setOptions() method. If you want a file chooser to appear, you also have to add a JavaScript action:
TextField file = new TextField(writer, new Rectangle(36, 788, 559, 806), "myfile");
file.setOptions(TextField.FILE_SELECTION);
PdfFormField upload = file.getTextField();
upload.setAdditionalActions(PdfName.U, PdfAction.javaScript(
"this.getField('myfile').browseForFileToSubmit();", writer));
writer.addAnnotation(upload);
In the full example, I also added a second field and after selecting the file with the browseForFileToSubmit() method, I set the focus to that other field. I'm doing this because the file name only becomes visible in the file selection field after that field loses focus.

How do I get the SalesForce record id in a custom field

I wanted to add a simple read-only URL-field to 'opportunities' in SalesForce that contains a link to an external webpage with the 15-char record id (used in the salesforce urls) attached to it . To do this I wen to /ui/setup/Setup?setupid=Opportunity --> fields and created a new field under 'Opportunity Custom Fields & Relationships'.
I chose a field with data type 'URL' and added a default value. I thought
"http://example.com/?sfid="&id would do the trick, but this returns
Error: Field id may not be used in this type of formula
This is a vague error. Is my syntax of a default value wrong, or am i using the 'id' parameter in a wrong way? And what is the right way to do this?
I'm new to SalesForce, as you probably already have guessed.
As the other answer stated - Id will be known only after insert meaning the "default value" trick won't work for you.
You have some other options though:
Workflow rule that would be populating the URL field after save.
Formula field of type text that uses HYPERLINK function
HYPERLINK("http://example.com/?sfid=" & Id , "See " & Name & " in ext. system")
Custom link (similar to custom buttons, they appear on the bottom of the page layout. Search them in online help)
The difference between 2 and 3 is quite minor. Custom links can appear only on the record's detail view while formula fields & other urls are well... fields - so they can be used in reports, listviews etc.
You'd have to decide which version suits you best.
This is a great question. You're right, the error is very vague.
To begin with, read some of the documentation on default fields. Pay particular attention to the order of operations:
The user chooses to create a new record.
Default field value is executed.
Salesforce displays the edit page with the default field value pre-populated.
The user enters the fields for the new record.
The user saves the new record.
Default field values are calculated before any other record data including the id are available. For this reason, they cannot be calculated based on other record fields. Especially the record id, which has not yet been assigned.
To get this functionality, you will need to create a workflow rule that fires on record creation and inserts the proper value into your field.
It would be nice if we could have formula URL fields, but we don't. EDIT: I am dumb and forgot about using HYPERLINK in text formula fields, as eyescream correctly points out.

SSRS action on field in CSV list

My client requires a report that produces a comma separated list of files in one column of a grid. I know I can use a FOR XML Path in my query to yield these results. However, the client wants to be able to click on an individual value in that CSV and be taken to a link for that element in the list. For example, the column in the report would look like:
1.jpg, 2.jpg, 3.jpg
He needs the ability to click on the 2.jpg, and go to that actual file. I know I can put in an action for the entire field to go to one URL, but can I narrow that action down to a specific part of the CSV list?
You can use placeholders to embed hyperlinks in comma delimited text, you'll need to wrap each value with an anchor tag and href. See the URL Embedded in Text section of my earlier answer an example.
SQLFiddle of sample code for adding markup. It's ugly in SQL but works.
I came up with a workable solution. The problem seems to lie in the fact that there are multiple URLs in the list. If i only return a single URL, it works fine. so, instead of a CS list, I return one at a time and use a matrix to group the other fields.

How to remove a field from Views 3 programmatically?

Hi I'm using Drupal 7 and Views 3. I have a view (named 'export') that generates a csv export of selected node entities. However, I've put some custom code in that displays all the fields contained within that selected node entity, and allows the user to select fields (via checkboxes) that they do not want to include in the export.
I've tried unsetting the selected fields within hook_views_query_alter like so:
function mymodule_views_query_alter (&$view, &$query) {
if ($view->name == "export") {
unset($query->fields['field_data_field_description_node_entity_type']);
}
}
While that does unset that part of the fields array, I still get the description field populated in the csv export. I'm just not familiar enough with the views object structure to fully understand how to remove a given field from the view. I've searched the web for literally hours trying to find a post to shed some light on this. While I've found plenty of examples for using hook_views_query_alter to add filters or alter the WHERE statement of a query object, I haven't found anything having to do with removing the columns that a view query returns. Any advice on this would be very much appreciated!
Thanks,
axl
I was able to remove views fields for a CSV export by unsetting the field in hook_views_pre_build() in my custom module.:
function mymodule_views_pre_build(&$view) {
if ($view->name == 'campaign_report'
&& $view->current_display == 'views_data_export_1') {
// You'll have your own list of fields to remove that you create somehow...
$fields_to_remove = array('field_name_to_remove_1','field_name_to_remove_2');
foreach ($fields_to_remove as $field_name) {
unset($view->field[$field_name]);
unset($view->display_handler->handlers['field'][$field_name]);
}
}
}
This seems to work great for me, and is performed earlier in the views life cycle, before the query is even built. In fact I started using it for my table display view as well as my CSV export, since it seems more efficient than using the "hide if empty" column checkbox on the Views table settings (which must iterate over every row in the result set to see if it's empty in order to hide the column heading). If you wish to do that too, you will need to change the if() statement at the top so it only checks $view->name. Then the fields will be removed from all displays in that view (not just the views_data_export_1 display).
Try removing the column from the $view object.
unset($view->field['field_name'];

Resources