[Rt-commit] r18589 - in rt/3.999/branches/lorzy: . bin etc lib/RT lib/RT/Condition lib/RT/DateTime lib/RT/Interface lib/RT/Model lib/RT/ScripAction share/html/Admin/CustomFields share/html/Admin/Elements share/html/Approvals/Elements share/html/Elements share/html/Elements/RT__Model__Ticket share/html/NoAuth/iCal share/html/Search share/html/Ticket/Elements t/api t/approval t/ticket
clkao at bestpractical.com
clkao at bestpractical.com
Wed Feb 25 11:50:10 EST 2009
Author: clkao
Date: Wed Feb 25 11:50:10 2009
New Revision: 18589
Added:
rt/3.999/branches/lorzy/etc/pg_vendor_config.yml
rt/3.999/branches/lorzy/etc/sqlite_vendor_config.yml
rt/3.999/branches/lorzy/lib/RT/DateTime/
rt/3.999/branches/lorzy/lib/RT/DateTime.pm
rt/3.999/branches/lorzy/lib/RT/DateTime/Duration.pm
Modified:
rt/3.999/branches/lorzy/ (props changed)
rt/3.999/branches/lorzy/TODO.jifty.woos
rt/3.999/branches/lorzy/bin/rt
rt/3.999/branches/lorzy/bin/rt-mailgate
rt/3.999/branches/lorzy/etc/initialdata
rt/3.999/branches/lorzy/lib/RT/Condition/BeforeDue.pm
rt/3.999/branches/lorzy/lib/RT/Condition/Overdue.pm
rt/3.999/branches/lorzy/lib/RT/CurrentUser.pm
rt/3.999/branches/lorzy/lib/RT/Interface/Web.pm
rt/3.999/branches/lorzy/lib/RT/Model/Attachment.pm
rt/3.999/branches/lorzy/lib/RT/Model/CustomFieldValue.pm
rt/3.999/branches/lorzy/lib/RT/Model/ScripCollection.pm
rt/3.999/branches/lorzy/lib/RT/Model/Ticket.pm
rt/3.999/branches/lorzy/lib/RT/Model/Transaction.pm
rt/3.999/branches/lorzy/lib/RT/Record.pm
rt/3.999/branches/lorzy/lib/RT/ScripAction/CreateTickets.pm
rt/3.999/branches/lorzy/lib/RT/ScripAction/EscalatePriority.pm
rt/3.999/branches/lorzy/lib/RT/ScripAction/LinearEscalate.pm
rt/3.999/branches/lorzy/lib/RT/Test.pm
rt/3.999/branches/lorzy/share/html/Admin/CustomFields/Modify.html
rt/3.999/branches/lorzy/share/html/Admin/Elements/AddCustomFieldValue
rt/3.999/branches/lorzy/share/html/Admin/Elements/EditCustomFieldValues
rt/3.999/branches/lorzy/share/html/Approvals/Elements/PendingMyApproval
rt/3.999/branches/lorzy/share/html/Elements/CollectionAsTable/Row
rt/3.999/branches/lorzy/share/html/Elements/ColumnMap
rt/3.999/branches/lorzy/share/html/Elements/EditCustomFieldSelect
rt/3.999/branches/lorzy/share/html/Elements/MyReminders
rt/3.999/branches/lorzy/share/html/Elements/RT__Model__Ticket/ColumnMap
rt/3.999/branches/lorzy/share/html/NoAuth/iCal/dhandler
rt/3.999/branches/lorzy/share/html/Search/Bulk.html
rt/3.999/branches/lorzy/share/html/Search/Results.rdf
rt/3.999/branches/lorzy/share/html/Search/Results.tsv
rt/3.999/branches/lorzy/share/html/Ticket/Elements/EditDates
rt/3.999/branches/lorzy/share/html/Ticket/Elements/Reminders
rt/3.999/branches/lorzy/share/html/Ticket/Elements/ShowAttachments
rt/3.999/branches/lorzy/share/html/Ticket/Elements/ShowDates
rt/3.999/branches/lorzy/share/html/Ticket/Elements/ShowTransaction
rt/3.999/branches/lorzy/t/api/cf_combo_casacade.t
rt/3.999/branches/lorzy/t/api/date.t
rt/3.999/branches/lorzy/t/api/ticket.t
rt/3.999/branches/lorzy/t/api/tickets_overlay_sql.t
rt/3.999/branches/lorzy/t/approval/basic.t
rt/3.999/branches/lorzy/t/ticket/deferred_owner.t
rt/3.999/branches/lorzy/t/ticket/search_by_txn.t
Log:
merge from trunk
Modified: rt/3.999/branches/lorzy/TODO.jifty.woos
==============================================================================
--- rt/3.999/branches/lorzy/TODO.jifty.woos (original)
+++ rt/3.999/branches/lorzy/TODO.jifty.woos Wed Feb 25 11:50:10 2009
@@ -3,7 +3,7 @@
don't get why null_reference is record method instead of column property,
naming is not obvious, as well.
-check_create_rights and refernces don't play well together as you have to
+check_create_rights and references don't play well together as you have to
write a lot of code of additional checks.
As well, you can not return another error code - validation is not applied at
Modified: rt/3.999/branches/lorzy/bin/rt
==============================================================================
--- rt/3.999/branches/lorzy/bin/rt (original)
+++ rt/3.999/branches/lorzy/bin/rt Wed Feb 25 11:50:10 2009
@@ -1,4 +1,4 @@
-#!/usr/bin/env perl -w
+#!/usr/bin/env perl
# BEGIN BPS TAGGED BLOCK {{{
#
# COPYRIGHT:
@@ -50,6 +50,7 @@
# Abhijit Menon-Sen <ams at wiw.org>
use strict;
+use warnings;
# This program is intentionally written to have as few non-core module
# dependencies as possible. It should stay that way.
Modified: rt/3.999/branches/lorzy/bin/rt-mailgate
==============================================================================
--- rt/3.999/branches/lorzy/bin/rt-mailgate (original)
+++ rt/3.999/branches/lorzy/bin/rt-mailgate Wed Feb 25 11:50:10 2009
@@ -1,4 +1,4 @@
-#!/usr/bin/env perl -w
+#!/usr/bin/env perl
# BEGIN BPS TAGGED BLOCK {{{
#
# COPYRIGHT:
Modified: rt/3.999/branches/lorzy/etc/initialdata
==============================================================================
--- rt/3.999/branches/lorzy/etc/initialdata (original)
+++ rt/3.999/branches/lorzy/etc/initialdata Wed Feb 25 11:50:10 2009
@@ -112,13 +112,13 @@
{ name => 'On Transaction', # loc
description => 'When anything happens', # loc
- applicable_trans_types => 'Any',
+ applicable_trans_types => 'any',
exec_module => 'AnyTransaction', },
{
name => 'On Correspond', # loc
description => 'Whenever correspondence comes in', # loc
- applicable_trans_types => 'Correspond',
+ applicable_trans_types => 'correspond',
exec_module => 'AnyTransaction', },
{
@@ -131,7 +131,7 @@
name => 'On Status Change', # loc
description => 'Whenever a ticket\'s status changes', # loc
- applicable_trans_types => 'Status',
+ applicable_trans_types => 'status',
exec_module => 'AnyTransaction',
},
@@ -139,14 +139,14 @@
name => 'On priority Change', # loc
description => 'Whenever a ticket\'s priority changes', # loc
- applicable_trans_types => 'Set',
+ applicable_trans_types => 'set',
exec_module => 'priorityChange',
},
{
name => 'On owner Change', # loc
description => 'Whenever a ticket\'s owner changes', # loc
- applicable_trans_types => 'Any',
+ applicable_trans_types => 'any',
exec_module => 'OwnerChange',
},
@@ -154,13 +154,13 @@
name => 'On queue Change', # loc
description => 'Whenever a ticket\'s queue changes', # loc
- applicable_trans_types => 'Set',
+ applicable_trans_types => 'set',
exec_module => 'QueueChange',
},
{ name => 'On Resolve', # loc
description => 'Whenever a ticket is resolved', # loc
- applicable_trans_types => 'Status',
+ applicable_trans_types => 'status',
exec_module => 'StatusChange',
argument => 'resolved'
@@ -168,12 +168,12 @@
{ name => 'On Close', # loc
description => 'Whenever a ticket is closed', # loc
- applicable_trans_types => 'Status,Set',
+ applicable_trans_types => 'status,set',
exec_module => 'CloseTicket',
},
{ name => 'On Reopen', # loc
description => 'Whenever a ticket is reopened', # loc
- applicable_trans_types => 'Status,Set',
+ applicable_trans_types => 'status,set',
exec_module => 'ReopenTicket',
},
@@ -221,7 +221,7 @@
content => 'RT-Attach-Message: yes
-{$transaction->created_as_string}: Request {$ticket->id} was acted upon.
+{$transaction->created}: Request {$ticket->id} was acted upon.
Transaction: {$transaction->description}
Queue: {$ticket->queue->name}
Subject: {$transaction->subject || $ticket->subject || "(No subject given)"}
Added: rt/3.999/branches/lorzy/etc/pg_vendor_config.yml
==============================================================================
--- (empty file)
+++ rt/3.999/branches/lorzy/etc/pg_vendor_config.yml Wed Feb 25 11:50:10 2009
@@ -0,0 +1,5 @@
+---
+framework:
+ Database:
+ Driver: Pg
+ User: postgres
Added: rt/3.999/branches/lorzy/etc/sqlite_vendor_config.yml
==============================================================================
--- (empty file)
+++ rt/3.999/branches/lorzy/etc/sqlite_vendor_config.yml Wed Feb 25 11:50:10 2009
@@ -0,0 +1,5 @@
+---
+framework:
+ Database:
+ Driver: SQLite
+ User: ''
Modified: rt/3.999/branches/lorzy/lib/RT/Condition/BeforeDue.pm
==============================================================================
--- rt/3.999/branches/lorzy/lib/RT/Condition/BeforeDue.pm (original)
+++ rt/3.999/branches/lorzy/lib/RT/Condition/BeforeDue.pm Wed Feb 25 11:50:10 2009
@@ -66,8 +66,8 @@
my $cur = RT::Date->new( RT->system_user );
$cur->set_to_now();
- my $due = $self->ticket_obj->due_obj;
- return (undef) if $due->unix <= 0;
+ my $due = $self->ticket_obj->due;
+ return (undef) if $due->epoch <= 0;
my $diff = $due->diff($cur);
if ( $diff >= 0 and $diff <= $elapse ) {
Modified: rt/3.999/branches/lorzy/lib/RT/Condition/Overdue.pm
==============================================================================
--- rt/3.999/branches/lorzy/lib/RT/Condition/Overdue.pm (original)
+++ rt/3.999/branches/lorzy/lib/RT/Condition/Overdue.pm Wed Feb 25 11:50:10 2009
@@ -68,8 +68,8 @@
sub is_applicable {
my $self = shift;
- if ( $self->ticket_obj->due_obj->unix > 0
- and $self->ticket_obj->due_obj->unix < time() )
+ if ( $self->ticket_obj->due->epoch > 0
+ and $self->ticket_obj->due->epoch < time() )
{
return (1);
} else {
Modified: rt/3.999/branches/lorzy/lib/RT/CurrentUser.pm
==============================================================================
--- rt/3.999/branches/lorzy/lib/RT/CurrentUser.pm (original)
+++ rt/3.999/branches/lorzy/lib/RT/CurrentUser.pm Wed Feb 25 11:50:10 2009
@@ -102,6 +102,25 @@
=cut
+sub new {
+ my $class = shift;
+ if ($#_ == 0 && ref $_[0] && ref $_[0] eq 'RT::Model::User') {
+ unshift @_, 'user_object';
+ }
+ $class->SUPER::new(@_);
+}
+
+sub _init {
+ my $self = shift;
+ my %args = @_;
+ if ($args{user_object}) {
+ $self->user_object($args{user_object});
+ return 1;
+ }
+
+ return $self->SUPER::_init(@_);
+}
+
sub create {
my $self = shift;
Jifty->log->error('RT::CurrentUser is read-only, RT::Model::User for manipulation');
Added: rt/3.999/branches/lorzy/lib/RT/DateTime.pm
==============================================================================
--- (empty file)
+++ rt/3.999/branches/lorzy/lib/RT/DateTime.pm Wed Feb 25 11:50:10 2009
@@ -0,0 +1,31 @@
+use strict;
+use warnings;
+
+package RT::DateTime;
+use base 'Jifty::DateTime';
+
+use RT::DateTime::Duration;
+
+use constant duration_class => 'RT::DateTime::Duration';
+
+sub _stringify {
+ my $self = shift;
+
+ return "unset" if $self->epoch == 0;
+ return $self->SUPER::_stringify(@_);
+}
+
+sub age {
+ my $self = shift;
+ my $until = shift || RT::DateTime->now;
+
+ # XXX: This doesn't work yet because DateTime doesn't have a duration_class
+ # method
+ # return $until - $self;
+
+ my $duration = $until - $self;
+ bless $duration, $self->duration_class;
+}
+
+1;
+
Added: rt/3.999/branches/lorzy/lib/RT/DateTime/Duration.pm
==============================================================================
--- (empty file)
+++ rt/3.999/branches/lorzy/lib/RT/DateTime/Duration.pm Wed Feb 25 11:50:10 2009
@@ -0,0 +1,20 @@
+use strict;
+use warnings;
+
+package RT::DateTime::Duration;
+use base 'DateTime::Duration';
+
+use overload (
+ q{""} => '_stringify',
+);
+
+sub _stringify {
+ my $self = shift;
+ my ($days, $hours, $minutes) = $self->in_units('days', 'hours', 'minutes');
+
+ # Obviously not good enough, but a start.
+ return "$days days, $hours hours, $minutes minutes";
+}
+
+1;
+
Modified: rt/3.999/branches/lorzy/lib/RT/Interface/Web.pm
==============================================================================
--- rt/3.999/branches/lorzy/lib/RT/Interface/Web.pm (original)
+++ rt/3.999/branches/lorzy/lib/RT/Interface/Web.pm Wed Feb 25 11:50:10 2009
@@ -481,7 +481,7 @@
}
foreach my $arg ( keys %ARGS ) {
- next if $arg =~ /-(?:magic|category)$/;
+ next if $arg =~ /-(?:magic)$/;
if ( $arg =~ /^object-RT::Model::Transaction--CustomField-/ ) {
$create_args{$arg} = $ARGS{$arg};
@@ -1099,7 +1099,6 @@
my @results;
foreach my $arg ( keys %{ $args{'ARGS'} } ) {
- next if $arg =~ /category$/;
# since http won't pass in a form element with a null value, we need
# to fake it
@@ -1350,8 +1349,8 @@
);
my $obj = $field . "_obj";
- if ( ( defined $DateObj->unix )
- and ( $DateObj->unix != $Ticket->$obj()->unix() ) )
+ if ( ( defined $DateObj->epoch )
+ and ( $DateObj->epoch != $Ticket->$obj->epoch ) )
{
my $method = "set_$field";
my ( $code, $msg ) = $Ticket->$method( $DateObj->iso );
Modified: rt/3.999/branches/lorzy/lib/RT/Model/Attachment.pm
==============================================================================
--- rt/3.999/branches/lorzy/lib/RT/Model/Attachment.pm (original)
+++ rt/3.999/branches/lorzy/lib/RT/Model/Attachment.pm Wed Feb 25 11:50:10 2009
@@ -410,7 +410,7 @@
$body =~ s/^/> /gm;
- $body = '[' . $self->transaction_obj->creator_obj->name() . ' - ' . $self->transaction_obj->created_as_string() . "]:\n\n" . $body . "\n\n";
+ $body = '[' . $self->transaction_obj->creator_obj->name() . ' - ' . $self->transaction_obj->created . "]:\n\n" . $body . "\n\n";
} else {
$body = "[Non-text message not quoted]\n\n";
Modified: rt/3.999/branches/lorzy/lib/RT/Model/CustomFieldValue.pm
==============================================================================
--- rt/3.999/branches/lorzy/lib/RT/Model/CustomFieldValue.pm (original)
+++ rt/3.999/branches/lorzy/lib/RT/Model/CustomFieldValue.pm Wed Feb 25 11:50:10 2009
@@ -83,7 +83,6 @@
name => '',
description => '',
sort_order => 0,
- category => '',
@_,
);
@@ -107,43 +106,9 @@
);
return ( $id, $msg ) unless $id;
- if ( defined $args{'category'} && length $args{'category'} ) {
-
- # $self would be loaded at this stage
- my ( $status, $msg ) = $self->set_category( $args{'category'} );
- unless ($status) {
- Jifty->log->error("Couldn't set category: $msg");
- }
- }
-
return ( $id, $msg );
}
-sub category {
- my $self = shift;
- my $attr = $self->first_attribute('category') or return undef;
- return $attr->content;
-}
-
-sub set_category {
- my $self = shift;
- my $category = shift;
- if ( defined $category && length $category ) {
- return $self->set_attribute(
- name => 'category',
- content => $category,
- );
- } else {
- my ( $status, $msg ) = $self->delete_attribute('category');
- unless ($status) {
- Jifty->log->warn("Couldn't delete atribute: $msg");
- }
-
- # return true even if there was no category
- return ( 1, _('category unset') );
- }
-}
-
sub validate_name {
return defined $_[1] && length $_[1];
}
Modified: rt/3.999/branches/lorzy/lib/RT/Model/ScripCollection.pm
==============================================================================
--- rt/3.999/branches/lorzy/lib/RT/Model/ScripCollection.pm (original)
+++ rt/3.999/branches/lorzy/lib/RT/Model/ScripCollection.pm Wed Feb 25 11:50:10 2009
@@ -345,7 +345,7 @@
alias => $ConditionsAlias,
column => 'applicable_trans_types',
operator => 'LIKE',
- value => "Any",
+ value => "any",
entry_aggregator => 'OR',
);
Modified: rt/3.999/branches/lorzy/lib/RT/Model/Ticket.pm
==============================================================================
--- rt/3.999/branches/lorzy/lib/RT/Model/Ticket.pm (original)
+++ rt/3.999/branches/lorzy/lib/RT/Model/Ticket.pm Wed Feb 25 11:50:10 2009
@@ -119,7 +119,11 @@
filters are qw( Jifty::Filter::DateTime Jifty::DBI::Filter::DateTime),
render_as 'DateTime',
label is _('Due');
- column resolved => type is 'timestamp';
+ column resolved => type is 'timestamp',
+ filters are qw( Jifty::Filter::DateTime Jifty::DBI::Filter::DateTime),
+ render_as 'DateTime',
+ label is _('Closed');
+ ;
column disabled => max_length is 6, type is 'smallint', default is '0';
};
use Jifty::Plugin::ActorMetadata::Mixin::Model::ActorMetadata map => {
@@ -1365,45 +1369,6 @@
-=head2 due_obj
-
- Returns an RT::Date object containing this ticket's due date
-
-=cut
-
-sub due_obj {
- my $self = shift;
-
- my $time = RT::Date->new();
-
- # -1 is RT::Date slang for never
- if ( my $due = $self->due ) {
- $time->set( format => 'sql', value => $due );
- } else {
- $time->set( format => 'unix', value => -1 );
- }
-
- return $time;
-}
-
-
-
-=head2 resolved_obj
-
- Returns an RT::Date object of this ticket's 'resolved' time.
-
-=cut
-
-sub resolved_obj {
- my $self = shift;
-
- my $time = RT::Date->new();
- $time->set( format => 'sql', value => $self->resolved );
- return $time;
-}
-
-
-
=head2 set_started
Takes a date in ISO format or undef
@@ -1445,78 +1410,6 @@
}
-
-
-=head2 started_obj
-
- Returns an RT::Date object which contains this ticket's
-'started' time.
-
-=cut
-
-sub started_obj {
- my $self = shift;
-
- my $time = RT::Date->new();
- $time->set( format => 'sql', value => $self->started );
- return $time;
-}
-
-
-
-=head2 starts_obj
-
- Returns an RT::Date object which contains this ticket's
-'starts' time.
-
-=cut
-
-sub starts_obj {
- my $self = shift;
-
- my $time = RT::Date->new();
- $time->set( format => 'sql', value => $self->starts );
- return $time;
-}
-
-
-
-=head2 told_obj
-
- Returns an RT::Date object which contains this ticket's
-'told' time.
-
-=cut
-
-sub told_obj {
- my $self = shift;
-
- my $time = RT::Date->new();
- $time->set( format => 'sql', value => $self->told );
- return $time;
-}
-
-
-
-=head2 told_as_string
-
-A convenience method that returns told_obj->as_string
-
-TODO: This should be deprecated
-
-=cut
-
-sub told_as_string {
- my $self = shift;
- if ( $self->told ) {
- return $self->told_obj->as_string();
- } else {
- return ("Never");
- }
-}
-
-
-
=head2 time_worked_as_string
Returns the amount of time worked on this ticket as a Text String
Modified: rt/3.999/branches/lorzy/lib/RT/Model/Transaction.pm
==============================================================================
--- rt/3.999/branches/lorzy/lib/RT/Model/Transaction.pm (original)
+++ rt/3.999/branches/lorzy/lib/RT/Model/Transaction.pm Wed Feb 25 11:50:10 2009
@@ -548,7 +548,7 @@
}
$content =~ s/^/> /gm;
- $content = _( "On %1, %2 wrote:", $self->created_as_string, $self->creator_obj->name ) . "\n$content\n\n";
+ $content = _( "On %1, %2 wrote:", $self->created, $self->creator_obj->name ) . "\n$content\n\n";
}
return ($content);
Modified: rt/3.999/branches/lorzy/lib/RT/Record.pm
==============================================================================
--- rt/3.999/branches/lorzy/lib/RT/Record.pm (original)
+++ rt/3.999/branches/lorzy/lib/RT/Record.pm Wed Feb 25 11:50:10 2009
@@ -345,78 +345,6 @@
}
-
-# There is room for optimizations in most of those subs:
-
-
-sub last_updated_obj {
- my $self = shift;
- my $obj = RT::Date->new();
-
- $obj->set( format => 'sql', value => $self->last_updated );
- return $obj;
-}
-
-
-
-sub created_obj {
- my $self = shift;
- my $obj = RT::Date->new();
-
- $obj->set( format => 'sql', value => $self->created );
-
- return $obj;
-}
-
-
-#
-# TODO: This should be deprecated
-#
-sub age_as_string {
- my $self = shift;
- return ( $self->created_obj->age_as_string() );
-}
-
-
-
-# TODO this should be deprecated
-
-sub last_updated_as_string {
- my $self = shift;
- if ( $self->last_updated ) {
- return ( $self->last_updated_obj->as_string() );
-
- } else {
- return "never";
- }
-}
-
-
-#
-# TODO This should be deprecated
-#
-sub created_as_string {
- my $self = shift;
- return ( $self->created_obj->as_string() );
-}
-
-
-#
-# TODO This should be deprecated
-#
-sub long_since_update_as_string {
- my $self = shift;
- if ( $self->last_updated ) {
-
- return ( $self->last_updated_obj->age_as_string() );
-
- } else {
- return "never";
- }
-}
-
-
-
#
sub _set {
my $self = shift;
@@ -727,7 +655,8 @@
my $object = $attribute . "_obj";
next if ( $self->can($object) && $self->$object->name eq $value );
};
- next if ( $value eq ( $self->$attribute() || '' ) );
+ my $current_value = $self->$attribute();
+ next if ( $value eq ( defined $current_value ? $current_value : '' ) );
my $method = "set_$attribute";
my ( $code, $msg ) = $self->$method($value);
my ($prefix) = ref($self) =~ /RT(?:.*)::(\w+)/;
@@ -1700,4 +1629,23 @@
return RT->config->get('WebPath') . "/index.html?q=";
}
+=head2 _get_current_user
+
+This overridden version of C<_get_current_user> allows user object to
+be coerced into CurrentUser object during C<Model->new( current_user => $u)>.
+
+=cut
+
+sub _get_current_user {
+ my ($self, %args) = @_;
+ return if ( ref($self) && $self->current_user );
+
+ if ( my $cu = $args{'current_user'}) {
+ $args{'current_user'} = RT::CurrentUser->new(user_object => $cu)
+ if $cu->isa('RT::Model::User');
+ }
+
+ return $self->SUPER::_get_current_user(%args);
+}
+
1;
Modified: rt/3.999/branches/lorzy/lib/RT/ScripAction/CreateTickets.pm
==============================================================================
--- rt/3.999/branches/lorzy/lib/RT/ScripAction/CreateTickets.pm (original)
+++ rt/3.999/branches/lorzy/lib/RT/ScripAction/CreateTickets.pm Wed Feb 25 11:50:10 2009
@@ -691,7 +691,7 @@
$dateobj->set( format => 'unix', value => $args{$date} );
} else {
eval { $dateobj->set( format => 'iso', value => $args{$date} ); };
- if ( $@ or $dateobj->unix <= 0 ) {
+ if ( $@ or $dateobj->epoch <= 0 ) {
$dateobj->set( format => 'unknown', value => $args{$date} );
}
}
@@ -935,10 +935,10 @@
$string .= "UpdateType: correspond\n";
$string .= "Content: \n";
$string .= "ENDOFCONTENT\n";
- $string .= "Due: " . $t->due_obj->as_string . "\n";
- $string .= "starts: " . $t->starts_obj->as_string . "\n";
- $string .= "Started: " . $t->started_obj->as_string . "\n";
- $string .= "Resolved: " . $t->resolved_obj->as_string . "\n";
+ $string .= "Due: " . $t->due . "\n";
+ $string .= "Starts: " . $t->starts . "\n";
+ $string .= "Started: " . $t->started . "\n";
+ $string .= "Resolved: " . $t->resolved . "\n";
$string .= "Owner: " . $t->owner->name . "\n";
$string .= "Requestor: " . $t->role_group("requestor")->member_emails_as_string . "\n";
$string .= "Cc: " . $t->role_group("cc")->member_emails_as_string . "\n";
@@ -986,10 +986,10 @@
$string .= "Queue: " . $t->queue . "\n";
$string .= "Subject: " . $t->subject . "\n";
$string .= "Status: " . $t->status . "\n";
- $string .= "Due: " . $t->due_obj->unix . "\n";
- $string .= "starts: " . $t->starts_obj->unix . "\n";
- $string .= "Started: " . $t->started_obj->unix . "\n";
- $string .= "Resolved: " . $t->resolved_obj->unix . "\n";
+ $string .= "Due: " . $t->due->epoch . "\n";
+ $string .= "Starts: " . $t->starts->epoch . "\n";
+ $string .= "Started: " . $t->started->epoch . "\n";
+ $string .= "Resolved: " . $t->resolved->epoch . "\n";
$string .= "Owner: " . $t->owner . "\n";
$string .= "Requestor: " . $t->role_group("requestor")->member_emails_as_string . "\n";
$string .= "Cc: " . $t->role_group("cc")->member_emails_as_string . "\n";
Modified: rt/3.999/branches/lorzy/lib/RT/ScripAction/EscalatePriority.pm
==============================================================================
--- rt/3.999/branches/lorzy/lib/RT/ScripAction/EscalatePriority.pm (original)
+++ rt/3.999/branches/lorzy/lib/RT/ScripAction/EscalatePriority.pm Wed Feb 25 11:50:10 2009
@@ -95,11 +95,11 @@
}
#compute the number of days until the ticket is due
- my $due = $self->ticket_obj->due_obj();
+ my $due = $self->ticket_obj->due;
# If we don't have a due date, adjust the priority by one
# until we hit the final priority
- if ( $due->unix() < 1 ) {
+ if ( $due->epoch < 1 ) {
if ( $self->ticket_obj->priority > $self->ticket_obj->final_priority ) {
$self->{'prio'} = ( $self->ticket_obj->priority - 1 );
return 1;
Modified: rt/3.999/branches/lorzy/lib/RT/ScripAction/LinearEscalate.pm
==============================================================================
--- rt/3.999/branches/lorzy/lib/RT/ScripAction/LinearEscalate.pm (original)
+++ rt/3.999/branches/lorzy/lib/RT/ScripAction/LinearEscalate.pm Wed Feb 25 11:50:10 2009
@@ -157,7 +157,7 @@
my $ticket = $self->ticket_obj;
- my $due = $ticket->due_obj->unix;
+ my $due = $ticket->due->epoch;
unless ( $due > 0 ) {
Jifty->log->debug('Due is not set. Not escalating.');
return 1;
@@ -187,8 +187,8 @@
# now we know we have a due date. for every day that passes,
# increment priority according to the formula
- my $starts = $ticket->starts_obj->unix;
- $starts = $ticket->created_obj->unix unless $starts > 0;
+ my $starts = $ticket->starts->epoch;
+ $starts = $ticket->created->epoch unless $starts > 0;
my $now = time;
# do nothing if we didn't reach starts or created date
Modified: rt/3.999/branches/lorzy/lib/RT/Test.pm
==============================================================================
--- rt/3.999/branches/lorzy/lib/RT/Test.pm (original)
+++ rt/3.999/branches/lorzy/lib/RT/Test.pm Wed Feb 25 11:50:10 2009
@@ -127,6 +127,7 @@
set( \$WebbaseURL , "http://localhost:\$WebPort");
set( \$LogToScreen , "debug");
set( \$LogStackTraces , "warning");
+set( \$MailCommand, 'testfile' );
};
print $config $args{'config'} if $args{'config'};
print $config "\n1;\n";
Modified: rt/3.999/branches/lorzy/share/html/Admin/CustomFields/Modify.html
==============================================================================
--- rt/3.999/branches/lorzy/share/html/Admin/CustomFields/Modify.html (original)
+++ rt/3.999/branches/lorzy/share/html/Admin/CustomFields/Modify.html Wed Feb 25 11:50:10 2009
@@ -184,7 +184,7 @@
# Update any existing values
my $values = $CustomFieldObj->values_obj;
while ( my $value = $values->next ) {
- foreach my $attr qw(name description sort_order category) {
+ foreach my $attr qw(name description sort_order ) {
my $param = "$paramtag-". $value->id ."-". $attr;
next unless exists $ARGS{$param};
next if ($value->$attr()||'') eq ($ARGS{$param}||'');
@@ -199,7 +199,7 @@
if ( defined $ARGS{ $paramtag ."-new-name" } && length $ARGS{ $paramtag ."-new-name" } ) {
my ($id, $msg) = $CustomFieldObj->add_value(
map { $_ => $ARGS{ $paramtag ."-new-$_" } }
- qw( name description sort_order category )
+ qw( name description sort_order )
);
push (@results, $msg);
}
Modified: rt/3.999/branches/lorzy/share/html/Admin/Elements/AddCustomFieldValue
==============================================================================
--- rt/3.999/branches/lorzy/share/html/Admin/Elements/AddCustomFieldValue (original)
+++ rt/3.999/branches/lorzy/share/html/Admin/Elements/AddCustomFieldValue Wed Feb 25 11:50:10 2009
@@ -53,9 +53,6 @@
<th><&|/l&>Sort</&></th>
<th><&|/l&>name</&></th>
<th><&|/l&>description</&></th>
-% if ( $custom_field->type ne 'Combobox' ) {
-<th><&|/l&>category</&></th>
-% }
</tr>
% my $paramtag = "CustomField-". $custom_field->id ."-value-new";
@@ -63,9 +60,6 @@
<td><input type="text" size="3" name="<% $paramtag %>-sort_order" /></td>
<td><input type="text" size="25" name="<% $paramtag %>-name" /></td>
<td><input type="text" size="45" name="<% $paramtag %>-description" /></td>
-% if ( $custom_field->type ne 'Combobox' ) {
-<td><input type="text" size="10" name="<% $paramtag %>-category" /></td>
-% }
</tr>
</table>
Modified: rt/3.999/branches/lorzy/share/html/Admin/Elements/EditCustomFieldValues
==============================================================================
--- rt/3.999/branches/lorzy/share/html/Admin/Elements/EditCustomFieldValues (original)
+++ rt/3.999/branches/lorzy/share/html/Admin/Elements/EditCustomFieldValues Wed Feb 25 11:50:10 2009
@@ -57,9 +57,6 @@
<th><&|/l&>Sort</&></th>
<th><&|/l&>name</&></th>
<th><&|/l&>description</&></th>
-% if ($custom_field->type ne 'Combobox') {
-<th><&|/l&>category</&></th>
-% }
</tr>
% while ( my $value = $values->next ) {
@@ -69,10 +66,6 @@
<td><input type="text" size="3" name="<% $paramtag %>-sort_order" value="<% $value->sort_order %>" /></td>
<td><input type="text" size="25" name="<% $paramtag %>-name" value="<% $value->name %>" /></td>
<td><input type="text" size="45" name="<% $paramtag %>-description" value="<% $value->description %>" /></td>
-% if ( $custom_field->type ne 'Combobox' ) {
-<td><input type="text" size="10" name="<% $paramtag %>-category" value="<%
- $value->category || '' %>" /></td>
-% }
</tr>
% }
Modified: rt/3.999/branches/lorzy/share/html/Approvals/Elements/PendingMyApproval
==============================================================================
--- rt/3.999/branches/lorzy/share/html/Approvals/Elements/PendingMyApproval (original)
+++ rt/3.999/branches/lorzy/share/html/Approvals/Elements/PendingMyApproval Wed Feb 25 11:50:10 2009
@@ -63,9 +63,9 @@
<input type="checkbox" class="checkbox" value="1" name="show_rejected" <% defined($ARGS{'show_rejected'}) && $ARGS{'show_rejected'} && qq[checked="checked"] |n%> /> <&|/l&>Show denied requests</&><br />
<input type="checkbox" class="checkbox" value="1" name="show_dependent" <% defined($ARGS{'show_dependent'}) && $ARGS{'show_dependent'} && qq[checked="checked"] |n%> /> <&|/l&>Show requests awaiting other approvals</&><br />
-<&|/l,"<input size='15' value='".($Created_before->unix > 0 &&$Created_before->iso)."' name='created_before' id='CreatedBefore' class='datetime' />"&>Only show approvals for requests Created before %1</&><br />
+<&|/l,"<input size='15' value='".($Created_before->epoch > 0 &&$Created_before->iso)."' name='created_before' id='CreatedBefore' class='datetime' />"&>Only show approvals for requests Created before %1</&><br />
-<&|/l, "<input size='15' value='".( $Created_after->unix >0 && $Created_after->iso)."' name='created_after' id='CreatedAfter' class='datetime' />"&>Only show approvals for requests Created after %1</&>
+<&|/l, "<input size='15' value='".( $Created_after->epoch >0 && $Created_after->iso)."' name='created_after' id='CreatedAfter' class='datetime' />"&>Only show approvals for requests Created after %1</&>
</&>
<%init>
Modified: rt/3.999/branches/lorzy/share/html/Elements/CollectionAsTable/Row
==============================================================================
--- rt/3.999/branches/lorzy/share/html/Elements/CollectionAsTable/Row (original)
+++ rt/3.999/branches/lorzy/share/html/Elements/CollectionAsTable/Row Wed Feb 25 11:50:10 2009
@@ -76,7 +76,9 @@
next;
}
- my $css_class = $column->{class} ? encode_entities( $column->{class}, q{'"&<>} ) : 'collection-as-table';
+ my $css_class = $column->{class}
+ ? encode_entities( $column->{class}, q{'"&<>} ) # vim: '
+ : 'collection-as-table';
$m->out(qq{<td class="$css_class" });
my $align = $column->{align};
@@ -122,9 +124,21 @@
# All HTML snippets are returned by the callback function
# as scalar references. Data fetched from the objects are
# plain scalars, and needs to be escaped properly.
- push @out, grep defined && length,
- map { ref($_) ? $$_ : $m->interp->apply_escapes( $_ => 'h' ) }
- $value->( $record, $i );
+ for my $out ($value->($record, $i)) {
+ # Objects with stringification overload should be treated as
+ # regular strings.
+ $out = "$out" if overload::Method($out, q{""});
+
+ if (ref($out)) {
+ $out = $$out
+ }
+ else {
+ $out = $m->interp->apply_escapes($out => 'h');
+ }
+
+ push @out, $out if defined($out) && length($out);
+ }
+
} elsif ( defined $value && length $value ) {
# Simple value; just escape it.
Modified: rt/3.999/branches/lorzy/share/html/Elements/ColumnMap
==============================================================================
--- rt/3.999/branches/lorzy/share/html/Elements/ColumnMap (original)
+++ rt/3.999/branches/lorzy/share/html/Elements/ColumnMap Wed Feb 25 11:50:10 2009
@@ -65,12 +65,12 @@
created => {
attribute => 'Created',
title => 'Created', # loc
- value => sub { return $_[0]->created_obj->as_string }
+ value => sub { return $_[0]->created }
},
created_relative => {
attribute => 'Created',
title => 'Created', # loc
- value => sub { return $_[0]->created_obj->age_as_string }
+ value => sub { return $_[0]->created->age }
},
created_by => {
attribute => 'CreatedBy',
@@ -80,12 +80,12 @@
last_updated => {
attribute => 'last_updated',
title => 'Last Updated', # loc
- value => sub { return $_[0]->last_updated_obj->as_string }
+ value => sub { return $_[0]->last_updated }
},
last_updated_relative => {
attribute => 'last_updated',
title => 'Last Updated', # loc
- value => sub { return $_[0]->last_updated_obj->age_as_string }
+ value => sub { return $_[0]->last_updated->age }
},
last_updated_by => {
attribute => 'last_updated_by',
Modified: rt/3.999/branches/lorzy/share/html/Elements/EditCustomFieldSelect
==============================================================================
--- rt/3.999/branches/lorzy/share/html/Elements/EditCustomFieldSelect (original)
+++ rt/3.999/branches/lorzy/share/html/Elements/EditCustomFieldSelect Wed Feb 25 11:50:10 2009
@@ -49,21 +49,10 @@
%# each one limits the options of the final one a bit
%# (perhaps by tweaking the .display style?)
% my $selected = 0;
-% my @category;
% my $id = $name_prefix . $custom_field->id;
-% my $out = $m->scomp('SELF:options', %ARGS, selected_ref => \$selected, category_ref => \@category);
-% if (@category) {
-%# XXX - Hide this select from w3m?
- <select onchange="filter_cascade('<% $id %>-values', this.value)" name="<% $id %>-category">
- <option value=""<% !$selected && qq[ selected="selected"] |n %>><&|/l&>-</&></option>
-% foreach my $cat (@category) {
-% my ($depth, $name) = @$cat;
- <option value="<% $name %>"><% ' ' x $depth |n %><% $name %></option>
-% }
- </select><br />
-% }
+% my $out = $m->scomp('SELF:options', %ARGS, selected_ref => \$selected);
<select name="<%$id%>-values" id="<%$id%>-values"
-% if ( $rows && ( $multiple || !@category ) ) {
+% if ( $rows && $multiple ) ) {
size="<% $rows %>"
% }
<% $multiple && qq[multiple="multiple"] |n %> >
@@ -89,27 +78,8 @@
% $_ = lc $_ foreach @default;
% my $selected;
% my $CFVs = $custom_field->values;
-% my @levels;
% while ( my $value = $CFVs->next ) {
% my $name = $value->name;
-% my $category = $value->category || '';
-% my $level = (split /:/, $category, 2)[0] || '';
-% while (@levels) {
-% if ($levels[-1] eq $level) {
-% $level = '';
-% last;
-% } elsif (index($level, $levels[-1]) != 0) {
-% $m->out('</optgroup>');
-% pop @levels;
-% } else {
-% last;
-% }
-% }
-% if ( length $level ) {
-% push @$category_ref, [0+ at levels, $level];
- <optgroup style="padding-left: <% @levels/2 %>em" label="<% $category %>">
-% push @levels, $level;
-% }
<option value="<% $name %>"
% if ( grep $_ eq lc $name, @default )
% {
@@ -118,14 +88,10 @@
% }
><% $name %></option>
% }
-% for (@levels) {
- </optgroup>
-% }
<%ARGS>
$custom_field => undef
@default => ()
$values => undef
$selected_ref => undef
-$category_ref => undef
</%ARGS>
</%METHOD>
Modified: rt/3.999/branches/lorzy/share/html/Elements/MyReminders
==============================================================================
--- rt/3.999/branches/lorzy/share/html/Elements/MyReminders (original)
+++ rt/3.999/branches/lorzy/share/html/Elements/MyReminders Wed Feb 25 11:50:10 2009
@@ -57,7 +57,7 @@
<tr class="<%$i%2 ? 'evenline' : 'oddline'%>"><td><a href="<%RT->config->get('WebPath')%>/Ticket/Display.html?id=<%$ticket->id%>"><%$reminder->subject%></a><br />
<blockquote>
#<%$ticket->id%>: <%$ticket->subject%><br />
-<%$reminder->owner_obj->name %> <%$reminder->due_obj->unix >0 ? '• '.$reminder->due_obj->age_as_string : '' |n %>
+<%$reminder->owner_obj->name %> <%$reminder->due->epoch >0 ? '• '.$reminder->due->age : '' |n %>
</blockquote>
</td>
</tr>
Modified: rt/3.999/branches/lorzy/share/html/Elements/RT__Model__Ticket/ColumnMap
==============================================================================
--- rt/3.999/branches/lorzy/share/html/Elements/RT__Model__Ticket/ColumnMap (original)
+++ rt/3.999/branches/lorzy/share/html/Elements/RT__Model__Ticket/ColumnMap Wed Feb 25 11:50:10 2009
@@ -181,60 +181,60 @@
starts_relative => {
title => 'Starts', # loc
attribute => 'starts',
- value => sub { return $_[0]->starts_obj->age_as_string }
+ value => sub { return $_[0]->starts->age }
},
started_relative => {
title => 'Started', # loc
attribute => 'Started',
- value => sub { return $_[0]->started_obj->age_as_string }
+ value => sub { return $_[0]->started->age }
},
told_relative => {
title => 'Told', # loc
attribute => 'Told',
- value => sub { return $_[0]->told_obj->age_as_string }
+ value => sub { return $_[0]->told->age }
},
due_relative => {
title => 'Due', # loc
attribute => 'Due',
value => sub {
- my $date = $_[0]->due_obj;
+ my $date = $_[0]->due;
# Highlight the date if it was due in the past, and it's still active
- if ( $date && $date->unix > 0 && $date->diff < 0 && $_[0]->queue->status_schema->is_active($_[0]->status)) {
- return (\'<span class="overdue">' , $date->age_as_string , \'</span>');
+ if ( $date && $date->epoch > 0 && $date->diff < 0 && $_[0]->queue->status_schema->is_active($_[0]->status)) {
+ return (\'<span class="overdue">' , $date->age , \'</span>');
} else {
- return $date->age_as_string;
+ return $date->age;
}
}
},
resolved_relative => {
title => 'Resolved', # loc
attribute => 'resolved',
- value => sub { return $_[0]->resolved_obj->age_as_string }
+ value => sub { return $_[0]->resolved->age }
},
starts => {
title => 'Starts', # loc
attribute => 'starts',
- value => sub { return $_[0]->starts_obj->as_string }
+ value => sub { return $_[0]->starts }
},
started => {
title => 'Started', # loc
attribute => 'Started',
- value => sub { return $_[0]->started_obj->as_string }
+ value => sub { return $_[0]->started }
},
told => {
title => 'Told', # loc
attribute => 'Told',
- value => sub { return $_[0]->told_obj->as_string }
+ value => sub { return $_[0]->told }
},
due => {
title => 'Due', # loc
attribute => 'Due',
- value => sub { return $_[0]->due_obj->as_string }
+ value => sub { return $_[0]->due }
},
resolved => {
title => 'Resolved', # loc
attribute => 'resolved',
- value => sub { return $_[0]->resolved_obj->as_string }
+ value => sub { return $_[0]->resolved }
},
update_status => {
title => 'New messages', # loc
Modified: rt/3.999/branches/lorzy/share/html/NoAuth/iCal/dhandler
==============================================================================
--- rt/3.999/branches/lorzy/share/html/NoAuth/iCal/dhandler (original)
+++ rt/3.999/branches/lorzy/share/html/NoAuth/iCal/dhandler Wed Feb 25 11:50:10 2009
@@ -86,9 +86,9 @@
$feed->add_properties('prodid' => ["-//" . RT->config->get('rtname') ."//"]);
while (my $t = $tickets->next) {
- next unless $t->due_obj->unix > 0;
+ next unless $t->due->epoch > 0;
- my $starttime = $t->starts_obj->unix > 0 ? $t->starts_obj : $t->created_obj;
+ my $starttime = $t->starts->epoch > 0 ? $t->starts : $t->created;
my $now = RT::Date->new; $now->set_to_now;
my $start = Data::ICal::Entry::Event->new;
@@ -97,8 +97,8 @@
url => RT->config->get('WebURL') . "?q=".$t->id,
organizer => $t->owner_obj->name,
dtstamp => $now->iCal,
- created => $t->created_obj->iCal,
- 'last-modified' => $t->last_updated_obj->iCal,
+ created => $t->created->iCal,
+ 'last-modified' => $t->last_updated->iCal,
) for $start, $end;
$start->add_properties(
@@ -108,8 +108,8 @@
);
$end->add_properties(
summary => "Due: ".$t->subject,
- dtstart => $t->due_obj->iCalDate,
- dtend => $t->due_obj->iCalDate,
+ dtstart => $t->due->iCalDate,
+ dtend => $t->due->iCalDate,
);
$feed->add_entry($start);
Modified: rt/3.999/branches/lorzy/share/html/Search/Bulk.html
==============================================================================
--- rt/3.999/branches/lorzy/share/html/Search/Bulk.html (original)
+++ rt/3.999/branches/lorzy/share/html/Search/Bulk.html Wed Feb 25 11:50:10 2009
@@ -331,7 +331,6 @@
foreach my $key (@$list) {
my ( $cfid, $cf );
- next if $key =~ /CustomField-(\d+)-Category$/;
if ( $key =~ /CustomField-(\d+)-/ ) {
$cfid = $1;
$cf = RT::Model::CustomField->new();
Modified: rt/3.999/branches/lorzy/share/html/Search/Results.rdf
==============================================================================
--- rt/3.999/branches/lorzy/share/html/Search/Results.rdf (original)
+++ rt/3.999/branches/lorzy/share/html/Search/Results.rdf Wed Feb 25 11:50:10 2009
@@ -90,7 +90,7 @@
description => $Ticket->transactions->first->content,
dc => {
creator => $creator_str,
- date => $Ticket->created_obj->rfc2822,
+ date => $Ticket->created->rfc2822,
},
guid => $Ticket->queue . '_' . $Ticket->id,
);
Modified: rt/3.999/branches/lorzy/share/html/Search/Results.tsv
==============================================================================
--- rt/3.999/branches/lorzy/share/html/Search/Results.tsv (original)
+++ rt/3.999/branches/lorzy/share/html/Search/Results.tsv Wed Feb 25 11:50:10 2009
@@ -71,13 +71,13 @@
my @attrs = qw( id queue_obj->name subject status time_estimated time_worked time_left priority final_priority owner_obj->name
requestors->member_emails_as_string cc->member_emails_as_string admin_cc->member_emails_as_string
- due_obj->iso told_obj->iso created_obj->iso resolved_obj->iso last_updated_obj->iso);
+ due->iso told->iso created->iso resolved->iso last_updated->iso);
$r->content_type('application/vnd.ms-excel');
while ( my $Ticket = $Tickets->next()) {
my $row;
foreach my $attr (@attrs) {
- if ($attr =~ /(.*)->iso$/ and $Ticket->$1->unix <= 0) {
+ if ($attr =~ /(.*)->iso$/ and $Ticket->$1->epoch <= 0) {
$row->{$attr} = "";
} else {
my $method = '$Ticket->'.$attr.'()';
Modified: rt/3.999/branches/lorzy/share/html/Ticket/Elements/EditDates
==============================================================================
--- rt/3.999/branches/lorzy/share/html/Ticket/Elements/EditDates (original)
+++ rt/3.999/branches/lorzy/share/html/Ticket/Elements/EditDates Wed Feb 25 11:50:10 2009
@@ -49,11 +49,11 @@
<tr>
<td class="label"><&|/l&>starts</&>:</td>
<td class="entry"><& /Elements/SelectDate, menu_prefix => 'starts', current => 0 &>
- (<% $ticket_obj->starts_obj->as_string %>)</td>
+ (<% $ticket_obj->starts %>)</td>
</tr>
<tr>
<td class="label"><&|/l&>Started</&>:</td>
- <td class="entry"><& /Elements/SelectDate, menu_prefix => 'started', current => 0 &> (<%$ticket_obj->started_obj->as_string %>)</td>
+ <td class="entry"><& /Elements/SelectDate, menu_prefix => 'started', current => 0 &> (<%$ticket_obj->started %>)</td>
</tr>
<tr>
@@ -61,13 +61,13 @@
<&|/l&>Last Contact</&>:
</td>
<td class="entry">
- <& /Elements/SelectDate, menu_prefix => 'told', current => 0 &> (<% $ticket_obj->told_obj->as_string %>)
+ <& /Elements/SelectDate, menu_prefix => 'told', current => 0 &> (<% $ticket_obj->told %>)
</td>
</tr>
<tr>
<td class="label"><&|/l&>Due</&>:</td>
<td class="entry">
- <& /Elements/SelectDate, menu_prefix => 'due', current => 0 &> (<% $ticket_obj->due_obj->as_string %>)
+ <& /Elements/SelectDate, menu_prefix => 'due', current => 0 &> (<% $ticket_obj->due %>)
</td>
</tr>
</table>
Modified: rt/3.999/branches/lorzy/share/html/Ticket/Elements/Reminders
==============================================================================
--- rt/3.999/branches/lorzy/share/html/Ticket/Elements/Reminders (original)
+++ rt/3.999/branches/lorzy/share/html/Ticket/Elements/Reminders Wed Feb 25 11:50:10 2009
@@ -76,26 +76,26 @@
$reminder->set_owner( $request_args->{ 'Reminder-Owner-' . $reminder->id } , "Force" ) ;
}
- if ( exists( $request_args->{ 'Reminder-Due-' . $reminder->id } ) && ( $reminder->due_obj->date ne $request_args->{ 'Reminder-Due-' . $reminder->id } )) {
+ if ( exists( $request_args->{ 'Reminder-Due-' . $reminder->id } ) && ( $reminder->due->date ne $request_args->{ 'Reminder-Due-' . $reminder->id } )) {
$reminder->set_due( $request_args->{ 'Reminder-Due-' . $reminder->id } ) ;
}
}
}
if ( $request_args->{'NewReminder-Subject'} ) {
- my $due_obj = RT::Date->new();
+ my $due = RT::Date->new();
my $date = Time::ParseDate::parsedate(
$request_args->{'NewReminder-Due'},
UK => RT->config->get('DateDayBeforeMonth'),
PREFER_PAST => 0,
PREFER_FUTURE => 1
);
- $due_obj->set( value => $date, format => 'unix' );
+ $due->set( value => $date, format => 'unix' );
my ( $add_id, $msg, $txnid ) = $ticket->reminders->add(
subject => $request_args->{'NewReminder-Subject'},
owner => $request_args->{'NewReminder-Owner'},
- due => $due_obj->iso
+ due => $due->iso
);
}
@@ -157,8 +157,8 @@
/>
<input type="text" size="15" name="Reminder-Subject-<% $reminder->id %>" value="<%$reminder->subject%>" /> •
<& /Elements/SelectOwner, name => 'Reminder-Owner-'.$reminder->id, queue => $ticket->queue, default => $reminder->owner, default_value => 0 &>
- <& /Elements/SelectDate, name => 'Reminder-Due-'.$reminder->id, default => $reminder->due_obj->date &>
- (<%$reminder->due_obj->unix>0 ? $reminder->due_obj->age_as_string : '' %>)<br />
+ <& /Elements/SelectDate, name => 'Reminder-Due-'.$reminder->id, default => $reminder->due->date &>
+ (<%$reminder->due->epoch>0 ? $reminder->due->age : '' %>)<br />
</%method>
<%method ShowEntry>
<%args>
@@ -172,5 +172,5 @@
/>
<%$reminder->subject%> •
<%$reminder->owner_obj->name%>
- <%$reminder->due_obj->unix>0 ? "• ". $reminder->due_obj->age_as_string : '' |n%><br />
+ <%$reminder->due->epoch>0 ? "• ". $reminder->due->age : '' |n%><br />
</%method>
Modified: rt/3.999/branches/lorzy/share/html/Ticket/Elements/ShowAttachments
==============================================================================
--- rt/3.999/branches/lorzy/share/html/Ticket/Elements/ShowAttachments (original)
+++ rt/3.999/branches/lorzy/share/html/Ticket/Elements/ShowAttachments Wed Feb 25 11:50:10 2009
@@ -72,7 +72,7 @@
<li><font size="-2">
<a href="<%RT->config->get('WebPath')%>/Ticket/Attachment/<%$rev->transaction_id%>/<%$rev->id%>/<%$rev->filename | u%>">
-<&|/l, $rev->created_as_string, $size, $rev->creator_obj->name &>%1 (%2) by %3</&>
+<&|/l, $rev->created, $size, $rev->creator_obj->name &>%1 (%2) by %3</&>
</a>
</font></li>
% }
Modified: rt/3.999/branches/lorzy/share/html/Ticket/Elements/ShowDates
==============================================================================
--- rt/3.999/branches/lorzy/share/html/Ticket/Elements/ShowDates (original)
+++ rt/3.999/branches/lorzy/share/html/Ticket/Elements/ShowDates Wed Feb 25 11:50:10 2009
@@ -48,36 +48,36 @@
<table>
<tr>
<td class="label date Created"><&|/l&>Created</&>:</td>
- <td class="value date Created"><% $ticket->created_obj->as_string %></td>
+ <td class="value date Created"><% $ticket->created %></td>
</tr>
<tr>
- <td class="label date starts"><&|/l&>starts</&>:</td>
- <td class="value date starts"><% $ticket->starts_obj->as_string %></td>
+ <td class="label date starts"><&|/l&>Starts</&>:</td>
+ <td class="value date starts"><% $ticket->starts %></td>
</tr>
<tr>
<td class="label date started"><&|/l&>Started</&>:</td>
- <td class="value date started"><% $ticket->started_obj->as_string %></td>
+ <td class="value date started"><% $ticket->started %></td>
</tr>
<tr>
<td class="label date told"><a href="<% RT->config->get('WebPath') %>/Ticket/Display.html?id=<% $ticket->id %>&Action=SetTold"><&|/l&>Last Contact</&></a>:</td>
- <td class="value date told"><% $ticket->told_obj->as_string %></td>
+ <td class="value date told"><% $ticket->told %></td>
</tr>
<tr>
<td class="label date due"><&|/l&>Due</&>:</td>
-% my $due = $ticket->due_obj;
-% if ( $due && $due->unix > 0 && $due->diff < 0 ) {
- <td class="value date due"><span class="overdue"><% $due->as_string %></span></td>
+% my $due = $ticket->due;
+% if ( $due && $due->epoch > 0 && $due->diff < 0 ) {
+ <td class="value date due"><span class="overdue"><% $due %></span></td>
% } else {
- <td class="value date due"><% $due->as_string %></td>
+ <td class="value date due"><% $due %></td>
% }
</tr>
<tr>
<td class="label date resolved"><&|/l&>Closed</&>:</td>
- <td class="value date resolved"><% $ticket->resolved_obj->as_string %></td>
+ <td class="value date resolved"><% $ticket->resolved %></td>
</tr>
<tr>
<td class="label date updated"><&|/l&>Updated</&>:</td>
-% my $UpdatedString = $ticket->last_updated ? _("%1 by %2", $ticket->last_updated_as_string, $ticket->last_updated_by_obj->name) : _("Never");
+% my $UpdatedString = $ticket->last_updated ? _("%1 by %2", $ticket->last_updated, $ticket->last_updated_by_obj->name) : _("Never");
% if ($updated_link) {
<td class="value date updated"><a href="#lasttrans"><% $UpdatedString | h %></a></td>
% } else {
Modified: rt/3.999/branches/lorzy/share/html/Ticket/Elements/ShowTransaction
==============================================================================
--- rt/3.999/branches/lorzy/share/html/Ticket/Elements/ShowTransaction (original)
+++ rt/3.999/branches/lorzy/share/html/Ticket/Elements/ShowTransaction Wed Feb 25 11:50:10 2009
@@ -121,7 +121,7 @@
</%ONCE>
<%INIT>
-my $transdate = $transaction->created_as_string();
+my $transdate = $transaction->created;
$transdate =~ s/\s/ /g;
my ($type, $field) = ($transaction->type, $transaction->field || '');
Modified: rt/3.999/branches/lorzy/t/api/cf_combo_casacade.t
==============================================================================
--- rt/3.999/branches/lorzy/t/api/cf_combo_casacade.t (original)
+++ rt/3.999/branches/lorzy/t/api/cf_combo_casacade.t Wed Feb 25 11:50:10 2009
@@ -1,7 +1,7 @@
#!/usr/bin/perl
use warnings;
use strict;
-use RT::Test; use Test::More tests => 13;
+use RT::Test; use Test::More tests => 10;
@@ -21,7 +21,7 @@
works($cf->create(@cf_args));
-# Set some CFVs with category markers
+# Set some CFVs
my $t = new( 'RT::Model::Ticket');
my ($id,undef,$msg) = $t->create(queue => $q->id, subject => 'CF Test');
@@ -29,21 +29,18 @@
sub add_works {
works(
- $cf->add_value(name => $_[0], description => $_[0], category => $_[1])
+ $cf->add_value(name => $_[0], description => $_[0] )
);
};
-add_works('value1', '1. category A');
+add_works('value1');
add_works('value2');
-add_works('value3', '1.1. A-sub one');
-add_works('value4', '1.2. A-sub two');
-add_works('value5', '');
+add_works('value3');
+add_works('value4');
+add_works('value5');
my $cfv = $cf->values->first;
is ($cf->values->count,5, "got 5 values");
is($cfv->name, 'value1', "We got the first value");
-is($cfv->category, '1. category A');
-works($cfv->set_category('1. category AAA'));
-is($cfv->category, '1. category AAA');
1;
Modified: rt/3.999/branches/lorzy/t/api/date.t
==============================================================================
--- rt/3.999/branches/lorzy/t/api/date.t (original)
+++ rt/3.999/branches/lorzy/t/api/date.t Wed Feb 25 11:50:10 2009
@@ -90,7 +90,7 @@
{
my $date = RT::Date->new(current_user => RT->system_user);
- is($date->unix, 0, "new date returns 0 in Unix format");
+ is($date->epoch, 0, "new date returns 0 in Unix format");
is($date->get, '1970-01-01 00:00:00', "default is ISO format");
is($date->get(format =>'SomeBadFormat'),
'1970-01-01 00:00:00',
@@ -222,21 +222,21 @@
# bad format
my $date = RT::Date->new(current_user => RT->system_user);
$date->set( format => 'bad' );
- is($date->unix, undef, "bad format");
+ is($date->epoch, undef, "bad format");
{ # setting value via Unix method
my $date = RT::Date->new(current_user => RT->system_user);
- $date->unix(1);
+ $date->epoch(1);
is($date->iso, '1970-01-01 00:00:01', "correct value");
foreach (undef, 0, ''){
- $date->unix(1);
+ $date->epoch(1);
is($date->iso, '1970-01-01 00:00:01', "correct value");
$date->set(format => 'unix', value => $_);
is($date->iso, '1970-01-01 00:00:00', "Set a date to midnight 1/1/1970 GMT due to wrong call");
- is($date->unix, 0, "unix is 0 => unset");
+ is($date->epoch, 0, "unix is 0 => unset");
}
}
@@ -246,7 +246,7 @@
my $date = RT::Date->new(current_user => RT->system_user);
my $return = $date->set(format => 'ISO', value => 'weird date');
is ($return, undef, "The set failed. returned undef");
- is($date->unix, undef, "date was wrong => unix == 0");
+ is($date->epoch, undef, "date was wrong => unix == 0");
# XXX: ISO format has more feature than we suport
# http://www.cl.cam.ac.uk/~mgk25/iso-time.html
@@ -276,19 +276,19 @@
is($date->iso, $year .'-11-28 15:10:00', "DDMMhh:mm:ss");
$date->set(format => 'ISO', value => '2005-13-28 15:10:00');
- is($date->unix, 0, "wrong month value");
+ is($date->epoch, 0, "wrong month value");
$date->set(format => 'ISO', value => '2005-00-28 15:10:00');
- is($date->unix, 0, "wrong month value");
+ is($date->epoch, 0, "wrong month value");
$date->set(format => 'ISO', value => '1960-01-28 15:10:00');
- is($date->unix, 0, "too old, we don't support");
+ is($date->epoch, 0, "too old, we don't support");
}
{ # set+datemanip format(time::ParseDate)
my $date = RT::Date->new(current_user => RT->system_user);
$date->set(format => 'unknown', value => 'weird date');
- is($date->unix, 0, "date was wrong");
+ is($date->epoch, 0, "date was wrong");
RT->config->set( Timezone => 'Europe/Moscow' );
$date->set(format => 'datemanip', value => '2005-11-28 15:10:00');
@@ -307,7 +307,7 @@
{ # set+unknown format(time::ParseDate)
my $date = RT::Date->new(current_user => RT->system_user);
$date->set(format => 'unknown', value => 'weird date');
- is($date->unix, 0, "date was wrong");
+ is($date->epoch, 0, "date was wrong");
RT->config->set( Timezone => 'Europe/Moscow' );
$date->set(format => 'unknown', value => '2005-11-28 15:10:00');
@@ -379,38 +379,38 @@
my $date = RT::Date->new(current_user => RT->system_user);
my $time = time;
$date->set_to_now;
- ok($date->unix >= $time, 'close enough');
- ok($date->unix < $time+5, 'difference is less than five seconds');
+ ok($date->epoch >= $time, 'close enough');
+ ok($date->epoch < $time+5, 'difference is less than five seconds');
}
{
my $date = RT::Date->new(current_user => RT->system_user);
- $date->unix(0);
+ $date->epoch(0);
$date->add_seconds;
is($date->iso, '1970-01-01 00:00:00', "nothing changed");
$date->add_seconds(0);
is($date->iso, '1970-01-01 00:00:00', "nothing changed");
- $date->unix(0);
+ $date->epoch(0);
$date->add_seconds(5);
is($date->iso, '1970-01-01 00:00:05', "added five seconds");
$date->add_seconds(-2);
is($date->iso, '1970-01-01 00:00:03', "substracted two seconds");
- $date->unix(0);
+ $date->epoch(0);
$date->add_seconds(3661);
is($date->iso, '1970-01-01 01:01:01', "added one hour, minute and a second");
# XXX: TODO, doesn't work with Test::Warn
# TODO: {
# local $TODO = "BUG or subject to change Date handling to support unix time <= 0";
-# $date->unix(0);
+# $date->epoch(0);
# $date->add_seconds(-2);
-# ok($date->unix > 0);
+# ok($date->epoch > 0);
# }
- $date->unix(0);
+ $date->epoch(0);
$date->add_day;
is($date->iso, '1970-01-02 00:00:00', "added one day");
$date->add_days(2);
@@ -418,7 +418,7 @@
$date->add_days(-1);
is($date->iso, '1970-01-03 00:00:00', "substructed one day");
- $date->unix(0);
+ $date->epoch(0);
$date->add_days(31);
is($date->iso, '1970-02-01 00:00:00', "added one month");
}
@@ -429,18 +429,18 @@
is($date->as_string, "Not set", "as_string returns 'Not set'");
RT->config->set( DateTimeFormat => '');
- $date->unix(1);
+ $date->epoch(1);
is($date->as_string, 'Thu Jan 01 00:00:01 1970', "correct string");
is($date->as_string(date => 0), '00:00:01', "correct string");
is($date->as_string(time => 0), 'Thu Jan 01 1970', "correct string");
is($date->as_string(date => 0, time => 0), 'Thu Jan 01 00:00:01 1970', "invalid input");
RT->config->set( DateTimeFormat => 'RFC2822' );
- $date->unix(1);
+ $date->epoch(1);
is($date->as_string, 'Thu, 1 Jan 1970 00:00:01 +0000', "correct string");
RT->config->set( DateTimeFormat => { format => 'RFC2822', seconds => 0 } );
- $date->unix(1);
+ $date->epoch(1);
is($date->as_string, 'Thu, 1 Jan 1970 00:00 +0000', "correct string");
is($date->as_string(seconds => 1), 'Thu, 1 Jan 1970 00:00:01 +0000', "correct string");
}
@@ -472,7 +472,7 @@
is($date->diff_as_string(-1), '', 'no diff, wrong input');
is($date->diff_as_string('qwe'), '', 'no diff, wrong input');
- $date->unix(2);
+ $date->epoch(2);
is($date->diff_as_string(-1), '', 'no diff, wrong input');
is($date->diff_as_string(3), '1 sec ago', 'diff: 1 sec ago');
@@ -480,7 +480,7 @@
my $ndate = RT::Date->new(current_user => RT->system_user);
is($date->diff_as_string($ndate), '', 'no diff, wrong input');
- $ndate->unix(3);
+ $ndate->epoch(3);
is($date->diff_as_string($ndate), '1 sec ago', 'diff: 1 sec ago');
}
@@ -495,7 +495,7 @@
{ # AgeAsString
my $date = RT::Date->new(current_user => RT->system_user);
$date->set_to_now;
- my $diff = $date->age_as_string;
+ my $diff = $date->age;
like($diff, qr/^(0 sec|[1-5] sec ago)$/, 'close enought');
}
Modified: rt/3.999/branches/lorzy/t/api/ticket.t
==============================================================================
--- rt/3.999/branches/lorzy/t/api/ticket.t (original)
+++ rt/3.999/branches/lorzy/t/api/ticket.t Wed Feb 25 11:50:10 2009
@@ -96,7 +96,7 @@
ok ( my $id = $t->id, "Got ticket id");
like ($t->refers_to->first->target , qr/fsck.com/, "Got refers to");
like ($t->referred_to_by->first->base , qr/cpan.org/, "Got referredtoby");
-is ($t->resolved_obj->unix, 0, "It hasn't been resolved - ". $t->resolved_obj->unix);
+is ($t->resolved->epoch, 0, "It hasn't been resolved - ". $t->resolved->epoch);
my $ticket = RT::Model::Ticket->new(current_user => RT->system_user);
Modified: rt/3.999/branches/lorzy/t/api/tickets_overlay_sql.t
==============================================================================
--- rt/3.999/branches/lorzy/t/api/tickets_overlay_sql.t (original)
+++ rt/3.999/branches/lorzy/t/api/tickets_overlay_sql.t Wed Feb 25 11:50:10 2009
@@ -44,7 +44,10 @@
$Created{ $t->id }++; push @Created, $t->id;
}
-{
+TODO: {
+ if (Jifty->config->framework('Database')->{Driver} eq 'Pg') {
+ todo_skip("Can't search case insensitively on Pg with byteas", 2);
+ }
my $query = ("subject LIKE '$string' OR content LIKE '$string'");
my ($status, $msg) = $tix->from_sql($query);
ok ($status, "correct query") or diag("error: $msg");
Modified: rt/3.999/branches/lorzy/t/approval/basic.t
==============================================================================
--- rt/3.999/branches/lorzy/t/approval/basic.t (original)
+++ rt/3.999/branches/lorzy/t/approval/basic.t Wed Feb 25 11:50:10 2009
@@ -8,7 +8,7 @@
or plan skip_all => 'require Email::Abstract and Test::Email';
}
-plan tests => 38;
+plan tests => 37;
use RT;
use RT::Test;
@@ -16,7 +16,6 @@
RT->config->set( log_to_screen => 'debug' );
RT->config->set( use_transaction_batch => 1 );
-my ($baseurl, $m) = RT::Test->started_ok;
my $q = RT::Model::Queue->new( current_user => RT->system_user );
$q->load('___Approvals');
@@ -212,4 +211,4 @@
$t->load($t->id);$dependson_ceo->load($dependson_ceo->id);
is_deeply([ $t->status, $dependson_cfo->status, $dependson_ceo->status ],
[ 'rejected', 'rejected', 'deleted'], 'ticket state after cfo rejection');
-
+$SIG{INT} = sub { Carp::cluck };
Modified: rt/3.999/branches/lorzy/t/ticket/deferred_owner.t
==============================================================================
--- rt/3.999/branches/lorzy/t/ticket/deferred_owner.t (original)
+++ rt/3.999/branches/lorzy/t/ticket/deferred_owner.t Wed Feb 25 11:50:10 2009
@@ -1,4 +1,4 @@
-use Test::More tests => 18;
+use Test::More tests => 19;
use strict;
use warnings;
@@ -57,6 +57,7 @@
},
);
my $ticket = RT::Model::Ticket->new(current_user => $tester );
+ isa_ok($ticket->current_user, 'RT::CurrentUser');
# tester is owner, owner has right to modify owned tickets,
# this right is required to set somebody as Admincc
my ( $tid, $txn_id, $msg ) = $ticket->create(
Modified: rt/3.999/branches/lorzy/t/ticket/search_by_txn.t
==============================================================================
--- rt/3.999/branches/lorzy/t/ticket/search_by_txn.t (original)
+++ rt/3.999/branches/lorzy/t/ticket/search_by_txn.t Wed Feb 25 11:50:10 2009
@@ -26,11 +26,11 @@
isa_ok($txnobj, 'RT::Model::Transaction');
-ok($txnobj->created_obj->iso);
+ok($txnobj->created->iso);
my ( $sid,$smsg) = $txnobj->__set(column => 'created', value => '2005-08-05 20:00:56');
ok($sid,$smsg);
is($txnobj->created,'2005-08-05 20:00:56');
-is($txnobj->created_obj->iso,'2005-08-05 20:00:56');
+is($txnobj->created->iso,'2005-08-05 20:00:56');
$tix->from_sql(qq{Updated = "2005-08-05" AND subject = "$SUBJECT"});
is( $tix->count, 1);
More information about the Rt-commit
mailing list