%# BEGIN BPS TAGGED BLOCK {{{ %# %# COPYRIGHT: %# %# This software is Copyright (c) 1996-2013 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 $ShowSave => 1 <%init> $Ticket = LoadTicket($id) if ($id); my $resolve_status = $Ticket->LifecycleObj->ReminderStatusOnResolve; my $count_reminders = RT::Reminders->new($session{'CurrentUser'}); $count_reminders->Ticket($Ticket->id); my $count_tickets = $count_reminders->Collection; if (!$ShowCompleted) { # XXX: don't break encapsulation if we can avoid it $count_tickets->FromSQL(q{Type = "reminder" AND RefersTo = "} . $Ticket->id . qq{" AND Status != "$resolve_status" }); } my $has_reminders = $count_tickets->Count; # We've made changes, let's reload our search my $reminder_collection = $count_reminders->Collection; % my $editable = 0; % if ($has_reminders) { > % if ( $Edit ) { % } else { % } % my $i = 0; % while ( my $reminder = $reminder_collection->Next ) { % $i++; % if ( $reminder->Status eq $resolve_status && !$ShowCompleted ) { % $i++; % } % else { % $editable = 1 if !$editable && $reminder->CurrentUserHasRight( 'ModifyTicket' ); % if ($Edit) { <& SELF:EditEntry, Reminder => $reminder, Ticket => $Ticket, Index => $i &> % } else { <& SELF:ShowEntry, Reminder => $reminder, Ticket => $Ticket, Index => $i &> % } % } % }
<&|/l&>Reminders <&|/l&>Reminder <&|/l&>Due <&|/l&>Owner
% if ( $editable ) { <&|/l&>(Check box to complete)

% } % } else { %# we must always include resolved reminders due to the browser %# checkbox-with-false-value issue % while ( my $reminder = $reminder_collection->Next ) { % if ( $reminder->Status eq $resolve_status && !$ShowCompleted ) { % } % } % } % if (lc $Ticket->Status ne "deleted" and $Ticket->QueueObj->CurrentUserHasRight('CreateTicket') and $Ticket->CurrentUserHasRight('ModifyTicket') ) { <&|/l&>New reminder: <& SELF:NewReminder, Ticket => $Ticket &> % $editable = 1; % } % if ( $editable && $ShowSave ) {
% } <%method NewReminder> <%args> $Ticket
<&|/l&>Subject:
<&|/l&>Owner: <& /Elements/SelectOwner, Name => 'NewReminder-Owner', QueueObj => $Ticket->QueueObj, Default=>$session{'CurrentUser'}->id, DefaultValue => 0 &>
<&|/l&>Due: <& /Elements/SelectDate, Name => "NewReminder-Due", Default => "" &>
<%method EditEntry> <%args> $Reminder $Ticket $Index % unless ( $Reminder->CurrentUserHasRight('ModifyTicket') ) { Status eq $Reminder->LifecycleObj->ReminderStatusOnResolve ? 1 : 0 %> /> % } Status eq $Reminder->LifecycleObj->ReminderStatusOnResolve ? 'checked="checked"' : '' |n %> % unless ( $Reminder->CurrentUserHasRight('ModifyTicket') ) { disabled="disabled" % } /> <&|/l&>Subject: CurrentUserHasRight('ModifyTicket') ) { readonly="readonly" % } />   <&|/l&>Owner: <& /Elements/SelectOwner, Name => 'Reminder-Owner-'.$Reminder->id, QueueObj => $Ticket->QueueObj, Default => $Reminder->Owner, DefaultValue => 0 &> <&|/l&>Due: % if ( $Reminder->CurrentUserHasRight('ModifyTicket') ) { <& /Elements/SelectDate, Name => 'Reminder-Due-'.$Reminder->id &> % } (<% $Reminder->DueObj->AsString %>) <%method ShowEntry> <%args> $Reminder $Ticket $Index % my $dueobj = $Reminder->DueObj; % my $overdue = $dueobj->Unix > 0 && $dueobj->Diff < 0 ? 1 : 0; % unless ( $Reminder->CurrentUserHasRight('ModifyTicket') ) { Status eq $Reminder->LifecycleObj->ReminderStatusOnResolve ? 1 : 0 %> /> % } Status eq $Reminder->LifecycleObj->ReminderStatusOnResolve ? 'checked="checked"' : '' |n %> % unless ( $Reminder->CurrentUserHasRight('ModifyTicket') ) { disabled="disabled" % } /> <% $overdue ? '' : '' |n %><% $dueobj->AgeAsString || loc('Not set') %><% $overdue ? '' : '' |n %> <& /Elements/ShowUser, User => $Reminder->OwnerObj &>