1 %# BEGIN BPS TAGGED BLOCK {{{
5 %# This software is Copyright (c) 1996-2015 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 }}}
57 $Ticket = LoadTicket($id) if ($id);
58 my $resolve_status = $Ticket->LifecycleObj->ReminderStatusOnResolve;
60 my $count_reminders = RT::Reminders->new($session{'CurrentUser'});
61 $count_reminders->Ticket($Ticket->id);
62 my $count_tickets = $count_reminders->Collection;
63 if (!$ShowCompleted) {
64 # XXX: don't break encapsulation if we can avoid it
65 $count_tickets->FromSQL(q{Type = "reminder" AND RefersTo = "} . $Ticket->id . qq{" AND Status != "$resolve_status" });
67 my $has_reminders = $count_tickets->Count;
69 # We've made changes, let's reload our search
70 my $reminder_collection = $count_reminders->Collection;
72 <input type="hidden" class="hidden" name="id" value="<% $Ticket->id %>" />
73 <input type="hidden" class="hidden" name="update-reminders" value="1" />
75 % if ($has_reminders) {
76 <table border="0" cellpadding="1" cellspacing="0" class="collection-as-table"<% $Edit ? ' style="width: auto;"' : '' |n %>>
79 <th class="collection-as-table" colspan="5"><&|/l&>Reminders</&></th>
81 <th class="collection-as-table"></th>
82 <th class="collection-as-table"><&|/l&>Reminder</&></th>
83 <th class="collection-as-table"><&|/l&>Due</&></th>
84 <th class="collection-as-table"><&|/l&>Owner</&></th>
88 % while ( my $reminder = $reminder_collection->Next ) {
90 % if ( $reminder->Status eq $resolve_status && !$ShowCompleted ) {
91 <tr class="hidden"><td><input type="hidden" class="hidden" name="Complete-Reminder-<% $reminder->id %>" value="1" /></td></tr>
95 % $editable = 1 if !$editable && $reminder->CurrentUserHasRight( 'ModifyTicket' );
97 <& SELF:EditEntry, Reminder => $reminder, Ticket => $Ticket, Index => $i &>
99 <& SELF:ShowEntry, Reminder => $reminder, Ticket => $Ticket, Index => $i &>
105 <i><&|/l&>(Check box to complete)</&></i><br /><br />
109 %# we must always include resolved reminders due to the browser
110 %# checkbox-with-false-value issue
111 % while ( my $reminder = $reminder_collection->Next ) {
112 % if ( $reminder->Status eq $resolve_status && !$ShowCompleted ) {
113 <input type="hidden" class="hidden" name="Complete-Reminder-<% $reminder->id %>" value="1" />
118 % if (lc $Ticket->Status ne "deleted" and $Ticket->QueueObj->CurrentUserHasRight('CreateTicket') and $Ticket->CurrentUserHasRight('ModifyTicket') ) {
119 <&|/l&>New reminder:</&>
120 <& SELF:NewReminder, Ticket => $Ticket &>
124 % if ( $editable && $ShowSave ) {
125 <div align="right"><input type="submit" class="button" value="<&|/l&>Save</&>" /></div>
127 <%method NewReminder>
133 <td class="label"><&|/l&>Subject</&>:</td>
134 <td class="entry" colspan="3"><input type="text" size="50" name="NewReminder-Subject" id="NewReminder-Subject" /></td>
137 <td class="label"><&|/l&>Owner</&>:</td>
138 <td class="entry"><& /Elements/SelectOwner, Name => 'NewReminder-Owner', QueueObj => $Ticket->QueueObj, Default=>$session{'CurrentUser'}->id, DefaultValue => 0 &></td>
141 <td class="label"><&|/l&>Due</&>:</td>
142 <td class="entry"><& /Elements/SelectDate, Name => "NewReminder-Due", Default => "" &></td>
152 <tr class="<% $Index%2 ? 'oddline' : 'evenline' %>" id="reminder-<% $Reminder->id %>">
154 % unless ( $Reminder->CurrentUserHasRight('ModifyTicket') ) {
155 <input name="Complete-Reminder-<% $Reminder->id %>" type="hidden"
156 value=<% $Reminder->Status eq $Reminder->LifecycleObj->ReminderStatusOnResolve ? 1 : 0 %> />
159 <input type="checkbox" value="1" name="Complete-Reminder-<% $Reminder->id %>" <% $Reminder->Status eq $Reminder->LifecycleObj->ReminderStatusOnResolve ? 'checked="checked"' : '' |n %>
160 % unless ( $Reminder->CurrentUserHasRight('ModifyTicket') ) {
164 <td class="label"><&|/l&>Subject</&>:</td>
165 <td class="entry" colspan="3">
166 <input type="text" size="50" name="Reminder-Subject-<% $Reminder->id %>" value="<% $Reminder->Subject %>"
167 % unless ( $Reminder->CurrentUserHasRight('ModifyTicket') ) {
173 <tr class="<% $Index%2 ? 'oddline' : 'evenline' %>">
174 <td class="entry"> </td>
175 <td class="label"><&|/l&>Owner</&>:</td>
176 <td class="entry"><& /Elements/SelectOwner, Name => 'Reminder-Owner-'.$Reminder->id, QueueObj => $Ticket->QueueObj, Default => $Reminder->Owner, DefaultValue => 0 &></td>
177 <td class="label"><&|/l&>Due</&>:</td>
179 % if ( $Reminder->CurrentUserHasRight('ModifyTicket') ) {
180 <& /Elements/SelectDate, Name => 'Reminder-Due-'.$Reminder->id &>
182 (<% $Reminder->DueObj->AsString %>)
192 % my $dueobj = $Reminder->DueObj;
193 % my $overdue = $dueobj->IsSet && $dueobj->Diff < 0 ? 1 : 0;
194 <tr class="<% $Index%2 ? 'oddline' : 'evenline' %>" id="reminder-<% $Reminder->id %>">
196 <td class="collection-as-table">
197 % unless ( $Reminder->CurrentUserHasRight('ModifyTicket') ) {
198 <input name="Complete-Reminder-<% $Reminder->id %>" type="hidden"
199 value=<% $Reminder->Status eq $Reminder->LifecycleObj->ReminderStatusOnResolve ? 1 : 0 %> />
201 <input type="checkbox" value="1" id="Complete-Reminder-<% $Reminder->id %>" name="Complete-Reminder-<% $Reminder->id %>" <% $Reminder->Status eq $Reminder->LifecycleObj->ReminderStatusOnResolve ? 'checked="checked"' : '' |n %>
202 % unless ( $Reminder->CurrentUserHasRight('ModifyTicket') ) {
206 <td class="collection-as-table"><label for="Complete-Reminder-<% $Reminder->id %>"><% $Reminder->Subject %></label></td>
207 <td class="collection-as-table"><% $overdue ? '<span class="overdue">' : '' |n %><% $dueobj->AgeAsString || loc('Not set') %><% $overdue ? '</span>' : '' |n %></td>
208 <td class="collection-as-table"><& /Elements/ShowUser, User => $Reminder->OwnerObj &></td>