%# BEGIN BPS TAGGED BLOCK {{{ %# %# COPYRIGHT: %# %# This software is Copyright (c) 1996-2009 Best Practical Solutions, LLC %# %# %# (Except where explicitly superseded by other copyright notices) %# %# %# LICENSE: %# %# This work is made available to you under the terms of Version 2 of %# the GNU General Public License. A copy of that license should have %# been provided with this software, but in any event can be snarfed %# from www.gnu.org. %# %# This work is distributed in the hope that it will be useful, but %# WITHOUT ANY WARRANTY; without even the implied warranty of %# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU %# General Public License for more details. %# %# You should have received a copy of the GNU General Public License %# along with this program; if not, write to the Free Software %# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA %# 02110-1301 or visit their web page on the internet at %# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html. %# %# %# CONTRIBUTION SUBMISSION POLICY: %# %# (The following paragraph is not intended to limit the rights granted %# to you to modify and distribute this software under the terms of %# the GNU General Public License and is only of importance to you if %# you choose to contribute your changes and enhancements to the %# community by submitting them to Best Practical Solutions, LLC.) %# %# By intentionally submitting any modifications, corrections or %# derivatives to this work, or any other work intended for use with %# Request Tracker, to Best Practical Solutions, LLC, you confirm that %# you are the copyright holder for those contributions and you grant %# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, %# royalty-free, perpetual, license to use, copy, create derivative %# works based on those contributions, and sublicense and distribute %# those contributions and any derivatives thereof. %# %# END BPS TAGGED BLOCK }}} <%args> $Ticket => undef $id => undef $ShowCompleted => 0 $Edit => 0 <%init> $Ticket = LoadTicket($id) if ($id); 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 } ) { $Ticket->Reminders->Resolve($reminder); } elsif ( $reminder->Status eq 'resolved' && !$request_args->{ 'Complete-Reminder-' . $reminder->id } ) { $Ticket->Reminders->Open($reminder); } if ( exists( $request_args->{ 'Reminder-Subject-' . $reminder->id } ) && ( $reminder->Subject ne $request_args->{ 'Reminder-Subject-' . $reminder->id } )) { $reminder->SetSubject( $request_args->{ 'Reminder-Subject-' . $reminder->id } ) ; } if ( exists( $request_args->{ 'Reminder-Owner-' . $reminder->id } ) && ( $reminder->Owner != $request_args->{ 'Reminder-Owner-' . $reminder->id } )) { $reminder->SetOwner( $request_args->{ 'Reminder-Owner-' . $reminder->id } , "Force" ) ; } if ( exists( $request_args->{ 'Reminder-Due-' . $reminder->id } ) && ( $reminder->DueObj->Date ne $request_args->{ 'Reminder-Due-' . $reminder->id } )) { $reminder->SetDue( $request_args->{ 'Reminder-Due-' . $reminder->id } ) ; } } } if ( $request_args->{'NewReminder-Subject'} ) { my $due_obj = RT::Date->new( $session{'CurrentUser'} ); my $date = Time::ParseDate::parsedate( $request_args->{'NewReminder-Due'}, UK => $RT::DateDayBeforeMonth, PREFER_PAST => 0, PREFER_FUTURE => 1 ); $due_obj->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 ); } # We've made changes, let's reload our search $reminder_collection = $Ticket->Reminders->Collection;
% while (my $reminder = $reminder_collection->Next) { % if ($reminder->Status eq 'resolved' && !$ShowCompleted) { % } elsif ($Edit) { <& SELF:EditEntry, Reminder => $reminder, Ticket => $Ticket &> % } else { <& SELF:ShowEntry, Reminder => $reminder, Ticket => $Ticket &> % } % }

<&|/l&>New reminder:

<& SELF:NewReminder, Ticket => $Ticket &> <%method NewReminder> <%args> $Ticket
<& /Elements/SelectOwner, Name => 'NewReminder-Owner', QueueObj => $Ticket->QueueObj, DefaultValue => 0 &>
<& /Elements/SelectDate, Name => "NewReminder-Due", Default => "" &>
<%method EditEntry> <%args> $Reminder $Ticket Status eq 'resolved' ? 'CHECKED' : '' %> /> • <& /Elements/SelectOwner, Name => 'Reminder-Owner-'.$Reminder->id, Queue => $Ticket->QueueObj, Default => $Reminder->Owner, DefaultValue => 0 &> <& /Elements/SelectDate, Name => 'Reminder-Due-'.$Reminder->id, Default => $Reminder->DueObj->Date &> (<%$Reminder->DueObj->Unix>0 ? $Reminder->DueObj->AgeAsString : '' %>)
<%method ShowEntry> <%args> $Reminder $Ticket Status eq 'resolved' ? 'CHECKED' : '' %> /> <%$Reminder->Subject%> • <%$Reminder->OwnerObj->Name%> <%$Reminder->DueObj->Unix>0 ? "• ". $Reminder->DueObj->AgeAsString : '' |n%>