diff -bC3 Ticket_Overlay.pm Ticket_Local.pm *** Ticket_Overlay.pm Thu Jun 5 06:52:36 2003 --- Ticket_Local.pm Mon Jun 9 01:26:36 2003 *************** *** 904,917 **** # die "updaterecordobject is a webui thingy"; my @results; foreach my $attribute (@attribs) { my $value = $ticketargs{$attribute}; ! if ( $value ne $self->$attribute() ) { my $method = "Set$attribute"; my ( $code, $msg ) = $self->$method($value); push @results, $self->loc($attribute) . ': ' . $msg; --- 904,919 ---- # die "updaterecordobject is a webui thingy"; my @results; + my $ok = 1; foreach my $attribute (@attribs) { my $value = $ticketargs{$attribute}; ! if ( ( defined $value ) and ( $value ne $self->$attribute() ) ) { my $method = "Set$attribute"; my ( $code, $msg ) = $self->$method($value); + $ok = $code unless $ok < $code; push @results, $self->loc($attribute) . ': ' . $msg; *************** *** 924,930 **** $ChownType = "Force" if ( $ticketargs{'ForceOwnerChange'} ); my ( $val, $msg ) = $self->SetOwner( $ticketargs{'Owner'}, $ChownType ); ! push ( @results, $msg ); } # }}} --- 926,933 ---- $ChownType = "Force" if ( $ticketargs{'ForceOwnerChange'} ); my ( $val, $msg ) = $self->SetOwner( $ticketargs{'Owner'}, $ChownType ); ! push ( @results, $self->loc('Owner') . ': ' . $msg ); ! $ok = $val unless $ok < $val; } # }}} *************** *** 940,959 **** foreach my $type qw(Requestor Cc AdminCc) { ! # If we've been given a number of delresses to del, do it. foreach my $address (@{$ticketargs{'Del'.$type}}) { my ($id, $msg) = $self->DelWatcher( Type => $type, Email => $address); ! push (@results, $msg) ; } # If we've been given a number of addresses to add, do it. foreach my $address (@{$ticketargs{'Add'.$type}}) { $RT::Logger->debug("Adding $address as a $type"); my ($id, $msg) = $self->AddWatcher( Type => $type, Email => $address); ! push (@results, $msg) ; } } --- 943,999 ---- foreach my $type qw(Requestor Cc AdminCc) { ! # If we've been given a number of addresses to del, do it. foreach my $address (@{$ticketargs{'Del'.$type}}) { my ($id, $msg) = $self->DelWatcher( Type => $type, Email => $address); ! push (@results, 'Delete ' . $type . ': ' . $msg) ; ! $ok = $id unless $ok < $id; } # If we've been given a number of addresses to add, do it. foreach my $address (@{$ticketargs{'Add'.$type}}) { $RT::Logger->debug("Adding $address as a $type"); my ($id, $msg) = $self->AddWatcher( Type => $type, Email => $address); ! push (@results, 'Add ' . $type . ': ' . $msg) ; ! $ok = $id unless $ok < $id; } + # Attempt to do custom fields + my $cfs = $self->QueueObj->CustomFields(); + while (my $cf = $cfs->Next) { + my $name = lc($cf->Name); + $name =~ s/-//g; + + foreach my $op ('clear', 'del', '', 'add') { + if ( defined $args{$op . $name} ) { + if ( $op eq 'clear' ) { + my $vals = $self->CustomFieldValues($cf->id); + while (my $val = $vals->Next) { + my ($code, $msg) = $self->DeleteCustomFieldValue( Field => $cf, Value => $val->Content ); + if ($ok > $code) { # Only push the message if it's affecting our return value, as this was an implicit action + push ( @results, 'Clear ' . $cf->Name . ': ' . $msg ); + $ok = $code; + } + } + } + + foreach my $entry ( ref($args{$op . $name}) ? @{$args{$op . $name}} : ($args{$op . $name}) ) { + if ($op eq 'del' or $entry eq 'undef') { + my ($code, $msg) = $self->DeleteCustomFieldValue( Field => $cf, Value => $entry ); + push ( @results, 'Delete ' . $cf->Name . ': ' . $msg ); + $ok = $code unless $ok < $code; + } elsif ($entry ne 'undef') { + my ($code, $msg) = $self->AddCustomFieldValue( Field => $cf, Value => $entry ); + push ( @results, 'Add ' . $cf->Name . ': ' . $msg ); + $ok = $code unless $ok < $code; + } + } + } + } + } + + return ( $ok, join("\n", @results) ); } *************** *** 981,988 **** my $tag = lc($1); $tag =~ s/-//g; ! if ( defined( $args{$tag} ) ) ! { #if we're about to get a second value, make it an array $args{$tag} = [ $args{$tag} ]; } if ( ref( $args{$tag} ) ) --- 1021,1028 ---- my $tag = lc($1); $tag =~ s/-//g; ! if ( defined( $args{$tag} ) and not ref( $args{$tag} ) ) ! { #if we're about to get a second value, make it an array (as long as it isn't already an array!) $args{$tag} = [ $args{$tag} ]; } if ( ref( $args{$tag} ) ) diff -bC3 Interface/Email.pm Interface/Email_Local.pm *** Interface/Email.pm Mon Jun 9 01:25:14 2003 --- Interface/Email_Local.pm Mon Jun 9 01:47:15 2003 *************** *** 574,579 **** --- 574,590 ---- return ( 0, "Ticket creation failed", $Ticket ); } + # enhanced-mailgate functionality + if ($AuthStat >= 2) { + my $newTicket = RT::Ticket->new($CurrentUser); + $newTicket->Load($id); + if ( $newTicket->Id ) { + my $body = $Message->body_as_string; + $body =~ s/\010\013/\n/g; + $Ticket->UpdateFrom822($body), + } + } + # }}} } *************** *** 599,612 **** else { ( $status, $msg ) = $Ticket->Comment( MIMEObj => $Message ); } unless ($status) { #Warn the sender that we couldn't actually submit the comment. MailError( To => $ErrorsTo, ! Subject => "Message not recorded", Explanation => $msg, MIMEObj => $Message ); ! return ( 0, "Message not recorded", $Ticket ); } } --- 610,633 ---- else { ( $status, $msg ) = $Ticket->Comment( MIMEObj => $Message ); } + + # enhanced-mailgate functionality + my $errSubject = 'Message not recorded'; + if ( ( $status ) and ( $AuthStat >= 2 ) ) { + $errSubject = 'Metadata changes not applied'; + my $body = $Message->body_as_string; + $body =~ s/\010\013/\n/g; + ( $status, $msg ) = $Ticket->UpdateFrom822($body), + } + unless ($status) { #Warn the sender that we couldn't actually submit the comment. MailError( To => $ErrorsTo, ! Subject => $errSubject, Explanation => $msg, MIMEObj => $Message ); ! return ( 0, $errSubject, $Ticket ); } } *************** *** 629,638 **** return ( 1, "Success", $Ticket ); } - - eval "require RT::Interface::Email_Vendor"; - die $@ if ($@ && $@ !~ qr{^Can't locate RT/Interface/Email_Vendor.pm}); - eval "require RT::Interface::Email_Local"; - die $@ if ($@ && $@ !~ qr{^Can't locate RT/Interface/Email_Local.pm}); 1; --- 650,654 ---- diff -bC3 Interface/Email/Auth/MailFrom.pm Interface/Email/Auth/MailFrom_Local.pm *** Interface/Email/Auth/MailFrom.pm Thu Jun 5 06:52:36 2003 --- Interface/Email/Auth/MailFrom_Local.pm Mon Jun 9 00:57:52 2003 *************** *** 45,51 **** } if ( $CurrentUser->Id ) { ! return ( $CurrentUser, 1 ); } --- 45,51 ---- } if ( $CurrentUser->Id ) { ! return ( $CurrentUser, 2 ); } *************** *** 120,131 **** $CurrentUser = CreateUser( undef, $Address, $Name, $args{'Message'} ); ! return ( $CurrentUser, 1 ); } - - eval "require RT::Interface::Email::Auth::MailFrom_Vendor"; - die $@ if ($@ && $@ !~ qr{^Can't locate RT/Interface/Email/Auth/MailFrom_Vendor.pm}); - eval "require RT::Interface::Email::Auth::MailFrom_Local"; - die $@ if ($@ && $@ !~ qr{^Can't locate RT/Interface/Email/Auth/MailFrom_Local.pm}); 1; --- 120,126 ---- $CurrentUser = CreateUser( undef, $Address, $Name, $args{'Message'} ); ! return ( $CurrentUser, 2 ); } 1;