X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=rt%2Flib%2FRT%2FInterface%2FWeb_Vendor.pm;h=3f07656ebb9dff139a50b3937feb2636cf975a53;hb=fa741a3f4e5e281d81f62b504b7d20e9c6464fa4;hp=5be20e6b999dd0260b5304ce20f9baca89c57b66;hpb=22a6987b1625bea840861e2b1d9efa46671f1771;p=freeside.git diff --git a/rt/lib/RT/Interface/Web_Vendor.pm b/rt/lib/RT/Interface/Web_Vendor.pm index 5be20e6b9..3f07656eb 100644 --- a/rt/lib/RT/Interface/Web_Vendor.pm +++ b/rt/lib/RT/Interface/Web_Vendor.pm @@ -1,4 +1,5 @@ # Copyright (c) 2004 Ivan Kohler +# Copyright (c) 2008 Freeside Internet Services, Inc. # # 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 @@ -91,5 +92,59 @@ sub ProcessTicketCustomers { } +#false laziness w/above... eventually it should go away in favor of this +sub ProcessObjectCustomers { + my %args = ( + Object => undef, + ARGSRef => undef, + @_ + ); + my @results = (); + + my $Object = $args{'Object'}; + 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 ) = $Object->DeleteLink( Base => $base, + Type => $type, + Target => $target ); + + push @results, $msg; + + } + + } + ### + + my @delete_custnums = + map { /^Object-AddCustomer-(\d+)$/; $1 } + grep { /^Object-AddCustomer-(\d+)$/ && $ARGSRef->{$_} } + keys %$ARGSRef; + + my @custnums = map { /^Object-AddCustomer-(\d+)$/; $1 } + grep { /^Object-AddCustomer-(\d+)$/ && $ARGSRef->{$_} } + keys %$ARGSRef; + + foreach my $custnum ( @custnums ) { + my( $val, $msg ) = + $Object->AddLink( 'Type' => 'MemberOf', + 'Target' => "freeside://freeside/cust_main/$custnum", + ); + push @results, $msg; + } + + return @results; + +} + 1;