update 1.0.7

This commit is contained in:
Sujit Prasad
2016-04-19 19:19:42 +05:30
parent 723ef47e19
commit 5327b0c0da
153 changed files with 20711 additions and 1727 deletions

View File

@@ -3,7 +3,7 @@
namespace App\Http\Controllers\Client\helpdesk;
// controllers
use App\Http\Controllers\Agent\helpdesk\TicketController;
use App\Http\Controllers\Agent\helpdesk\TicketWorkflowController;
use App\Http\Controllers\Common\SettingsController;
use App\Http\Controllers\Controller;
// requests
@@ -14,6 +14,7 @@ use App\Model\helpdesk\Form\Fields;
use App\Model\helpdesk\Manage\Help_topic;
use App\Model\helpdesk\Settings\System;
use App\Model\helpdesk\Settings\Ticket;
use App\Model\helpdesk\Ticket\Ticket_attachments;
use App\Model\helpdesk\Ticket\Ticket_source;
use App\Model\helpdesk\Ticket\Ticket_Thread;
use App\Model\helpdesk\Ticket\Tickets;
@@ -39,12 +40,12 @@ class FormController extends Controller
*
* @return void
*/
public function __construct(TicketController $TicketController)
public function __construct(TicketWorkflowController $TicketWorkflowController)
{
// mail smtp settings
SettingsController::smtp();
// SettingsController::smtp();
// creating a TicketController instance
$this->TicketController = $TicketController;
$this->TicketWorkflowController = $TicketWorkflowController;
}
/**
@@ -129,7 +130,7 @@ class FormController extends Controller
* @param type Request $request
* @param type User $user
*/
public function postedForm(User $user, ClientRequest $request, Ticket $ticket_settings, Ticket_source $ticket_source)
public function postedForm(User $user, ClientRequest $request, Ticket $ticket_settings, Ticket_source $ticket_source, Ticket_attachments $ta)
{
$form_extras = $request->except('Name', 'Phone', 'Email', 'Subject', 'Details', 'helptopic', '_wysihtml5_mode', '_token');
@@ -147,13 +148,33 @@ class FormController extends Controller
$helptopic = $ticket_settings->first()->help_topic;
$sla = $ticket_settings->first()->sla;
$priority = $ticket_settings->first()->priority;
$source = $ticket_source->where('name', '=', 'web')->first();
$source = $ticket_source->where('name', '=', 'web')->first()->id;
$attachments = $request->file('attachment');
$collaborator = null;
$assignto = null;
$auto_response = 0;
if ($this->TicketController->create_user($email, $name, $subject, $details, $phone, $helptopic, $sla, $priority, $source->id, $collaborator, $department, $assignto, $form_extras, $auto_response)) {
return Redirect::route('guest.getform')->with('success', 'Ticket Created Successfully');
$team_assign = null;
$result = $this->TicketWorkflowController->workflow($email, $name, $subject, $details, $phone, $helptopic, $sla, $priority, $source, $collaborator, $department, $assignto, $team_assign, $status, $form_extras, $auto_response);
if ($result[1] == 1) {
$ticketId = Tickets::where('ticket_number', '=', $result[0])->first();
$thread = Ticket_Thread::where('ticket_id', '=', $ticketId->id)->first();
if ($attachments != null) {
foreach ($attachments as $attachment) {
if ($attachment != null) {
$name = $attachment->getClientOriginalName();
$type = $attachment->getClientOriginalExtension();
$size = $attachment->getSize();
$data = file_get_contents($attachment->getRealPath());
$attachPath = $attachment->getRealPath();
$ta->create(['thread_id' => $thread->id, 'name' => $name, 'size' => $size, 'type' => $type, 'file' => $data, 'poster' => 'ATTACHMENT']);
}
}
}
return Redirect::route('guest.getform')->with('success', 'Ticket has been created successfully, your ticket number is <b>'.$result[0].'</b> Please save this for future reference.');
}
}