diff --git a/app/Http/Controllers/Agent/helpdesk/MailController.php b/app/Http/Controllers/Agent/helpdesk/MailController.php
index 64e22995d..49aa1738a 100644
--- a/app/Http/Controllers/Agent/helpdesk/MailController.php
+++ b/app/Http/Controllers/Agent/helpdesk/MailController.php
@@ -120,6 +120,7 @@ class MailController extends Controller
$mail = $mailbox->getMail($mailId);
try {
$mail = $mailbox->getMail($mailId);
+
} catch (\PhpImap\Exception $e) {
echo 'Connection error';
}
@@ -171,6 +172,8 @@ class MailController extends Controller
} else {
$subject = 'No Subject';
}
+
+ $to = $mail->to;
$fromname = $mail->fromName;
$fromaddress = $mail->fromAddress;
$ticket_source = Ticket_source::where('name', '=', 'email')->first();
@@ -182,7 +185,7 @@ class MailController extends Controller
$form_data = null;
$team_assign = null;
$ticket_status = null;
- $result = $this->TicketWorkflowController->workflow($fromaddress, $fromname, $subject, $body, $phone, $phonecode, $mobile_number, $helptopic, $sla, $priority, $source, $collaborator, $dept, $assign, $team_assign, $ticket_status, $form_data, $auto_response, $mail->getAttachments());
+ $result = $this->TicketWorkflowController->workflow($fromaddress, $fromname, $to, $subject, $body, $phone, $phonecode, $mobile_number, $helptopic, $sla, $priority, $source, $collaborator, $dept, $assign, $team_assign, $ticket_status, $form_data, $auto_response, $mail->getAttachments());
if ($result[1] == true) {
$ticket_table = Tickets::where('ticket_number', '=', $result[0])->first();
diff --git a/app/Http/Controllers/Agent/helpdesk/TicketWorkflowController.php b/app/Http/Controllers/Agent/helpdesk/TicketWorkflowController.php
index c95dc9fc0..2fa2fa0a7 100644
--- a/app/Http/Controllers/Agent/helpdesk/TicketWorkflowController.php
+++ b/app/Http/Controllers/Agent/helpdesk/TicketWorkflowController.php
@@ -40,33 +40,35 @@ class TicketWorkflowController extends Controller
*
* @return type response
*/
- public function workflow($fromaddress, $fromname, $subject, $body, $phone, $phonecode, $mobile_number, $helptopic, $sla, $priority, $source, $collaborator, $dept, $assign, $team_assign, $ticket_status, $form_data, $auto_response, $mail)
+ public function workflow($fromaddress, $fromname, $to, $subject, $body, $phone, $phonecode, $mobile_number, $helptopic, $sla, $priority, $source, $collaborator, $dept, $assign, $team_assign, $ticket_status, $form_data, $auto_response, $mail)
{
- $contact_details = ['email' => $fromaddress, 'email_name' => $fromname, 'subject' => $subject, 'message' => $body];
+ $contact_details = ['email' => $fromaddress, 'email_name' => $fromname, 'email_to' => $to, 'subject' => $subject, 'message' => $body];
$ticket_settings_details = ['help_topic' => $helptopic, 'sla' => $sla, 'priority' => $priority, 'source' => $source, 'dept' => $dept, 'assign' => $assign, 'team' => $team_assign, 'status' => $ticket_status, 'reject' => false];
// get all the workflow common to the entire system which includes any type of ticket creation where the execution order of the workflow should be starting with ascending order
$workflows = WorkflowName::where('target', '=', 'A-0')->where('status', '=', '1')->orderBy('order', 'asc')->get();
+
foreach ($workflows as $workflow) {
// checking if any workflow defined in the system
if ($workflow) {
// get all the rules of workflow which has a foreign key of those workflow which are applied to creating any ticket from any source
- $worklfow_rules = WorkflowRules::where('workflow_id', '=', $workflow->id)->get();
- foreach ($worklfow_rules as $worklfow_rule) {
+ $workflow_rules = WorkflowRules::where('workflow_id', '=', $workflow->id)->get();
+
+ foreach ($workflow_rules as $workflow_rule) {
// checking for the workflow rules to which workflow rule type it is
- if ($worklfow_rule->matching_scenario == 'email') {
- if ($rule_condition = $this->checkRuleCondition($contact_details['email'], $worklfow_rule->matching_relation, $worklfow_rule->matching_value) == true) {
+ if ($workflow_rule->matching_scenario == 'email') {
+ if ($rule_condition = $this->checkRuleCondition($contact_details['email'], $workflow_rule->matching_relation, $workflow_rule->matching_value) == true) {
$ticket_settings_details = $this->applyActionCondition($workflow->id, $ticket_settings_details);
}
- } elseif ($worklfow_rule->matching_scenario == 'email_name') {
- if ($rule_condition = $this->checkRuleCondition($contact_details['email_name'], $worklfow_rule->matching_relation, $worklfow_rule->matching_value) == true) {
+ } elseif ($workflow_rule->matching_scenario == 'email_name') {
+ if ($rule_condition = $this->checkRuleCondition($contact_details['email_name'], $workflow_rule->matching_relation, $workflow_rule->matching_value) == true) {
$ticket_settings_details = $this->applyActionCondition($workflow->id, $ticket_settings_details);
}
- } elseif ($worklfow_rule->matching_scenario == 'subject') {
+ } elseif ($workflow_rule->matching_scenario == 'subject') {
if ($rule_condition = $this->checkRuleCondition($contact_details['subject'], $worklfow_rule->matching_relation, $worklfow_rule->matching_value) == true) {
$ticket_settings_details = $this->applyActionCondition($workflow->id, $ticket_settings_details);
}
- } elseif ($worklfow_rule->matching_scenario == 'message') {
- if ($rule_condition = $this->checkRuleCondition($contact_details['message'], $worklfow_rule->matching_relation, $worklfow_rule->matching_value) == true) {
+ } elseif ($workflow_rule->matching_scenario == 'message') {
+ if ($rule_condition = $this->checkRuleCondition($contact_details['message'], $workflow_rule->matching_relation, $workflow_rule->matching_value) == true) {
$ticket_settings_details = $this->applyActionCondition($workflow->id, $ticket_settings_details);
}
}
@@ -78,24 +80,24 @@ class TicketWorkflowController extends Controller
$workflows_webs = WorkflowName::where('target', '=', 'A-1')->where('status', '=', '1')->orderBy('order', 'asc')->get();
foreach ($workflows_webs as $workflows_web) {
if ($workflows_web) {
- $worklfow_rules = WorkflowRules::where('workflow_id', '=', $workflows_web->id)->get();
- foreach ($worklfow_rules as $worklfow_rule) {
- if ($worklfow_rule) {
+ $workflow_rules = WorkflowRules::where('workflow_id', '=', $workflows_web->id)->get();
+ foreach ($workflow_rules as $workflow_rule) {
+ if ($workflow_rule) {
// checking for the workflow rules to which workflow rule type it is
- if ($worklfow_rule->matching_scenario == 'email') {
- if ($this->checkRuleCondition($contact_details['email'], $worklfow_rule->matching_relation, $worklfow_rule->matching_value) == true) {
+ if ($workflow_rule->matching_scenario == 'email') {
+ if ($this->checkRuleCondition($contact_details['email'], $workflow_rule->matching_relation, $workflow_rule->matching_value) == true) {
$ticket_settings_details = $this->applyActionCondition($workflows_web->id, $ticket_settings_details);
}
- } elseif ($worklfow_rule->matching_scenario == 'email_name') {
- if ($this->checkRuleCondition($contact_details['email_name'], $worklfow_rule->matching_relation, $worklfow_rule->matching_value) == true) {
+ } elseif ($workflow_rule->matching_scenario == 'email_name') {
+ if ($this->checkRuleCondition($contact_details['email_name'], $workflow_rule->matching_relation, $workflow_rule->matching_value) == true) {
$ticket_settings_details = $this->applyActionCondition($workflows_web->id, $ticket_settings_details);
}
- } elseif ($worklfow_rule->matching_scenario == 'subject') {
- if ($this->checkRuleCondition($contact_details['subject'], $worklfow_rule->matching_relation, $worklfow_rule->matching_value) == true) {
+ } elseif ($workflow_rule->matching_scenario == 'subject') {
+ if ($this->checkRuleCondition($contact_details['subject'], $workflow_rule->matching_relation, $workflow_rule->matching_value) == true) {
$ticket_settings_details = $this->applyActionCondition($workflows_web->id, $ticket_settings_details);
}
- } elseif ($worklfow_rule->matching_scenario == 'message') {
- if ($this->checkRuleCondition($contact_details['message'], $worklfow_rule->matching_relation, $worklfow_rule->matching_value) == true) {
+ } elseif ($workflow_rule->matching_scenario == 'message') {
+ if ($this->checkRuleCondition($contact_details['message'], $workflow_rule->matching_relation, $workflow_rule->matching_value) == true) {
$ticket_settings_details = $this->applyActionCondition($workflows_web->id, $ticket_settings_details);
}
}
@@ -109,24 +111,32 @@ class TicketWorkflowController extends Controller
$workflows_emails = WorkflowName::where('target', '=', 'A-2')->where('status', '=', '1')->orderBy('order', 'asc')->get();
foreach ($workflows_emails as $workflows_email) {
if ($workflows_email) {
- $worklfow_rules = WorkflowRules::where('workflow_id', '=', $workflows_email->id)->get();
- foreach ($worklfow_rules as $worklfow_rule) {
- if ($worklfow_rule) {
+ $workflow_rules = WorkflowRules::where('workflow_id', '=', $workflows_email->id)->get();
+ foreach ($workflow_rules as $workflow_rule) {
+ if ($workflow_rule) {
// checking for the workflow rules to which workflow rule type it is
- if ($worklfow_rule->matching_scenario == 'email') {
- if ($rule_condition = $this->checkRuleCondition($contact_details['email'], $worklfow_rule->matching_relation, $worklfow_rule->matching_value) == true) {
+ if ($workflow_rule->matching_scenario == 'email') {
+ if ($rule_condition = $this->checkRuleCondition($contact_details['email'], $workflow_rule->matching_relation, $workflow_rule->matching_value) == true) {
$ticket_settings_details = $this->applyActionCondition($workflows_email->id, $ticket_settings_details);
}
- } elseif ($worklfow_rule->matching_scenario == 'email_name') {
- if ($rule_condition = $this->checkRuleCondition($contact_details['email_name'], $worklfow_rule->matching_relation, $worklfow_rule->matching_value) == true) {
+ } elseif ($workflow_rule->matching_scenario == 'email_name') {
+ if ($rule_condition = $this->checkRuleCondition($contact_details['email_name'], $workflow_rule->matching_relation, $workflow_rule->matching_value) == true) {
$ticket_settings_details = $this->applyActionCondition($workflows_email->id, $ticket_settings_details);
}
- } elseif ($worklfow_rule->matching_scenario == 'subject') {
- if ($rule_condition = $this->checkRuleCondition($contact_details['subject'], $worklfow_rule->matching_relation, $worklfow_rule->matching_value) == true) {
+ } elseif ($workflow_rule->matching_scenario == 'email_to') {
+
+ foreach ($contact_details['email_to'] as $email_toaddress => $email_toname) {
+ if ($rule_condition = $this->checkRuleCondition($email_toaddress, $workflow_rule->matching_relation, $workflow_rule->matching_value) == true) {
+ $ticket_settings_details = $this->applyActionCondition($workflows_email->id, $ticket_settings_details);
+ break;
+ }
+ }
+ } elseif ($workflow_rule->matching_scenario == 'subject') {
+ if ($rule_condition = $this->checkRuleCondition($contact_details['subject'], $workflow_rule->matching_relation, $workflow_rule->matching_value) == true) {
$ticket_settings_details = $this->applyActionCondition($workflows_email->id, $ticket_settings_details);
}
- } elseif ($worklfow_rule->matching_scenario == 'message') {
- if ($rule_condition = $this->checkRuleCondition($contact_details['message'], $worklfow_rule->matching_relation, $worklfow_rule->matching_value) == true) {
+ } elseif ($workflow_rule->matching_scenario == 'message') {
+ if ($rule_condition = $this->checkRuleCondition($contact_details['message'], $workflow_rule->matching_relation, $workflow_rule->matching_value) == true) {
$ticket_settings_details = $this->applyActionCondition($workflows_email->id, $ticket_settings_details);
}
}
@@ -140,24 +150,28 @@ class TicketWorkflowController extends Controller
$workflows_apis = WorkflowName::where('target', '=', 'A-4')->where('status', '=', '1')->orderBy('order', 'asc')->get();
foreach ($workflows_apis as $workflows_api) {
if ($workflows_api) {
- $worklfow_rules = WorkflowRules::where('workflow_id', '=', $workflows_api->id)->get();
- foreach ($worklfow_rules as $worklfow_rule) {
- if ($worklfow_rule) {
+ $workflow_rules = WorkflowRules::where('workflow_id', '=', $workflows_api->id)->get();
+ foreach ($workflow_rules as $workflow_rule) {
+ if ($workflow_rule) {
// checking for the workflow rules to which workflow rule type it is
- if ($worklfow_rule->matching_scenario == 'email') {
- if ($rule_condition = $this->checkRuleCondition($contact_details['email'], $worklfow_rule->matching_relation, $worklfow_rule->matching_value) == true) {
+ if ($workflow_rule->matching_scenario == 'email') {
+ if ($rule_condition = $this->checkRuleCondition($contact_details['email'], $workflow_rule->matching_relation, $workflow_rule->matching_value) == true) {
$ticket_settings_details = $this->applyActionCondition($workflows_api->id, $ticket_settings_details);
}
- } elseif ($worklfow_rule->matching_scenario == 'email_name') {
- if ($rule_condition = $this->checkRuleCondition($contact_details['email_name'], $worklfow_rule->matching_relation, $worklfow_rule->matching_value) == true) {
+ } elseif ($workflow_rule->matching_scenario == 'email_to') {
+ if ($rule_condition = $this->checkRuleCondition($contact_details['email'], $workflow_rule->matching_relation, $workflow_rule->matching_value) == true) {
$ticket_settings_details = $this->applyActionCondition($workflows_api->id, $ticket_settings_details);
}
- } elseif ($worklfow_rule->matching_scenario == 'subject') {
- if ($rule_condition = $this->checkRuleCondition($contact_details['subject'], $worklfow_rule->matching_relation, $worklfow_rule->matching_value) == true) {
+ } elseif ($workflow_rule->matching_scenario == 'email_name') {
+ if ($rule_condition = $this->checkRuleCondition($contact_details['email_name'], $workflow_rule->matching_relation, $workflow_rule->matching_value) == true) {
$ticket_settings_details = $this->applyActionCondition($workflows_api->id, $ticket_settings_details);
}
- } elseif ($worklfow_rule->matching_scenario == 'message') {
- if ($rule_condition = $this->checkRuleCondition($contact_details['message'], $worklfow_rule->matching_relation, $worklfow_rule->matching_value) == true) {
+ } elseif ($workflow_rule->matching_scenario == 'subject') {
+ if ($rule_condition = $this->checkRuleCondition($contact_details['subject'], $workflow_rule->matching_relation, $workflow_rule->matching_value) == true) {
+ $ticket_settings_details = $this->applyActionCondition($workflows_api->id, $ticket_settings_details);
+ }
+ } elseif ($workflow_rule->matching_scenario == 'message') {
+ if ($rule_condition = $this->checkRuleCondition($contact_details['message'], $workflow_rule->matching_relation, $workflow_rule->matching_value) == true) {
$ticket_settings_details = $this->applyActionCondition($workflows_api->id, $ticket_settings_details);
}
}
@@ -204,6 +218,7 @@ class TicketWorkflowController extends Controller
// } elseif($condition == 'not_match') {
//
// }
+
return $return;
}
diff --git a/app/Http/Controllers/Client/helpdesk/ClientTicketController.php b/app/Http/Controllers/Client/helpdesk/ClientTicketController.php
index cef903cc2..c42b211a8 100644
--- a/app/Http/Controllers/Client/helpdesk/ClientTicketController.php
+++ b/app/Http/Controllers/Client/helpdesk/ClientTicketController.php
@@ -68,6 +68,7 @@ class ClientTicketController extends Controller
$fromaddress = $user_cred->email;
$fromname = $user_cred->user_name;
+ $to = '';
$phone = '';
$phonecode = '';
$mobile_number = '';
@@ -86,7 +87,7 @@ class ClientTicketController extends Controller
$inline_attachment = null;
- $this->TicketWorkflowController->workflow($fromaddress, $fromname, $subject, $body, $phone, $phonecode, $mobile_number, $helptopic, $sla, $priority, $source, $collaborator, $dept, $assign, $team_assign, $ticket_status, $form_data, $auto_response, $inline_attachment);
+ $this->TicketWorkflowController->workflow($fromaddress, $fromname, $to, $subject, $body, $phone, $phonecode, $mobile_number, $helptopic, $sla, $priority, $source, $collaborator, $dept, $assign, $team_assign, $ticket_status, $form_data, $auto_response, $inline_attachment);
return \Redirect::back()->with('success1', Lang::get('lang.successfully_replied'));
}
diff --git a/app/Http/Controllers/Client/helpdesk/FormController.php b/app/Http/Controllers/Client/helpdesk/FormController.php
index c1a2a73b7..320017c40 100644
--- a/app/Http/Controllers/Client/helpdesk/FormController.php
+++ b/app/Http/Controllers/Client/helpdesk/FormController.php
@@ -149,6 +149,7 @@ class FormController extends Controller
$name = $request->input('Name');
$phone = $request->input('Phone');
$email = $request->input('Email');
+ $to = '';
$subject = $request->input('Subject');
$details = $request->input('Details');
$phonecode = $request->input('Code');
@@ -200,7 +201,7 @@ class FormController extends Controller
} else {
$inline_attachment = null;
}
- $result = $this->TicketWorkflowController->workflow($email, $name, $subject, $details, $phone, $phonecode, $mobile_number, $helptopic, $sla, $priority, $source, $collaborator, $department, $assignto, $team_assign, $status, $form_extras, $auto_response, $inline_attachment);
+ $result = $this->TicketWorkflowController->workflow($email, $name, $to, $subject, $details, $phone, $phonecode, $mobile_number, $helptopic, $sla, $priority, $source, $collaborator, $department, $assignto, $team_assign, $status, $form_extras, $auto_response, $inline_attachment);
if ($result[1] == 1) {
$ticketId = Tickets::where('ticket_number', '=', $result[0])->first();
@@ -244,6 +245,7 @@ class FormController extends Controller
$fromaddress = $user_cred->email;
$fromname = $user_cred->user_name;
+ $to = '';
$phone = '';
$phonecode = '';
$mobile_number = '';
@@ -260,7 +262,7 @@ class FormController extends Controller
$ticket_status = null;
$auto_response = 0;
- $this->TicketWorkflowController->workflow($fromaddress, $fromname, $subject, $body, $phone, $phonecode, $mobile_number, $helptopic, $sla, $priority, $source, $collaborator, $dept, $assign, $team_assign, $ticket_status, $form_data, $auto_response);
+ $this->TicketWorkflowController->workflow($fromaddress, $to, $fromname, $subject, $body, $phone, $phonecode, $mobile_number, $helptopic, $sla, $priority, $source, $collaborator, $dept, $assign, $team_assign, $ticket_status, $form_data, $auto_response);
return \Redirect::back()->with('success1', Lang::get('lang.successfully_replied'));
} else {
diff --git a/resources/lang/de/lang.php b/resources/lang/de/lang.php
index babede809..24f9190c8 100644
--- a/resources/lang/de/lang.php
+++ b/resources/lang/de/lang.php
@@ -95,6 +95,7 @@ return [
'create_email' => 'Create Email',
'email_address' => 'Email Address',
'email_name' => 'Email Name',
+ 'email_to' => 'Email to',
'help_topic' => 'Help Topic',
'auto_response' => 'Auto Response',
'host_name' => 'Host Name',
diff --git a/resources/lang/en/lang.php b/resources/lang/en/lang.php
index 06f41a5fd..0fa5ec1de 100644
Binary files a/resources/lang/en/lang.php and b/resources/lang/en/lang.php differ
diff --git a/resources/lang/it/lang.php b/resources/lang/it/lang.php
index de9c141d5..4d4265081 100644
--- a/resources/lang/it/lang.php
+++ b/resources/lang/it/lang.php
@@ -96,6 +96,7 @@ return [
'create_email' => 'Crea Email',
'email_address' => 'Indirizzo Email',
'email_name' => 'Nome Email',
+ 'email_to' => 'Email to',
'help_topic' => 'Argomento della Guida',
'auto_response' => 'Auto Risposta',
'host_name' => 'Nome Host',
diff --git a/resources/lang/ru/lang.php b/resources/lang/ru/lang.php
index 703032adc..4945a26da 100644
--- a/resources/lang/ru/lang.php
+++ b/resources/lang/ru/lang.php
@@ -93,6 +93,7 @@ return [
'create_email' => 'Создать Email',
'email_address' => 'Email Address',
'email_name' => 'Email Name',
+ 'email_to' => 'Email to',
'help_topic' => 'Help Topic',
'auto_response' => 'Автоматический Ответ',
'host_name' => 'Host Name',
diff --git a/resources/views/themes/default1/admin/helpdesk/manage/workflow/create.blade.php b/resources/views/themes/default1/admin/helpdesk/manage/workflow/create.blade.php
index ed751cb86..77176b081 100644
--- a/resources/views/themes/default1/admin/helpdesk/manage/workflow/create.blade.php
+++ b/resources/views/themes/default1/admin/helpdesk/manage/workflow/create.blade.php
@@ -136,6 +136,7 @@ class="active"
+
diff --git a/resources/views/themes/default1/admin/helpdesk/manage/workflow/edit.blade.php b/resources/views/themes/default1/admin/helpdesk/manage/workflow/edit.blade.php
index ab94e6e04..ab3ee727e 100644
--- a/resources/views/themes/default1/admin/helpdesk/manage/workflow/edit.blade.php
+++ b/resources/views/themes/default1/admin/helpdesk/manage/workflow/edit.blade.php
@@ -179,6 +179,11 @@ class="active"
echo "selected='selected'";
}
?> >{!! Lang::get('lang.email_name') !!}
+