]>
Commit | Line | Data |
---|---|---|
84fb5b46 MKG |
1 | %# BEGIN BPS TAGGED BLOCK {{{ |
2 | %# | |
3 | %# COPYRIGHT: | |
4 | %# | |
403d7b0b | 5 | %# This software is Copyright (c) 1996-2013 Best Practical Solutions, LLC |
84fb5b46 MKG |
6 | %# <sales@bestpractical.com> |
7 | %# | |
8 | %# (Except where explicitly superseded by other copyright notices) | |
9 | %# | |
10 | %# | |
11 | %# LICENSE: | |
12 | %# | |
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 | |
16 | %# from www.gnu.org. | |
17 | %# | |
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. | |
22 | %# | |
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. | |
28 | %# | |
29 | %# | |
30 | %# CONTRIBUTION SUBMISSION POLICY: | |
31 | %# | |
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.) | |
37 | %# | |
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. | |
46 | %# | |
47 | %# END BPS TAGGED BLOCK }}} | |
48 | <& Elements/Header, Title => loc("Create a ticket") &> | |
49 | ||
50 | <& /Elements/ListActions, actions => \@results &> | |
51 | <form action="Create.html" method="post" enctype="multipart/form-data"> | |
52 | <input type="hidden" class="hidden" name="id" value="new" /> | |
53 | ||
54 | <table width="100%"> | |
55 | <tr> | |
56 | <td class="label"> | |
57 | <&|/l&>Queue</&>: | |
58 | </td> | |
59 | <td class="value"> | |
60 | <input type="hidden" class="hidden" name="Queue" value="<%$queue_obj->id || ''%>" /> | |
61 | <strong><%$queue_obj->Name || ''%></strong> <% $queue_obj->Description ? '('.$queue_obj->Description.')' : '' %> | |
62 | </td> | |
63 | </tr> | |
64 | <% $m->callback( CallbackName => 'AfterQueue', %ARGS, QueueObj => $queue_obj ) %> | |
65 | <tr> | |
66 | <td class="label"> | |
67 | <&|/l&>Requestors</&>: | |
68 | </td> | |
69 | <td class="value"> | |
70 | <& /Elements/EmailInput, Name => 'Requestors', Size => '20', Default => $ARGS{Requestors} || $session{CurrentUser}->EmailAddress &> | |
71 | </td> | |
72 | </tr> | |
73 | <tr> | |
74 | <td class="label"> | |
75 | <&|/l&>Cc</&>: | |
76 | </td> | |
77 | <td class="value"> | |
78 | <& /Elements/EmailInput, Name => 'Cc', Size => '20', Default => $ARGS{Cc} || '' &> | |
79 | </td> | |
80 | </tr> | |
81 | <tr> | |
82 | <td class="label"> | |
83 | <&|/l&>Subject</&>: | |
84 | </td> | |
85 | <td class="value"> | |
86 | <input name="Subject" size="60" maxsize="200" value="<%$ARGS{Subject} || ''%>" /> | |
87 | </td> | |
88 | </tr> | |
89 | <tr> | |
90 | <td colspan="2"> | |
91 | <& /Ticket/Elements/EditCustomFields, %ARGS, QueueObj => $queue_obj &> | |
92 | </td> | |
93 | </tr> | |
5b0d0914 | 94 | <& /Ticket/Elements/AddAttachments, %ARGS, QueueObj => $queue_obj &> |
84fb5b46 MKG |
95 | </table> |
96 | <table width="100%"> | |
97 | <tr> | |
98 | <td colspan="2"> | |
99 | <&|/l&>Describe the issue below</&>:<br /> | |
100 | <& /Elements/MessageBox, Default => $ARGS{Content} || '' &> | |
101 | </td> | |
102 | </tr> | |
103 | </table> | |
104 | <& /Elements/Submit, Label => loc("Create ticket")&> | |
105 | ||
106 | ||
107 | </form> | |
108 | <%args> | |
109 | $Queue => undef | |
110 | </%args> | |
111 | <%init> | |
112 | my @results; | |
113 | my $queue_obj = RT::Queue->new($session{'CurrentUser'}); | |
114 | $queue_obj->Load($Queue); | |
115 | my $CFs = $queue_obj->TicketCustomFields(); | |
116 | my $ValidCFs = $m->comp( | |
117 | '/Elements/ValidateCustomFields', | |
118 | CustomFields => $CFs, | |
119 | ARGSRef => \%ARGS | |
120 | ); | |
121 | ||
5b0d0914 MKG |
122 | ProcessAttachments(ARGSRef => \%ARGS); |
123 | ||
84fb5b46 MKG |
124 | my $skip_create = 0; |
125 | $m->callback( CallbackName => 'BeforeCreate', ARGSRef => \%ARGS, skip_create => \$skip_create, results => \@results ); | |
126 | ||
5b0d0914 | 127 | if ( !exists $ARGS{'AddMoreAttach'} and defined($ARGS{'id'}) and $ARGS{'id'} eq 'new' ) { # new ticket? |
84fb5b46 MKG |
128 | if ( $ValidCFs && !$skip_create ) { |
129 | $m->comp('Display.html', %ARGS); | |
130 | $RT::Logger->crit("After display call; error is $@"); | |
131 | $m->abort(); | |
132 | } | |
133 | elsif ( !$ValidCFs ) { | |
134 | # Invalid CFs | |
135 | while (my $CF = $CFs->Next) { | |
136 | my $msg = $m->notes('InvalidField-' . $CF->Id) or next; | |
137 | push @results, $CF->Name . ': ' . $msg; | |
138 | } | |
139 | } | |
140 | } | |
141 | ||
142 | </%init> |