[Bps-public-commit] r17411 - Net-Trac/trunk/lib/Net/Trac

jesse at bestpractical.com jesse at bestpractical.com
Mon Dec 29 18:42:58 EST 2008


Author: jesse
Date: Mon Dec 29 18:42:57 2008
New Revision: 17411

Modified:
   Net-Trac/trunk/lib/Net/Trac/Ticket.pm

Log:
* generalization to work with 0.10 and 0.11


Modified: Net-Trac/trunk/lib/Net/Trac/Ticket.pm
==============================================================================
--- Net-Trac/trunk/lib/Net/Trac/Ticket.pm	(original)
+++ Net-Trac/trunk/lib/Net/Trac/Ticket.pm	Mon Dec 29 18:42:57 2008
@@ -45,8 +45,10 @@
     my $self = shift;
     $self->connection->ensure_logged_in;
     $self->connection->_fetch("/newticket");
+    my $i = 1; # form number
     for my $form ( $self->connection->mech->forms() ) {
-        return $form if $form->find_input('field_reporter');
+        return ($form,$i) if $form->find_input('field_reporter');
+        $i++;
     }
     return undef;
 }
@@ -55,15 +57,17 @@
     my $self = shift;
     $self->connection->ensure_logged_in;
     $self->connection->_fetch("/ticket/".$self->id);
+    my $i = 1; # form number;
     for my $form ( $self->connection->mech->forms() ) {
-        return $form if $form->find_input('field_reporter');
+        return ($form,$i) if $form->find_input('field_reporter');
+        $i++;
     }
     return undef;
 }
 
 sub _fetch_new_ticket_metadata {
     my $self = shift;
-    my $form = $self->_get_new_ticket_form;
+    my ($form, $form_num) = $self->_get_new_ticket_form;
 
     return undef unless $form;
 
@@ -103,12 +107,12 @@
         }
     );
 
-    my $form = $self->_get_new_ticket_form();
+    my ($form,$form_num)  = $self->_get_new_ticket_form();
 
     my %form = map { 'field_' . $_ => $args{$_} } keys %args;
 
     $self->connection->mech->submit_form(
-        form_number => 2,                  # BRITTLE
+        form_number => $form_num,
         fields => { %form, submit => 1 }
     );
 
@@ -143,12 +147,12 @@
         }
     );
 
-    my $form = $self->_get_update_ticket_form();
+    my ($form,$form_num)= $self->_get_update_ticket_form();
 
     my %form = map { 'field_' . $_ => $args{$_} } keys %args;
 
     $self->connection->mech->submit_form(
-        form_name => 'propform',
+        form_number => $form_num,
         fields => { %form, submit => 1 }
     );
 
@@ -157,7 +161,6 @@
 
 }
 
-
 sub history {
     my $self = shift;
     my $hist = Net::Trac::TicketHistory->new(



More information about the Bps-public-commit mailing list