[Rt-commit] r20049 - rtir/2.5/trunk/html/RTIR/Elements
sunnavy at bestpractical.com
sunnavy at bestpractical.com
Thu Jun 25 03:54:51 EDT 2009
Author: sunnavy
Date: Thu Jun 25 03:54:50 2009
New Revision: 20049
Added:
rtir/2.5/trunk/html/RTIR/Elements/EditCustomFields
Log:
add EditCustomFields to find defaults
Added: rtir/2.5/trunk/html/RTIR/Elements/EditCustomFields
==============================================================================
--- (empty file)
+++ rtir/2.5/trunk/html/RTIR/Elements/EditCustomFields Thu Jun 25 03:54:50 2009
@@ -0,0 +1,61 @@
+%# BEGIN LICENSE BLOCK
+%#
+%# Copyright (c) 1996-2009 Jesse Vincent <jesse at bestpractical.com>
+%#
+%# (Except where explictly superceded by other copyright notices)
+%#
+%# 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.
+%#
+%#
+%# Unless otherwise specified, all modifications, corrections or
+%# extensions to this work which alter its source code become the
+%# property of Best Practical Solutions, LLC when submitted for
+%# inclusion in the work.
+%#
+%#
+%# END LICENSE BLOCK
+<& /Ticket/Elements/EditCustomFields,
+ TicketObj => $TicketObj,
+ QueueObj => $QueueObj,
+ %ARGS,
+&>
+
+<%INIT>
+unless ( $TicketObj && $TicketObj->Id ) {
+ # no ticket, we need to find defaults of cfs
+ $QueueObj ||= $TicketObj->QueueObj();
+ my $CustomFields = $QueueObj->TicketCustomFields();
+ my %Defaults = RT->Config->Get('RTIR_CustomFieldsDefaults');
+ while ( my $CustomField = $CustomFields->Next ) {
+ if ( $CustomField->Name eq 'SLA' ) {
+ $ARGS{"CustomField-".$CustomField->Id} = RT::IR::DefaultSLA();
+ }
+ else {
+ my $Name = $CustomField->Name;
+ if ( $ARGS{"$Name-Value"} ) {
+ $ARGS{"CustomField-".$CustomField->Id} = $ARGS{"$Name-Value"};
+ }
+ elsif ( $Defaults{$Name} && !ref $Defaults{$Name} ) {
+# if $Defaults{$Name} is ref, it should be treated carefully, like the 'SLA'
+# above
+
+ $ARGS{"CustomField-".$CustomField->Id} = $Defaults{$Name};
+#TODO special treatment of CF IP
+ }
+ }
+ }
+}
+
+</%INIT>
+<%ARGS>
+$TicketObj => undef
+$QueueObj => undef
+</%ARGS>
More information about the Rt-commit
mailing list