1 %# BEGIN BPS TAGGED BLOCK {{{
5 %# This software is Copyright (c) 1996-2013 Best Practical Solutions, LLC
6 %# <sales@bestpractical.com>
8 %# (Except where explicitly superseded by other copyright notices)
13 %# This work is made available to you under the terms of Version 2 of
14 %# the GNU General Public License. A copy of that license should have
15 %# been provided with this software, but in any event can be snarfed
18 %# This work is distributed in the hope that it will be useful, but
19 %# WITHOUT ANY WARRANTY; without even the implied warranty of
20 %# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 %# General Public License for more details.
23 %# You should have received a copy of the GNU General Public License
24 %# along with this program; if not, write to the Free Software
25 %# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
26 %# 02110-1301 or visit their web page on the internet at
27 %# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
30 %# CONTRIBUTION SUBMISSION POLICY:
32 %# (The following paragraph is not intended to limit the rights granted
33 %# to you to modify and distribute this software under the terms of
34 %# the GNU General Public License and is only of importance to you if
35 %# you choose to contribute your changes and enhancements to the
36 %# community by submitting them to Best Practical Solutions, LLC.)
38 %# By intentionally submitting any modifications, corrections or
39 %# derivatives to this work, or any other work intended for use with
40 %# Request Tracker, to Best Practical Solutions, LLC, you confirm that
41 %# you are the copyright holder for those contributions and you grant
42 %# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable,
43 %# royalty-free, perpetual, license to use, copy, create derivative
44 %# works based on those contributions, and sublicense and distribute
45 %# those contributions and any derivatives thereof.
47 %# END BPS TAGGED BLOCK }}}
56 $Ticket = LoadTicket($id) if ($id);
58 my $request_args = $m->request_args();
60 my $reminder_collection = $Ticket->Reminders->Collection;
62 if ( $request_args->{'update-reminders'} ) {
63 while ( my $reminder = $reminder_collection->Next ) {
64 if ( $reminder->Status ne 'resolved' && $request_args->{ 'Complete-Reminder-' . $reminder->id } ) {
65 $Ticket->Reminders->Resolve($reminder);
67 elsif ( $reminder->Status eq 'resolved' && !$request_args->{ 'Complete-Reminder-' . $reminder->id } ) {
68 $Ticket->Reminders->Open($reminder);
71 if ( exists( $request_args->{ 'Reminder-Subject-' . $reminder->id } ) && ( $reminder->Subject ne $request_args->{ 'Reminder-Subject-' . $reminder->id } )) {
72 $reminder->SetSubject( $request_args->{ 'Reminder-Subject-' . $reminder->id } ) ;
75 if ( exists( $request_args->{ 'Reminder-Owner-' . $reminder->id } ) && ( $reminder->Owner != $request_args->{ 'Reminder-Owner-' . $reminder->id } )) {
76 $reminder->SetOwner( $request_args->{ 'Reminder-Owner-' . $reminder->id } , "Force" ) ;
79 if ( exists( $request_args->{ 'Reminder-Due-' . $reminder->id } ) && ( $reminder->DueObj->Date ne $request_args->{ 'Reminder-Due-' . $reminder->id } )) {
80 $reminder->SetDue( $request_args->{ 'Reminder-Due-' . $reminder->id } ) ;
85 if ( $request_args->{'NewReminder-Subject'} ) {
86 my $due_obj = RT::Date->new( $session{'CurrentUser'} );
87 my $date = Time::ParseDate::parsedate(
88 $request_args->{'NewReminder-Due'},
89 UK => RT->Config->Get('DateDayBeforeMonth'),
93 $due_obj->Set( Value => $date, Format => 'unix' );
94 my ( $add_id, $msg, $txnid ) = $Ticket->Reminders->Add(
96 Subject => $request_args->{'NewReminder-Subject'},
97 Owner => $request_args->{'NewReminder-Owner'},
102 # We've made changes, let's reload our search
104 $reminder_collection = $Ticket->Reminders->Collection;
106 <input type="hidden" class="hidden" name="id" value="<% $Ticket->id %>" />
107 <input type="hidden" class="hidden" name="update-reminders" value="1" />
109 % while (my $reminder = $reminder_collection->Next) {
110 % if ($reminder->Status eq 'resolved' && !$ShowCompleted) {
111 <input type="hidden" class="hidden" name="Complete-Reminder-<% $reminder->id %>" value="1" />
113 <& SELF:EditEntry, Reminder => $reminder, Ticket => $Ticket &>
115 <& SELF:ShowEntry, Reminder => $reminder, Ticket => $Ticket &>
118 % if ($reminder_collection->Count) {
119 <i><&|/l&>(Check box to delete)</&></i><br /><br />
123 <&|/l&>New reminder:</&>
124 <& SELF:NewReminder, Ticket => $Ticket &>
126 <%method NewReminder>
131 <tr class="input-row">
132 <td class="label"><label class="horizontal" for="NewReminder-Subject" ><&|/l&>Subject</&>:</label></td>
134 <input type="text" size="15" name="NewReminder-Subject" id="NewReminder-Subject" />
137 <tr class="input-row">
139 <label class="horizontal" for="NewReminder-Owner" ><&|/l&>Owner</&>:</label></td><td class="value">
140 <& /Elements/SelectOwner, Name => 'NewReminder-Owner', QueueObj => $Ticket->QueueObj, Default=>$session{'CurrentUser'}->id, DefaultValue => 0 &>
143 <tr class="input-row">
144 <td class="label"><label class="horizontal" for="NewReminder-Due" ><&|/l&>Due</&>:</label></td>
146 <& /Elements/SelectDate, Name => "NewReminder-Due", Default => "" &>
158 name="Complete-Reminder-<%$Reminder->id%>"
159 <% $Reminder->Status eq 'resolved' ? 'checked="checked"' : '' %>
161 <input type="text" size="15" name="Reminder-Subject-<% $Reminder->id %>" value="<%$Reminder->Subject%>" /> •
162 <& /Elements/SelectOwner, Name => 'Reminder-Owner-'.$Reminder->id, Queue => $Ticket->QueueObj, Default => $Reminder->Owner, DefaultValue => 0 &>
163 <& /Elements/SelectDate, Name => 'Reminder-Due-'.$Reminder->id, Default => $Reminder->DueObj->Date &>
164 (<%$Reminder->DueObj->Unix>0 ? $Reminder->DueObj->AgeAsString : '' %>)<br />
173 name="Complete-Reminder-<%$Reminder->id%>"
174 <% $Reminder->Status eq 'resolved' ? 'checked="checked"' : '' %>
176 <%$Reminder->Subject%> •
177 <& /Elements/ShowUser, User => $Reminder->OwnerObj &>
178 <%$Reminder->DueObj->Unix>0 ? "• ". $Reminder->DueObj->AgeAsString : '' |n%><br />