[Rt-commit] r16135 - in rt/branches/3.999-DANGEROUS: lib/RT/Action
sunnavy at bestpractical.com
sunnavy at bestpractical.com
Sun Sep 28 04:32:27 EDT 2008
Author: sunnavy
Date: Sun Sep 28 04:32:26 2008
New Revision: 16135
Modified:
rt/branches/3.999-DANGEROUS/ (props changed)
rt/branches/3.999-DANGEROUS/lib/RT/Action/UpdateTicket.pm
Log:
r16934 at sunnavys-mb: sunnavy | 2008-09-28 16:29:05 +0800
we can now call SUPER::take_action to do most work, yay!
Modified: rt/branches/3.999-DANGEROUS/lib/RT/Action/UpdateTicket.pm
==============================================================================
--- rt/branches/3.999-DANGEROUS/lib/RT/Action/UpdateTicket.pm (original)
+++ rt/branches/3.999-DANGEROUS/lib/RT/Action/UpdateTicket.pm Sun Sep 28 04:32:26 2008
@@ -17,53 +17,18 @@
foreach my $field (@date_fields) {
my $value = $self->argument_value($field);
if ( defined $value ) {
+ # convert date to be as utc
my $date = RT::Date->new();
$date->set(
format => 'unknown',
value => $value,
);
-# the date is not real utc, we set it as utc to get rid of user timezone
-# convert, since record->$obj already get converted, it's wrong to convert
-# it too.
- my $fake_utc_date = RT::Date->new();
- $fake_utc_date->set(
- format => 'unknown',
- value => $value,
- timezone => 'UTC',
- );
-
- my $obj = $field . '_obj';
- if ( $fake_utc_date->unix != $self->record->$obj()->unix() ) {
- my $old = $self->record->$obj;
- my $set = "set_$field";
- my ( $status, $msg ) = $self->record->$set( $date->iso );
- if ($status) {
- $self->result->content(
- $field,
- _(
- "%1 changed from %2 to %3",
- $field,
- $old->unix
- ? $old->iso
- : _('Not Set'),
- $fake_utc_date->unix ? $fake_utc_date->iso
- : _('Not Set')
- )
- );
- }
- else {
- $self->result->failure(
- _( 'Update %1 failed: %2', $field, $msg ) );
- last;
- }
- }
+ $self->argument_value( $field, $date->iso );
}
}
- unless ( $self->result->failure ) {
- $self->report_success;
- }
+ $self->SUPER::take_action;
return 1;
}
@@ -74,16 +39,20 @@
$self->result->message( _('Dates Updated') );
}
-sub get_results {
+sub detailed_messages {
my $self = shift;
my $result = {Jifty->web->response->results}->{$self->moniker};
my @results;
if ($result) {
- for my $type ( sort keys %{ $result->content } ) {
- push @results, $result->content->{$type};
+ for my $type ( sort keys %{ $result->content->{detailed_messages} } ) {
+ push @results, $result->content->{detailed_messages}{$type};
}
}
return @results;
}
+sub report_detailed_messages {
+ return 1;
+}
+
1;
More information about the Rt-commit
mailing list