Mantis

affichage consommé

Posted by joejoe 
affichage consommé
May 28, 2007 03:11PM
bonjour.
je souhaite afficher, dans view_all_bug_page, le temps ecoulé depuis l'affectation du bug (etat affecté). je veux donc ajouter une colonne consommé.
je peux faire la requete depuis mantis_bug_history_table (pour connaitre quand le bug a été affecté) par contre je ne sais pas comment l'afficher pour chaque bug, à la suite des informations deja presentes.

merci
Re: affichage consommé
May 28, 2007 03:45PM
Bonjour,

Même "punition" que pour Amel winking smiley Dans le fichier custom_functions_inc.php (à créer si besoin) mettre ceci (ici j'affiche un nombre aléatoire, à vous de faire la requête SQL):
Language: PHP
custom_function_override_print_column_value( $p_column, $p_issue_row, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE ) { ( COLUMNS_TARGET_CSV_PAGE == $p_columns_target ) { $t_column_start = &<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>;&<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>;; $t_column_end = &<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>;&<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>;; $t_column_empty = &<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>;&<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>;; } { $t_column_start = &<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>;<td>&<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>;; $t_column_end = &<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>;</td>&<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>;; $t_column_empty = &<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>;&nbsp;&<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>;; }   (( $p_column, &<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>;custom_&<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>; ) === 0 ) { $t_column_start; $t_custom_field =( $p_column, 7 );   $t_field_id = custom_field_get_id_from_name( $t_custom_field ); ( $t_field_id === ) { &<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>;@&<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>;, $t_custom_field, &<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>;@&<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>;; } { $t_issue_id = $p_issue_row[&<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>;id&<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>;]; $t_project_id = $p_issue_row[&<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>;project_id&<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>;];   ( custom_field_is_linked( $t_field_id, $t_project_id ) ) { $t_def = custom_field_get_definition( $t_field_id ); print_custom_field_value( $t_def, $t_field_id, $t_issue_id ); } { // field is not linked to project $t_column_empty; } } $t_column_end; } { ( $p_columns_target != COLUMNS_TARGET_CSV_PAGE ) { $t_function = &<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>;print_column_&<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>; . $p_column; } { $t_function = &<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>;csv_format_&<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>; . $p_column; }   (( $t_function ) ) { ( $p_columns_target != COLUMNS_TARGET_CSV_PAGE ) { // Pour afficher la description avec le summary. ( $p_column == &<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>;summary&<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>; ) { $t_summary = string_attribute( $p_issue_row[&<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>;summary&<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>;] ); $t_description = string_attribute( bug_get_text_field( $p_issue_row[&<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>;id&<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>;], &<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>;description&<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>; ) ); &<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>;<td class="left"><a title="&<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>;, $t_description, &<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>;">&<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>;, $t_summary; ( VS_PRIVATE == $p_issue_row[&<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>;view_state&<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>;] ) { ( &<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>; <img src="%s" alt="(%s)" title="%s" />&<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>; , $t_icon_path . &<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>;protected.gif&<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>; , lang_get( &<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>;private&<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>; ) , lang_get( &<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>;private&<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>; ) ); } &<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>;</a></td>&<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>;; } { $t_function( $p_issue_row, $p_columns_target ); } } { $t_function( $p_issue_row[$p_column] ); } } { (( $p_issue_row[$p_column] ) ) { ( $p_column == &<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>;project_id&<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>; ) { &<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>;<td class="center">&<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>; . project_get_name( $p_issue_row[&<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>;project_id&<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>;] ) . &<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>;</td>&<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>;; } { $t_column_start . $p_issue_row[$p_column] . $t_column_end; } } { ( $p_column == &<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>;toto&<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>; ) { $t_column_start .( 1, 10 ) . $t_column_end; } { $t_column_start . &<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>;@&<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>; . $p_column . &<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>;@&<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>; . $t_column_end; } } } } }

Et dans le fichier config_inc.php il faut modifier la variable $g_view_issues_page_columns pour y ajouter &#039;toto&#039; :
Language: PHP
$g_view_issues_page_columns = ( &<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>;selection&<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>;, &<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>;edit&<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>;, &<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>;priority&<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>;, &<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>;id&<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>;, &<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>;sponsorship_total&<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>;, &<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>;bugnotes_count&<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>;, &<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>;attachment&<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>;, &<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>;category&<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>;, &<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>;severity&<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>;, &<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>;status&<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>;, &<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>;last_updated&<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>;, &<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>;summary&<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>;, &<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>;project_id&<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>;, &<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>;toto&<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>; );

Evidemment c&#039;est mieux de ne pas mettre toto mais autre chose winking smiley

Vincent


Mantis: 1.1.0, 1.1.5, 1.1.1
PHP: 5.0.4
SQL: MySQL 5.0.19
OS: Linux

Please complete your signature with your environment informations.
Enable skype notification here
Re: affichage consommé
May 28, 2007 04:19PM
Quote
vincent
Même "punition" que pour Amel winking smiley Dans le fichier custom_functions_inc.php (à créer si besoin) mettre ceci (ici j&#039;affiche un nombre aléatoire, à vous de faire la requête SQL):
ce n&#039;est pas dans le fichier custom_functions_inc.php mais dans custom_function_api.php qu&#039;il faut ajouter la fonction.

sinon vu que les filtres sont actifs dans cette page, comment est ce que je pourrais appliquer les filtres dans ma requete pour avoir le bon resultant tout en laissant les filtres
Re: affichage consommé
May 28, 2007 04:26PM
Quote
joejoe
Quote
vincent
Même "punition" que pour Amel winking smiley Dans le fichier custom_functions_inc.php (à créer si besoin) mettre ceci (ici j&#039;affiche un nombre aléatoire, à vous de faire la requête SQL):
ce n&#039;est pas dans le fichier custom_functions_inc.php mais dans custom_function_api.php qu&#039;il faut ajouter la fonction.

Surtout pas, c&#039;est bien dans le fichier custom_functions_inc.php (sinon à la prochaine mise à jour vous perdez tout).

Quote

sinon vu que les filtres sont actifs dans cette page, comment est ce que je pourrais appliquer les filtres dans ma requete pour avoir le bon resultant tout en laissant les filtres

Je ne comprends pas ce que vous voulez dire. La fonction ci-dessus va être appelé une fois pour chaque ligne du tableau (le tableau étant obtenu avec le filtre).

Vincent


Mantis: 1.1.0, 1.1.5, 1.1.1
PHP: 5.0.4
SQL: MySQL 5.0.19
OS: Linux

Please complete your signature with your environment informations.
Enable skype notification here
Re: affichage consommé
May 28, 2007 04:50PM
Quote
vincent
Surtout pas, c&#039;est bien dans le fichier custom_functions_inc.php (sinon à la prochaine mise à jour vous perdez tout).
c&#039;est ca que j&#039;ai fait au depart et rien ne s&#039;affichait. il me marquait @toto@ au lieu du chiffre de rand(1,10).
Quote
vincent
Je ne comprends pas ce que vous voulez dire. La fonction ci-dessus va être appelé une fois pour chaque ligne du tableau (le tableau étant obtenu avec le filtre).
en fait je veux associer chaque bug a une valeur dans toto. Ainsi quand on clique sur le filtre, les valeurs dans toto changent mais elles restent les memes pour chaque bug; les filtres c&#039;est les titres des colonnes (p, id, category ....)
Re: affichage consommé
May 28, 2007 04:53PM
exemple si on a:
id toto resumé
2 5 bonjour
1 1 hello
4 2 xxxxx

lorsqu&#039;on trie par id croissant on retrouve:

id toto resumé
1 1 hello
2 5 bonjour
4 2 xxxxx
Re: affichage consommé
May 28, 2007 05:07PM
Quote
joejoe
Quote
vincent
Surtout pas, c&#039;est bien dans le fichier custom_functions_inc.php (sinon à la prochaine mise à jour vous perdez tout).
c&#039;est ca que j&#039;ai fait au depart et rien ne s&#039;affichait. il me marquait @toto@ au lieu du chiffre de rand(1,10).

Vous n&#039;avez pas fait d&#039;erreur sur le nom du fichier (un s manquant par exemple) ? Le fichier est bien à la racine du répertoire mantis (pas dans le core) ?

Quote

Quote
vincent
Je ne comprends pas ce que vous voulez dire. La fonction ci-dessus va être appelé une fois pour chaque ligne du tableau (le tableau étant obtenu avec le filtre).
en fait je veux associer chaque bug a une valeur dans toto. Ainsi quand on clique sur le filtre, les valeurs dans toto changent mais elles restent les memes pour chaque bug; les filtres c&#039;est les titres des colonnes (p, id, category ....)

Chez moi ça marche exemple (j&#039;ai remplacé le rand par l&#039;id du bug).

Vincent


Mantis: 1.1.0, 1.1.5, 1.1.1
PHP: 5.0.4
SQL: MySQL 5.0.19
OS: Linux

Please complete your signature with your environment informations.
Enable skype notification here
Re: affichage consommé
May 29, 2007 08:48AM
c&#039;est bon ca marche. en fait il me mettait un message d&#039;erreur lorsque je mettais cette fonction dans custom_function_inc. ceci etait du au fait que j&#039;avais deja une fonction du même nom dans custom_function_api, que j&#039;ai finalement supprimé
Re: affichage consommé
May 29, 2007 08:51AM
Quote
vincent
Chez moi ça marche exemple (j&#039;ai remplacé le rand par l&#039;id du bug).
effectivementca marche. juste un petit souci: lorsqu&#039;on clique sur le filtre de toto, il met un message d&#039;erreurs:
Quote

Database query failed. Error received from database was #1054: Unknown column &#039;toto&#039; in &#039;order clause&#039; for the query: SELECT DISTINCT demo_bug_table.*
FROM demo_bug_table

WHERE demo_bug_table.id in (1, 2, 10, 11, 12, 15, 16, 20, 13, 14, 17, 18, 19, 3, 4, 5, 6, 7, 8, 9)
ORDER BY toto ASC, last_updated DESC, date_submitted DESC
Re: affichage consommé
May 29, 2007 08:54AM
Quote
joejoe
Quote
vincent
Chez moi ça marche exemple (j&#039;ai remplacé le rand par l&#039;id du bug).
effectivementca marche. juste un petit souci: lorsqu&#039;on clique sur le filtre de toto, il met un message d&#039;erreurs:

Oui mais ça on ne pourra rien y faire (à part empêcher de classer en utilisant le critère toto).

Vincent


Mantis: 1.1.0, 1.1.5, 1.1.1
PHP: 5.0.4
SQL: MySQL 5.0.19
OS: Linux

Please complete your signature with your environment informations.
Enable skype notification here
Re: affichage consommé
May 29, 2007 09:15AM
et comment on empeche de classer?
Re: affichage consommé
May 29, 2007 09:17AM
est ce qu&#039;il ne faut pas ajouter une fonction print_column_toto dans columns_api pour faire marcher le filtre?
Re: affichage consommé
May 29, 2007 09:31AM
Quote
joejoe
est ce qu&#039;il ne faut pas ajouter une fonction print_column_toto dans columns_api pour faire marcher le filtre?

C&#039;est une solution, mais je ne suis pas fan parce qu&#039;à la prochaine mise à jour les modifs seront perdues...

Il vaut mieux modifier la fonction custom_function_override_print_column_title dans le fichier custom_functions_inc.php :
Language: PHP
custom_function_override_print_column_title( $p_column, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE ) { $t_sort, $t_dir;   (( $p_column, &<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>;custom_&<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>; ) === 0 ) { $t_custom_field =( $p_column, 7 );   ( COLUMNS_TARGET_CSV_PAGE != $p_columns_target ) { &<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>;<td>&<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>;; }   $t_field_id = custom_field_get_id_from_name( $t_custom_field ); ( $t_field_id === ) { &<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>;@&<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>;, $t_custom_field, &<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>;@&<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>;; } { $t_def = custom_field_get_definition( $t_field_id ); $t_custom_field = lang_get_defaulted( $t_def[&<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>;name&<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>;] );   ( COLUMNS_TARGET_CSV_PAGE != $p_columns_target ) { print_view_bug_sort_link( $t_custom_field, $p_column, $t_sort, $t_dir, $p_columns_target ); print_sort_icon( $t_dir, $t_sort, $p_column ); } { $t_custom_field; } }   ( COLUMNS_TARGET_CSV_PAGE != $p_columns_target ) { &<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>;</td>&<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>;; } } { $t_function = &<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>;print_column_title_&<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>; . $p_column; (( $t_function ) ) { $t_function( $t_sort, $t_dir, $p_columns_target ); } { &<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>;<td>&<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>;; ( $p_column == &<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>;toto&<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>; ) { $p_column; // ou echo &<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>;<b>&<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>; . $p_column . &<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>;</b>&<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>;; } { print_view_bug_sort_link( lang_get_defaulted( $p_column ), $p_column, $t_sort, $t_dir, $p_columns_target ); print_sort_icon( $t_dir, $t_sort, $p_column ); } &<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>;</td>&<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>;; } } }

Vincent


Mantis: 1.1.0, 1.1.5, 1.1.1
PHP: 5.0.4
SQL: MySQL 5.0.19
OS: Linux

Please complete your signature with your environment informations.
Enable skype notification here
Sorry, only registered users may post in this forum.

Click here to login



Online Users

Guests: 3
Record Number of Users: 1 on April 02, 2023
Record Number of Guests: 115 on November 09, 2023
Top Users
Hébergeur : Morinie.Fr