Mantis

Faire evoluer la fonction copier

Posted by Stéphane 
Faire evoluer la fonction copier
May 21, 2008 10:33AM
Bonjour à tous,

Je souhaiterais savoir s'il serait possible de faire évoluer la fonction copier.

Le principe serait le suivant: je selectionne mon bogue dans la vue afficher les bogues puis choisi copier dans la liste déroulante. Mantis me propose une liste de projet dans lequel je souhaite copier mon bogue avec un nouvel id et lorsque je valide le projet destinataire mantis crée le bogue et le lie automatiquement au bogue d'origine.

Je sais pas si c'est très clair ce que je raconte confused smiley Je l'espère smiling smiley

Si une ame sympathique peux m'aider?

D'avance merci beaucoup beaucoup beaucoup,

Bonne journée a tous,

Stéphane
Re: Faire evoluer la fonction copier
May 21, 2008 10:59AM
Bonjour,

Choisir l'ID n'est pas possible, c'est juste le lien qu'il vous manque ?

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: Faire evoluer la fonction copier
May 21, 2008 11:16AM
Oui tout à fait c'est juste le lien qui doit se faire lorsque je crée une copie.

Merci pour votre réponse.

Cordialement,

Stéphane
Re: Faire evoluer la fonction copier
May 21, 2008 11:44AM
Dans le fichier core/bug_api.php il faut modifier la fonction bug_copy (à ajouter juste avant la dernière ligne) :
Language: PHP
# COPY HISTORY history_delete( $t_new_bug_id ); # should history only be deleted inside the if statement below? ( $p_copy_history ) { $query = "SELECT * FROM $t_mantis_bug_history_table WHERE bug_id = &<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>;$t_bug_id&<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>;;"; $result = db_query( $query ); $t_count = db_num_rows( $result );   ( $i = 0; $i < $t_count; $i++ ) { $t_bug_history = db_fetch_array( $result ); $query = "INSERT INTO $t_mantis_bug_history_table ( user_id, bug_id, date_modified, field_name, old_value, new_value, type ) VALUES ( &<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>;" . db_prepare_int( $t_bug_history[&<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>;user_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>;, &<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>;$t_new_bug_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>;" . db_prepare_string( $t_bug_history[&<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>;date_modified&<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 href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>;" . db_prepare_string( $t_bug_history[&<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>;field_name&<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 href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>;" . db_prepare_string( $t_bug_history[&<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>;old_value&<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 href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>;" . db_prepare_string( $t_bug_history[&<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>;new_value&<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 href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>;" . db_prepare_int( $t_bug_history[&<a href="http://bugtracker.morinie.fr/mantis/view.php?id=039" target="_blank">#039</a>;type&<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>; );"; db_query( $query ); } }   // A ajouter (BUG_DUPLICATE peut être changé par autre chose) : relationship_add( $t_bug_id, $t_new_bug_id, BUG_DUPLICATE ); history_log_event_special( $t_bug_id, BUG_ADD_RELATIONSHIP, BUG_DUPLICATE, $t_new_bug_id ); history_log_event_special( $t_new_bug_id, BUG_ADD_RELATIONSHIP, relationship_get_complementary_type( BUG_DUPLICATE ), $t_bug_id );   $t_new_bug_id;

Ceci peut-être fait par l&#039;intermédiaire d&#039;un plugin que je n&#039;ai pas le temps d&#039;écrire mais je peux y contribuer 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: Faire evoluer la fonction copier
May 21, 2008 12:29PM
Génial tout fonctionne bien.

Merci pour votre aide.

Par contre juste une petite précision lorsque j&#039;ai utilisé la fonction copier et que j&#039;ai verifié la relation entre les 2 bogues Mantis m&#039;affiche "a pour doublon" est-il possible de remplacer ceci par "lié à" cela sera ma dernière question.

Je tiens a vous remercier pour votre précieuse aide.

Je vous souhaite une excellente journée,

Très cordialement,

Stéphane
Re: Faire evoluer la fonction copier
May 21, 2008 12:34PM
Il faut remplacer BUG_DUPLICATE par BUG_RELATED (je pense).

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: Faire evoluer la fonction copier
May 21, 2008 12:37PM
Merci mille fois,

C&#039;est bien ça.

Encore une fois merci pour votre aide.

Stéphane
Sorry, only registered users may post in this forum.

Click here to login



Online Users

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