From 9522d0fb633b07a923d0eee0a07eda4f742b8a46 Mon Sep 17 00:00:00 2001 From: Peter Edmond Date: Thu, 16 Jan 2025 21:32:04 +0000 Subject: [PATCH] Updated client to Inquirer as the person isn't a client until they have accepted a contract --- FacilitatorFullEmail.txt | 17 ++++++++ Scrip21.txt | 72 +++++++++++++++++++++++++++++++++ Scrip22.txt | 86 ++++++++++++++++++++++++++++++++++++++++ Scrip24.txt | 74 ++++++++++++++++++++++++++++++++++ 4 files changed, 249 insertions(+) create mode 100644 FacilitatorFullEmail.txt create mode 100644 Scrip21.txt create mode 100644 Scrip22.txt create mode 100644 Scrip24.txt diff --git a/FacilitatorFullEmail.txt b/FacilitatorFullEmail.txt new file mode 100644 index 0000000..b0104b6 --- /dev/null +++ b/FacilitatorFullEmail.txt @@ -0,0 +1,17 @@ +From: Davis Method +Subject: Davis Method Inquiry +Content-Type: text/html + +

Below are the full details of the lead. Unless you have other arrangements with your Hub, please follow up with this contact below from your davismethod.com email address as soon as possible (within 24 hours is ideal).

+ +

Form details:

+ +{$Ticket->FirstCustomFieldValue('Redacted Form Details')} +{$Ticket->FirstCustomFieldValue('Form Details')} + +

We hope that this will turn into a successful program!

+ +
+

Warm Regards,

+

The Davis Team

+ diff --git a/Scrip21.txt b/Scrip21.txt new file mode 100644 index 0000000..9561e00 --- /dev/null +++ b/Scrip21.txt @@ -0,0 +1,72 @@ +# On create: +# - Sent email to requestor +# - Check queue, and transfer to new queue if required + +# Custom condition: + +my $txn = $self->TransactionObj; +my $type = $txn->Type; +my $ticket = $self->TicketObj; + +#return 0 unless $type eq "Status" || ( $type eq 'Set' && $txn->Field eq 'Status'); +# To test by triggering change of status (Condition ^ above!) + +#Only act in test-queue (safety for testing) +return 0 unless $ticket->QueueObj->Name eq "test-queue"; +#Only act on creation +return 0 unless $txn->Type eq "Create"; + +return 1; + + +# Custom action preparation code: +require RT::Action::SendEmail; +use strict; +use vars qw/@ISA/; +@ISA = qw(RT::Action::SendEmail); +$self->SetRecipients(); +$self->SUPER::Prepare(); +$self->SUPER::Commit(); + +sub SetRecipients { +my $self = shift; +my $ticket = $self->TicketObj; +my ( @To, @PseudoTo, @Cc, @Bcc ); +my $arg ='Owner,Requestor,AdminCc,Cc'; +##Requestor +#push @To, $ticket->Requestors->MemberEmailAddresses; +push @To, $ticket->FirstCustomFieldValue('Inquirer Email'); + +my $creator = "Davis Admin"; +@{ $self->{'To'} } = @To; + +} + +1; + +# Custom action commit code: +my $ticket = $self->TicketObj; +my $queue = $ticket->FirstCustomFieldValue('Hub Queue'); + +#if ($ticket->Status() ne "new") { +# return 1; +#} + +#$ticket->Comment(Content => 'Script #21 - sending email to requestor'); +#$ticket->Comment(Content => 'Status is: '.$self->TicketObj->Status()); +$ticket->Comment(Content => 'AUTO: Email sent to requestor is: '.$ticket->FirstCustomFieldValue('Inquirer Email')); +# $ticket->Comment(Content => 'To is: '.@{ $self->{'To'} }); + +#Now change Queue +#Get list of queues?: +if ($queue eq "test-queue") { + $ticket->Comment(Content => 'AUTO: Leaving in current queue'); +} else { + $ticket->Comment(Content => 'AUTO: Changing queue to'.$queue); + my ($status, $msg) = $ticket->SetQueue( $queue); +} +return 1; + + + + diff --git a/Scrip22.txt b/Scrip22.txt new file mode 100644 index 0000000..4e6a328 --- /dev/null +++ b/Scrip22.txt @@ -0,0 +1,86 @@ +# On create: +# - Sent email to requestor +# - Check queue, and transfer to new queue if required + +# Custom condition: + +my $txn = $self->TransactionObj; +my $type = $txn->Type; +my $ticket = $self->TicketObj; +if ($ticket->Status() eq "Redacted Facilitator Email Sent") { + return 0; +} +return 0 unless $type eq "Status" || ( $type eq 'Set' && $txn->Field eq 'Status'); +return 0 unless $txn->OldValue eq "new"; +return 0 unless $txn->NewValue eq "Hub Not Assigned"; +# To test by triggering change of status (Condition ^ above!) + +#Only act in test-queue (safety for testing) +return 0 unless $ticket->QueueObj->Name eq "test-queue"; +#Only act on creation +#return 0 unless $txn->Type eq "Create"; +# ONLY run script if current status is "Hub Not Assigned" +if ($ticket->Status() eq "Hub Not Assigned") { + return 1; +} +return 0; + + +# Custom action preparation code: +require RT::Action::SendEmail; +use strict; +use vars qw/@ISA/; +@ISA = qw(RT::Action::SendEmail); + +#STOP RACE CONDITION! +if ($self->TicketObj->Status() ne "Hub Not Assigned") { + if ($self->TicketObj->Status() ne "Re-send Facilitator Email") { + return 0; + } +} + +$self->SetRecipients(); +$self->SUPER::Prepare(); +$self->SUPER::Commit(); +sub SetRecipients { +my $self = shift; +my $ticket = $self->TicketObj; +my ( @To, @PseudoTo, @Cc, @Bcc ); +my $arg ='Owner,Requestor,AdminCc,Cc'; +##Requestor +#push @To, $ticket->Requestors->MemberEmailAddresses; +push @To, $ticket->FirstCustomFieldValue('Facilitator Email'); + +my $creator = "Davis Admin"; +@{ $self->{'To'} } = @To; + +} + +1; + + +# Custom action commit code: +#Move to Redacted Facilitator email sent. + +my $ticket = $self->TicketObj; +my $facilitator = $ticket->FirstCustomFieldValue('Facilitator Email'); + +if ($ticket->FirstCustomFieldValue('Facilitator Email') eq '') { + return 0; +} + +#if ($ticket->Status() ne "new") { +# return 1; +#} + +#$ticket->Comment(Content => 'Script #22 - sending email to facilitator'); +#$ticket->Comment(Content => 'Status is: '.$self->TicketObj->Status()); + +$ticket->Comment(Content => 'AUTO: Email sent. Facilitator is: '.$ticket->FirstCustomFieldValue('Facilitator Email')); + +$ticket->Comment(Content => 'AUTO: Changing status to "Redacted Facilitator Email Sent"'); +my ($status, $msg) = $ticket->SetStatus('Redacted Facilitator Email Sent'); + +return 1; + + diff --git a/Scrip24.txt b/Scrip24.txt new file mode 100644 index 0000000..4cb7464 --- /dev/null +++ b/Scrip24.txt @@ -0,0 +1,74 @@ +# On client accepted: +# - Sent full detail email to facilitator + +# Custom condition: + +my $txn = $self->TransactionObj; +my $type = $txn->Type; +my $ticket = $self->TicketObj; + +return 0 unless $type eq "Status" || ( $type eq 'Set' && $txn->Field eq 'Status'); +#return 0 unless $txn->OldValue eq "new"; +#return 0 unless $txn->NewValue eq "Hub Not Assigned"; +# To test by triggering change of status (Condition ^ above!) + +#Only act in test-queue (safety for testing) +return 0 unless $ticket->QueueObj->Name eq "test-queue"; + +# ONLY run script if current status is "Facilitator Accepted" +if ($ticket->Status() eq "Facilitator Accepted") { + return 1; +} +return 0; + + +# Custom action preparation code: +require RT::Action::SendEmail; +use strict; +use vars qw/@ISA/; +@ISA = qw(RT::Action::SendEmail); + +#STOP RACE CONDITION! +if ($self->TicketObj->Status() ne "Facilitator Accepted") { + return 0; +} + +$self->SetRecipients(); +$self->SUPER::Prepare(); +$self->SUPER::Commit(); +sub SetRecipients { +my $self = shift; +my $ticket = $self->TicketObj; +my ( @To, @PseudoTo, @Cc, @Bcc ); +my $arg ='Owner,Requestor,AdminCc,Cc'; +##Requestor +#push @To, $ticket->Requestors->MemberEmailAddresses; +push @To, $ticket->FirstCustomFieldValue('Facilitator Email'); + +my $creator = "Davis Admin"; +@{ $self->{'To'} } = @To; + +} + +1; + + +# Custom action commit code: + +#Move to Full Facilitator Email Sent and detailed email sent. + +my $ticket = $self->TicketObj; +my $facilitator = $ticket->FirstCustomFieldValue('Facilitator Email'); + +if ($ticket->FirstCustomFieldValue('Facilitator Email') eq '') { + return 0; +} + +$ticket->Comment(Content => 'AUTO: Email with all details sent. Facilitator is: '.$ticket->FirstCustomFieldValue('Facilitator Email')); + +$ticket->Comment(Content => 'AUTO: Changing status to "Full Facilitator Email Sent"'); +my ($status, $msg) = $ticket->SetStatus('Full Facilitator Email Sent'); + +return 1; + +