diff options
Diffstat (limited to 'rt')
| -rw-r--r-- | rt/lib/RT/Action/Accumulate.pm | 34 | ||||
| -rw-r--r-- | rt/lib/RT/URI/freeside/Internal.pm | 28 | ||||
| -rw-r--r-- | rt/share/html/Ticket/Elements/EditCustomers | 4 | ||||
| -rw-r--r-- | rt/share/html/Ticket/Elements/ShowCustomers | 2 | 
4 files changed, 44 insertions, 24 deletions
| diff --git a/rt/lib/RT/Action/Accumulate.pm b/rt/lib/RT/Action/Accumulate.pm index 14675b894..0da7d2ef5 100644 --- a/rt/lib/RT/Action/Accumulate.pm +++ b/rt/lib/RT/Action/Accumulate.pm @@ -23,20 +23,38 @@ the same name, and should be single-valued fields.  sub Prepare {      my $self = shift;      my $cfname = $self->Argument or return 0; -    $self->{'inc_by'} = $self->TransactionObj->FirstCustomFieldValue($cfname)  -                        || ''; -    return ( $self->{'inc_by'} =~ /^(\d+)$/ ); +    #RT::Logger->info('Accumulate::Prepare called on transaction '. +    #                   $self->TransactionObj->Id." field $cfname"); +    my $TransObj = $self->TransactionObj; +    my $TicketObj = $self->TicketObj; +    if ( $TransObj->Type eq 'Create' and +         !defined($TransObj->FirstCustomFieldValue($cfname)) ) { +        # special case: we're creating a new ticket, and the initial value +        # may have been set on the ticket instead of the transaction, so +        # update the transaction to match +        $self->{'obj'} = $TransObj; +        $self->{'inc_by'} = $TicketObj->FirstCustomFieldValue($cfname); +    } else { +        # the usual case when updating an existing ticket +        $self->{'obj'} = $TicketObj; +        $self->{'inc_by'} = $TransObj->FirstCustomFieldValue($cfname)  +                            || ''; +    } +    return ( $self->{'inc_by'} =~ /^(\d+)$/ ); # else it's empty  }  sub Commit {      my $self = shift;      my $cfname = $self->Argument; +    my $obj = $self->{'obj'};      my $newval = $self->{'inc_by'} +  -      ($self->TicketObj->FirstCustomFieldValue($cfname) || 0); -    my ($val) = $self->TicketObj->AddCustomFieldValue( -      Field => 'Support time', -      Value => $newval, -      RecordTransaction => 0, +      ($obj->FirstCustomFieldValue($cfname) || 0); +      #RT::Logger->info('Accumulate::Commit called on '.ref($obj).' '. +      #                 $obj->Id." field $cfname"); +    my ($val) = $obj->AddCustomFieldValue( +        Field => $cfname, +        Value => $newval, +        RecordTransaction => 0,      );      return $val;  } diff --git a/rt/lib/RT/URI/freeside/Internal.pm b/rt/lib/RT/URI/freeside/Internal.pm index 61b256ef9..b0962860d 100644 --- a/rt/lib/RT/URI/freeside/Internal.pm +++ b/rt/lib/RT/URI/freeside/Internal.pm @@ -143,7 +143,7 @@ sub small_custview {  } -sub _FreesideURILabelLong { +sub AsStringLong {    my $self = shift; @@ -161,30 +161,28 @@ sub _FreesideURILabelLong {    } elsif ( $table eq 'cust_svc' ) {      my $string = ''; -    # we now do this within the UI -    #my $cust = $self->CustomerResolver; -    #if ( $cust ) { -    #  $string = $cust->AsStringLong; -    #} -    $string .= $self->AsString; +    my $cust = $self->CustomerResolver; +    if ( $cust ) { +      # the customer's small_custview +      $string = $cust->AsStringLong(); +    } +    # + the service label and link +    $string .= $self->ShortLink;      return $string;    } else { -    return $self->_FreesideURILabel(); +    return $self->SUPER::AsStringLong;    }  } -sub AsString { +sub ShortLink { +  # because I don't want AsString to sometimes return a hunk of HTML, but +  # on the other hand AsStringLong does something specific.    my $self = shift; -  if ( $self->{'fstable'} eq 'cust_svc' ) { -    return '<B><A HREF="' . $self->HREF . '">' .  -          $self->_FreesideURILabel . '</A></B>'; -  } else { -    $self->SUPER::AsString; -  } +  '<B><A HREF="'.$self->HREF.'">' . $self->_FreesideURILabel . '</A></B>';  }  sub CustomerResolver { diff --git a/rt/share/html/Ticket/Elements/EditCustomers b/rt/share/html/Ticket/Elements/EditCustomers index e8aa69edc..cc9956f91 100644 --- a/rt/share/html/Ticket/Elements/EditCustomers +++ b/rt/share/html/Ticket/Elements/EditCustomers @@ -38,7 +38,11 @@  %       }      </td>      <td> +%       if ( $resolver->URI =~ /cust_main/ ) {        <% $resolver->AsStringLong |n %> +%       } elsif ( $resolver->URI =~ /cust_svc/ ) { +      <% $resolver->ShortLink |n %> +%       }      </td>    </tr>  %     } diff --git a/rt/share/html/Ticket/Elements/ShowCustomers b/rt/share/html/Ticket/Elements/ShowCustomers index 175822f52..f9b0133b5 100644 --- a/rt/share/html/Ticket/Elements/ShowCustomers +++ b/rt/share/html/Ticket/Elements/ShowCustomers @@ -24,7 +24,7 @@ my %data = $m->comp('Customers', Ticket => $Ticket);      <td class="value">        <% $cust->AsStringLong |n %>  %   foreach my $svc ( @{ $data{cust_svc}{$custnum} || [] } ) { -      <% $svc->AsString |n %> +      <% $svc->ShortLink |n %>        <br>  %   }      </td> | 
