Upgrade to 4.0.10.
[usit-rt.git] / share / html / SelfService / Create.html
CommitLineData
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>
94<tr>
95<td class="label">
96%# FIXME: if failed customfields validation, attachement needs to be choosen
97%# again by user.
98<&|/l&>Attach file</&>:
99</td>
100<td class="value">
101<input name="Attach" type="file" />
102</td>
103</tr>
104</table>
105<table width="100%">
106<tr>
107<td colspan="2">
108<&|/l&>Describe the issue below</&>:<br />
109<& /Elements/MessageBox, Default => $ARGS{Content} || '' &>
110</td>
111</tr>
112</table>
113<& /Elements/Submit, Label => loc("Create ticket")&>
114
115
116</form>
117<%args>
118$Queue => undef
119</%args>
120<%init>
121my @results;
122my $queue_obj = RT::Queue->new($session{'CurrentUser'});
123$queue_obj->Load($Queue);
124my $CFs = $queue_obj->TicketCustomFields();
125my $ValidCFs = $m->comp(
126 '/Elements/ValidateCustomFields',
127 CustomFields => $CFs,
128 ARGSRef => \%ARGS
129);
130
131my $skip_create = 0;
132$m->callback( CallbackName => 'BeforeCreate', ARGSRef => \%ARGS, skip_create => \$skip_create, results => \@results );
133
134if ( defined($ARGS{'id'}) and $ARGS{'id'} eq 'new' ) { # new ticket?
135 if ( $ValidCFs && !$skip_create ) {
136 $m->comp('Display.html', %ARGS);
137 $RT::Logger->crit("After display call; error is $@");
138 $m->abort();
139 }
140 elsif ( !$ValidCFs ) {
141 # Invalid CFs
142 while (my $CF = $CFs->Next) {
143 my $msg = $m->notes('InvalidField-' . $CF->Id) or next;
144 push @results, $CF->Name . ': ' . $msg;
145 }
146 }
147}
148
149</%init>