This commit was generated by cvs2svn to compensate for changes in r2526,
[freeside.git] / rt / webrt / Search / Bulk.html
1 %# $Header: /home/cvs/cvsroot/freeside/rt/webrt/Search/Attic/Bulk.html,v 1.1 2002-08-12 06:17:09 ivan Exp $
2 %# Copyright 1996-2001 Jesse Vincent <jesse@fsck.com>
3 <& /Elements/Header, Title => "Bulk ticket update" &>
4 <& /Elements/Tabs &>
5
6 <& /Elements/ListActions, actions => \@results &>
7
8 <FORM METHOD=POST>
9 <TABLE WIDTH=100% border=0 cellpadding=3 CELLSPACING=0>
10 <TR>
11 <TH>Update</TH>
12 %foreach my $col (@cols) {
13 % my $colalias = $col;
14 % $colalias =~ s/(Obj\-\>|)(Name|AsString)//;
15
16 <TH ><% $colalias %>&nbsp;</TH>
17 %}
18 </TR>
19
20 <%PERL>
21
22 my $i;
23
24
25       
26 $session{'tickets'}->RedoSearch();
27 while (my $Ticket = $session{'tickets'}->Next) {
28  $i++;
29  if ($i % 2) {
30      $bgcolor = "#dddddd";
31  }
32  else {
33      $bgcolor = "#ffffff";
34  }
35       </%PERL>
36 <TR bgcolor="<%$bgcolor%>">
37 <TD><input type=checkbox name="UpdateTicket<%$Ticket->Id%>" CHECKED></TD>
38 %# The ticket view is controlled by config.pm, WebOptions
39 %foreach my $col (@cols) {
40 <TD>
41 % if ($col eq 'id') {
42 <A HREF="<% $RT::WebPath%>/Ticket/Display.html?id=<%$Ticket->Id%>"><%$Ticket->Id()%></A>
43 % }
44 %else {
45 <% eval "\$Ticket->$col()" %>&nbsp;
46 %}
47 </TD>
48 %}
49 </TR>
50 %}
51
52
53
54 </TABLE>
55
56 <HR>
57
58
59 <& /Elements/TitleBoxStart, title => 'Update selected tickets' &>
60 <TABLE>
61 <TR>
62 <TD VALIGN=TOP>
63 <UL>
64 <li> Make Owner <& /Elements/SelectOwner, Name => "Owner" &>
65 (<input type=checkbox name="ForceOwnerChange"> Force change)
66 <li> Add Requestor <INPUT Name="AddRequestor" SIZE=20>
67 <li> Remove Requestor <INPUT Name="DeleteRequestor" SIZE=20>
68 <li> Add Cc <INPUT Name="AddCc" SIZE=20>
69 <li> Remove Cc <INPUT Name="DeleteCc" SIZE=20>
70 <li> Add AdminCc <INPUT Name="AddAdminCc" SIZE=20>
71 <li> Remove AdminCc <INPUT Name="DeleteAdminCc" SIZE=20>
72 </UL>
73 </TD>
74 <TD VALIGN=TOP>
75 <UL>
76 <li> Make subject <INPUT Name="Subject" SIZE=20>
77 <li> Make priority <INPUT Name="Priority" SIZE=4>
78 <li> Make queue <& /Elements/SelectQueue, Name => "Queue" &>
79
80 <li>Make Status <& /Elements/SelectStatus, Name => "Status" &>
81
82
83
84 <li> Make date Starts <& /Elements/SelectDate, Name => "Starts_Date", ShowTime => 0, Default => '' &>
85 <li> Make date Started <& /Elements/SelectDate, Name => "Started_Date", ShowTime => 0, Default => '' &>
86 <li> Make date Told <& /Elements/SelectDate, Name => "Told_Date", ShowTime => 0, Default => '' &>
87 <li> Make date Due <& /Elements/SelectDate, Name => "Due_Date", ShowTime => 0, Default => '' &>
88 <li> Make date Resolved <& /Elements/SelectDate, Name => "Resolved_Date", ShowTime => 0, Default => '' &>
89
90
91 % while ( my $KeywordSelect = $KeywordSelects->Next ) {
92
93 <li> Add <% $KeywordSelect->Name %> <& /Elements/SelectKeyword, Name => "AddToKeywordSelect".$KeywordSelect->id, KeywordObj => $KeywordSelect->KeywordObj &>
94 <li> Remove <% $KeywordSelect->Name %> <& /Elements/SelectKeyword, Name => "DeleteFromKeywordSelect".$KeywordSelect->id, KeywordObj => $KeywordSelect->KeywordObj &>
95 % }
96
97 </UL>
98
99
100 </TD>
101 </TR>
102 </table>
103 <& /Elements/TitleBoxEnd&>
104 <& /Elements/TitleBoxStart, title => 'Add comments or replies to selected tickets' &>
105 <table>
106 <tr><td align=right>Update Type:</td>
107 <td><select name="UpdateType">
108   <option value="private" >Comments (not sent to requestors)</option>
109 <option value="response" >Response to requestors</option>
110 </select> 
111 </td></tr>
112 <tr><td align=right>Subject:</td><td> <input name="UpdateSubject" size=60 value=""></td></tr>
113  <tr><td align=right>Attach:</td><td><input name="UpdateAttachment" type="file"></td></tr>
114  <tr><td colspan="2">
115  <& /Elements/MessageBox, Name=>"UpdateContent"&>
116  </td></tr>
117  </table>
118 <& /Elements/TitleBoxEnd &>
119
120
121
122
123 <& /Elements/Submit &>
124
125
126 </FORM>
127 <%INIT>
128
129 # Iterate through the ARGS hash and remove anything with a null value.
130 map ($ARGS{$_} =~ /^$/ && (delete $ARGS{$_}), keys %ARGS);
131
132 my ($bgcolor, @results);
133 my @cols = qw(id Status Priority Subject QueueObj->Name OwnerObj->Name RequestorsAsString DueAsString );
134
135 Abort("No search to operate on.") unless ($session{'tickets'});
136
137
138 my $do_comment_reply=0;
139 # Prepare for ticket updates
140 $ARGS{'UpdateContent'} =~ s/\r\n/\n/g;
141 chomp ($ARGS{'UpdateContent'}) ;
142
143 if ($ARGS{'UpdateContent'} &&
144     $ARGS{'UpdateContent'} ne '' &&
145     $ARGS{'UpdateContent'} ne  "-- \n" .
146     $session{'CurrentUser'}->UserObj->Signature) {
147             $do_comment_reply=1;
148 }
149
150 my $KeywordSelects = new RT::KeywordSelects $session{'CurrentUser'};
151 foreach ( $session{'tickets'}->RestrictionValues('Queue') ) {
152     $KeywordSelects->LimitToQueue($_);
153 }
154
155 $KeywordSelects->IncludeGlobals;
156
157
158 #Iterate through each ticket we've been handed
159
160 while (my $Ticket = $session{'tickets'}->Next) {
161     $RT::Logger->debug( "Checking Ticket ".$Ticket->Id ."\n");
162     next unless ($ARGS{"UpdateTicket".$Ticket->Id});
163     $RT::Logger->debug ("Matched\n");
164     #Update the basics.
165     my @basicresults = ProcessTicketBasics(TicketObj => $Ticket, ARGSRef => \%ARGS);
166     my @dateresults = ProcessTicketDates(TicketObj => $Ticket, ARGSRef => \%ARGS);
167     my @watchresults = ProcessTicketWatchers(TicketObj => $Ticket, ARGSRef => \%ARGS);    
168     my @selectresults = ProcessTicketObjectKeywords(TicketObj => $Ticket, ARGSRef => \%ARGS);
169     
170    
171      my @updateresults; 
172      if ($do_comment_reply) {
173      ProcessUpdateMessage(TicketObj => $Ticket, ARGSRef => \%ARGS, Actions => \
174 @updateresults); 
175     } 
176     my @tempresults = (@watchresults, @basicresults, @dateresults, @updateresults);
177     @tempresults = map { "Ticket ".$Ticket->Id. ": ".$_ } @tempresults;
178
179     
180     #Update the keyword selects
181     #Update the watchers
182     $RT::Logger->debug(join("\n",@tempresults));
183     @results = (@results, @tempresults);
184 }
185
186 </%INIT>