Updated client to Inquirer as the person isn't a client until they have accepted a contract

This commit is contained in:
Peter Edmond 2025-01-16 21:32:04 +00:00
parent b02d6653cd
commit 9522d0fb63
4 changed files with 249 additions and 0 deletions

17
FacilitatorFullEmail.txt Normal file
View File

@ -0,0 +1,17 @@
From: Davis Method <test-queue@davismethod.com>
Subject: Davis Method Inquiry
Content-Type: text/html
<p>Below are the full details of the lead. Unless you have other arrangements with your Hub, please follow up with this contact below from <b>your davismethod.com email address</b> as soon as possible (within 24 hours is ideal).</p>
<p>Form details:</p>
{$Ticket->FirstCustomFieldValue('Redacted Form Details')}
{$Ticket->FirstCustomFieldValue('Form Details')}
<p>We hope that this will turn into a successful program!</p>
<br>
<p>Warm Regards,</p>
<p>The Davis Team</p>

72
Scrip21.txt Normal file
View File

@ -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;

86
Scrip22.txt Normal file
View File

@ -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;

74
Scrip24.txt Normal file
View File

@ -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;