[Rt-commit] r3267 - in rt/branches/CHALDEA-EXPERIMENTAL: .
html/Ticket/Elements lib/RT
jesse at bestpractical.com
jesse at bestpractical.com
Thu Jun 30 01:30:21 EDT 2005
Author: jesse
Date: Thu Jun 30 01:30:21 2005
New Revision: 3267
Modified:
rt/branches/CHALDEA-EXPERIMENTAL/ (props changed)
rt/branches/CHALDEA-EXPERIMENTAL/html/Ticket/Elements/Reminders
rt/branches/CHALDEA-EXPERIMENTAL/lib/RT/Reminders.pm
rt/branches/CHALDEA-EXPERIMENTAL/lib/RT/SearchBuilder.pm
rt/branches/CHALDEA-EXPERIMENTAL/lib/RT/Transaction_Overlay.pm
Log:
r22022 at hualien: jesse | 2005-06-30 01:29:44 -0400
* Reminders fixes
Modified: rt/branches/CHALDEA-EXPERIMENTAL/html/Ticket/Elements/Reminders
==============================================================================
--- rt/branches/CHALDEA-EXPERIMENTAL/html/Ticket/Elements/Reminders (original)
+++ rt/branches/CHALDEA-EXPERIMENTAL/html/Ticket/Elements/Reminders Thu Jun 30 01:30:21 2005
@@ -9,30 +9,20 @@
my $request_args = $m->request_args();
-
my $reminder_collection = $Ticket->Reminders->Collection;
-if ($request_args->{'update-reminders'}) {
- while (my $reminder = $reminder_collection->Next) {
- if ($reminder->Status ne 'resolved'
- && $request_args->{'Complete-Reminder-'.$reminder->id}) {
- $reminder->SetStatus('resolved');
- } elsif ($reminder->Status eq 'resolved' && ! $request_args->{'Complete-Reminder-'.$reminder->id}) {
- $reminder->SetStatus('open');
- }
- }
-}
+if ( $request_args->{'update-reminders'} ) {
+ while ( my $reminder = $reminder_collection->Next ) {
+ if ( $reminder->Status ne 'resolved' && $request_args->{ 'Complete-Reminder-' . $reminder->id } ) {
-
-foreach my $arg (keys %$request_args) {
- if ($arg =~ /Complete-Reminder-(\d+)$/) {
- my $reminder = LoadTicket($1);
+ $Ticket->Reminders->Resolve($reminder);
+ }
+ elsif ( $reminder->Status eq 'resolved' && !$request_args->{ 'Complete-Reminder-' . $reminder->id } ) {
+ $Ticket->Reminders->Open($reminder);
+ }
}
-
-
}
-
if ( $request_args->{'NewReminder-Subject'} ) {
my $due_obj = RT::Date->new( $session{'CurrentUser'} );
my $date = Time::ParseDate::parsedate(
@@ -42,7 +32,7 @@
PREFER_FUTURE => 1
);
$due_obj->Set( Value => $date, Format => 'unix' );
- my ( $id, $msg, $txnid ) = $Ticket->Reminders->Add(
+ my ( $add_id, $msg, $txnid ) = $Ticket->Reminders->Add(
Subject => $request_args->{'NewReminder-Subject'},
Owner => $request_args->{'NewReminder-Owner'},
@@ -52,27 +42,25 @@
# We've made changes, let's reload our search
-$reminder_collection = $Ticket->Reminders->Collection;
+$reminder_collection = $Ticket->Reminders->Collection;
</%init>
-<input type="hidden" name="id" value="<%$Ticket->id%>" />
+<input type="hidden" name="id" value="<% $Ticket->id %>" />
<input type="hidden" name="update-reminders" value="1" />
% while (my $reminder = $reminder_collection->Next) {
-% if ($reminder->Status eq 'resolved' && !$ShowCompleted) {
+% if ($reminder->Status eq 'resolved' && !$ShowCompleted) {
<input type="hidden" name="Complete-Reminder-<% $reminder->id %>" value="1" />
-% } else {
+% } else {
<& SELF:ShowEntry, Reminder => $reminder, Ticket => $Ticket &>
-% }
+% }
% }
<br />
<br />
<&|/l&>New reminder:</&><br />
<& SELF:NewReminder, Ticket => $Ticket &>
-
<%method NewReminder>
<%args>
$Ticket
</%args>
-
<div class="horizontal">
<label class="horizontal" for="NewReminder-Subject" ><&|/l&>Subject</&>:</label>
<input type="text" size="15" name="NewReminder-Subject">
@@ -82,11 +70,10 @@
<& /Elements/SelectOwner, Name => 'NewReminder-Owner', Queue => $Ticket->QueueObj &>
</div>
<div class="horizontal">
-<label class="horizontal" for="NewReminder-Due" ><&|/l&>Due</l> <&|/l&>(yyyy/mm/dd)</&>:</label>
+<label class="horizontal" for="NewReminder-Due" ><&|/l&>Due</&> <&|/l&>(yyyy/mm/dd)</&>:</label>
<input type="text" size="10" name="NewReminder-Due">
</div>
</%method>
-
<%method ShowEntry>
<%args>
$Reminder
Modified: rt/branches/CHALDEA-EXPERIMENTAL/lib/RT/Reminders.pm
==============================================================================
--- rt/branches/CHALDEA-EXPERIMENTAL/lib/RT/Reminders.pm (original)
+++ rt/branches/CHALDEA-EXPERIMENTAL/lib/RT/Reminders.pm Thu Jun 30 01:30:21 2005
@@ -78,7 +78,32 @@
Queue => $self->TicketObj->Queue,
);
+ $self->Ticket->_NewTransaction(Type => 'AddReminder',
+ Field => 'RT::Ticket',
+ NewValue => $reminder->id);
+
+}
+
+
+sub Open {
+ my $self = shift;
+ my $reminder = shift;
+
+ $reminder->SetStatus('open');
+ $self->Ticket->_NewTransaction(Type => 'OpenReminder',
+ Field => 'RT::Ticket',
+ NewValue => $reminder->id);
+}
+
+
+sub Resolve {
+ my $self = shift;
+ my $reminder = shift;
+ $reminder->SetStatus('resolved');
+ $self->Ticket->_NewTransaction(Type => 'ResolveReminder',
+ Field => 'RT::Ticket',
+ NewValue => $reminder->id);
}
eval "require RT::Reminders_Vendor";
Modified: rt/branches/CHALDEA-EXPERIMENTAL/lib/RT/SearchBuilder.pm
==============================================================================
--- rt/branches/CHALDEA-EXPERIMENTAL/lib/RT/SearchBuilder.pm (original)
+++ rt/branches/CHALDEA-EXPERIMENTAL/lib/RT/SearchBuilder.pm Thu Jun 30 01:30:21 2005
@@ -68,7 +68,7 @@
package RT::SearchBuilder;
use RT::Base;
-use DBIx::SearchBuilder 1.27;
+use DBIx::SearchBuilder qw/1.27/;
use strict;
use vars qw(@ISA);
Modified: rt/branches/CHALDEA-EXPERIMENTAL/lib/RT/Transaction_Overlay.pm
==============================================================================
--- rt/branches/CHALDEA-EXPERIMENTAL/lib/RT/Transaction_Overlay.pm (original)
+++ rt/branches/CHALDEA-EXPERIMENTAL/lib/RT/Transaction_Overlay.pm Thu Jun 30 01:30:21 2005
@@ -792,6 +792,27 @@
my $self = shift;
return $self->loc("Transaction [_1] purged", $self->Data);
},
+ AddReminder => sub {
+ my $self = shift;
+ my $ticket = RT::Ticket->new($self->CurrentUser);
+ $ticket->Load($self->NewValue);
+ return $self->loc("Reminder '[_1]' added", $ticket->Subject);
+ },
+ OpenReminder => sub {
+ my $self = shift;
+ my $ticket = RT::Ticket->new($self->CurrentUser);
+ $ticket->Load($self->NewValue);
+ return $self->loc("Reminder '[_1]' reopened", $ticket->Subject);
+
+ },
+ ResolveReminder => sub {
+ my $self = shift;
+ my $ticket = RT::Ticket->new($self->CurrentUser);
+ $ticket->Load($self->NewValue);
+ return $self->loc("Reminder '[_1]' completed", $ticket->Subject);
+
+
+ }
);
# }}}
More information about the Rt-commit
mailing list