1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
|
# Copyright (c) 2004 Ivan Kohler <ivan-rt@420.am>
#
# 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.
=head1 NAME
RT::Interface::Web_Vendor
=head1 SYNOPSIS
=head1 DESCRIPTION
Freeside vendor overlay for RT::Interface::Web.
=begin testing
use_ok(RT::Interface::Web_Vendor);
=end testing
=cut
#package RT::Interface::Web;
#use strict;
package HTML::Mason::Commands;
use strict;
=head2 ProcessTicketCustomers
=cut
sub ProcessTicketCustomers {
my %args = (
TicketObj => undef,
ARGSRef => undef,
@_
);
my @results = ();
my $Ticket = $args{'TicketObj'};
my $ARGSRef = $args{'ARGSRef'};
### false laziness w/RT::Interface::Web::ProcessTicketLinks
# Delete links that are gone gone gone.
foreach my $arg ( keys %$ARGSRef ) {
if ( $arg =~ /DeleteLink-(.*?)-(DependsOn|MemberOf|RefersTo)-(.*)$/ ) {
my $base = $1;
my $type = $2;
my $target = $3;
push @results,
"Trying to delete: Base: $base Target: $target Type $type";
my ( $val, $msg ) = $Ticket->DeleteLink( Base => $base,
Type => $type,
Target => $target );
push @results, $msg;
}
}
###
my @delete_custnums =
map { /^Ticket-AddCustomer-(\d+)$/; $1 }
grep { /^Ticket-AddCustomer-(\d+)$/ && $ARGSRef->{$_} }
keys %$ARGSRef;
my @custnums = map { /^Ticket-AddCustomer-(\d+)$/; $1 }
grep { /^Ticket-AddCustomer-(\d+)$/ && $ARGSRef->{$_} }
keys %$ARGSRef;
foreach my $custnum ( @custnums ) {
my( $val, $msg ) =
$Ticket->AddLink( 'Type' => 'MemberOf',
'Target' => "freeside://freeside/cust_main/$custnum",
);
push @results, $msg;
}
return @results;
}
1;
|