From: mark Date: Wed, 20 Apr 2011 01:22:20 +0000 (+0000) Subject: cloned tickets inherit customer links, #11169 X-Git-Tag: freeside_2_3_0~356 X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=4a90137be473f0d167c64e475d14f137aba1e1cd cloned tickets inherit customer links, #11169 --- diff --git a/rt/share/html/Ticket/Create.html b/rt/share/html/Ticket/Create.html index 5c6be7d47..6ea2c9f39 100755 --- a/rt/share/html/Ticket/Create.html +++ b/rt/share/html/Ticket/Create.html @@ -240,6 +240,7 @@ <&|/l&>Children <&|/l&>Refers to <&|/l&>Referred to by +Customer ID @@ -330,6 +331,16 @@ if ($CloneTicket) { @cf_values; } + # Pass customer links along (even though cloning of parent links + # in general is disabled). + my $customers = $CloneTicketObj->Customers; + my @customers; + while ( my $customer = $customers->Next ) { + my ($custnum) = $customer->Target =~ /cust_main\/(\d+)$/; + push @customers, $custnum if $custnum; + } + $clone->{'new-Customer'} = join(' ', @customers); + for ( keys %$clone ) { $ARGS{$_} = $clone->{$_} if not defined $ARGS{$_}; } @@ -423,7 +434,18 @@ $m->callback( CallbackName => 'BeforeCreate', ARGSRef => \%ARGS, skip_create => if ((!exists $ARGS{'AddMoreAttach'}) and (defined($ARGS{'id'}) and $ARGS{'id'} eq 'new')) { # new ticket? if ( $ValidCFs && !$checks_failure && !$skip_create ) { +# CREATE THE TICKET. +# For some reason it's done by a Mason component named "Display.html" +# and the call is buried in obscure error-handling stuff. +# This comment exists to make it more visually obvious. +# ************************************************************ + $m->comp('Display.html', %ARGS); + +# ************************************************************ +# Execution should not continue here. Display.html calls +# Redirect() which does an $m->abort. We only get here if the +# code dies before then, hence "$@". $RT::Logger->crit("After display call; error is $@"); $m->abort(); } diff --git a/rt/share/html/Ticket/Display.html b/rt/share/html/Ticket/Display.html index 6fd8b85e6..a6850bb1e 100755 --- a/rt/share/html/Ticket/Display.html +++ b/rt/share/html/Ticket/Display.html @@ -104,6 +104,14 @@ unless ($id || $TicketObj) { if ($ARGS{'id'} eq 'new') { # {{{ Create a new ticket + # Massage customer IDs into member links. + my @cust_uris = map { + /^(\d+)$/ && "freeside://freeside/cust_main/$1" + } split(' ', $ARGS{'new-Customer'}); + + $ARGS{'new-MemberOf'} = + join(' ', $ARGS{'new-MemberOf'}, @cust_uris); + my $Queue = new RT::Queue( $session{'CurrentUser'} ); $Queue->Load($ARGS{'Queue'}); unless ( $Queue->id ) {