This commit is contained in:
Vijay Sebastian
2017-01-27 11:59:52 +05:30
parent 1995c6f22f
commit ea545fd08c
2 changed files with 110 additions and 109 deletions

View File

@@ -35,16 +35,15 @@ use Redirect;
* *
* @author Ladybird <info@ladybirdweb.com> * @author Ladybird <info@ladybirdweb.com>
*/ */
class FormController extends Controller class FormController extends Controller {
{
/** /**
* Create a new controller instance. * Create a new controller instance.
* Constructor to check. * Constructor to check.
* *
* @return void * @return void
*/ */
public function __construct(TicketWorkflowController $TicketWorkflowController) public function __construct(TicketWorkflowController $TicketWorkflowController) {
{
$this->middleware('board'); $this->middleware('board');
// creating a TicketController instance // creating a TicketController instance
$this->TicketWorkflowController = $TicketWorkflowController; $this->TicketWorkflowController = $TicketWorkflowController;
@@ -57,8 +56,7 @@ class FormController extends Controller
* *
* @return type * @return type
*/ */
public function getForm(Help_topic $topic, CountryCode $code) public function getForm(Help_topic $topic, CountryCode $code) {
{
if (\Config::get('database.install') == '%0%') { if (\Config::get('database.install') == '%0%') {
return \Redirect::route('licence'); return \Redirect::route('licence');
} }
@@ -92,13 +90,13 @@ class FormController extends Controller
* *
* @return type string * @return type string
*/ */
public function postForm($id, Help_topic $topic) public function postForm($id, Help_topic $topic) {
{
if ($id != 0) { if ($id != 0) {
$helptopic = $topic->where('id', '=', $id)->first(); $helptopic = $topic->where('id', '=', $id)->first();
$custom_form = $helptopic->custom_form; $custom_form = $helptopic->custom_form;
$values = Fields::where('forms_id', '=', $custom_form)->get(); $values = Fields::where('forms_id', '=', $custom_form)->get();
if (!$values) { if (!$values) {
} }
if ($values) { if ($values) {
foreach ($values as $form_data) { foreach ($values as $form_data) {
@@ -144,9 +142,9 @@ class FormController extends Controller
* @param type Request $request * @param type Request $request
* @param type User $user * @param type User $user
*/ */
public function postedForm(User $user, ClientRequest $request, Ticket $ticket_settings, Ticket_source $ticket_source, Ticket_attachments $ta, CountryCode $code) public function postedForm(User $user, ClientRequest $request, Ticket $ticket_settings, Ticket_source $ticket_source, Ticket_attachments $ta, CountryCode $code) {
{ try {
$form_extras = $request->except('Name', 'Phone', 'Email', 'Subject', 'Details', 'helptopic', '_wysihtml5_mode', '_token', 'mobile', 'Code', 'priority'); $form_extras = $request->except('Name', 'Phone', 'Email', 'Subject', 'Details', 'helptopic', '_wysihtml5_mode', '_token', 'mobile', 'Code', 'priority', 'attachment');
$name = $request->input('Name'); $name = $request->input('Name');
$phone = $request->input('Phone'); $phone = $request->input('Phone');
if ($request->input('Email')) { if ($request->input('Email')) {
@@ -221,6 +219,7 @@ class FormController extends Controller
} }
} }
} }
\Event::fire(new \App\Events\ClientTicketFormPost($form_extras, $email, $source));
$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); $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);
// dd($result); // dd($result);
if ($result[1] == 1) { if ($result[1] == 1) {
@@ -243,6 +242,9 @@ class FormController extends Controller
} else { } else {
return Redirect::back()->withInput($request->except('password'))->with('fails', Lang::get('lang.failed-to-create-user-tcket-as-mobile-has-been-taken')); return Redirect::back()->withInput($request->except('password'))->with('fails', Lang::get('lang.failed-to-create-user-tcket-as-mobile-has-been-taken'));
} }
} catch (\Exception $ex) {
return redirect()->back()->with('fails', $ex->getMessage());
}
// dd($result); // dd($result);
} }
@@ -253,8 +255,7 @@ class FormController extends Controller
* *
* @return type view * @return type view
*/ */
public function post_ticket_reply($id, Request $request) public function post_ticket_reply($id, Request $request) {
{
try { try {
if ($comment != null) { if ($comment != null) {
$tickets = Tickets::where('id', '=', $id)->first(); $tickets = Tickets::where('id', '=', $id)->first();
@@ -294,8 +295,7 @@ class FormController extends Controller
} }
} }
public function getCustomForm(Request $request) public function getCustomForm(Request $request) {
{
$html = ''; $html = '';
$helptopic_id = $request->input('helptopic'); $helptopic_id = $request->input('helptopic');
$helptopics = new Help_topic(); $helptopics = new Help_topic();
@@ -313,4 +313,5 @@ class FormController extends Controller
return $html; return $html;
} }
} }

View File

@@ -406,7 +406,7 @@ class SettingsController extends Controller
$app = base_path().DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'app.php'; $app = base_path().DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'app.php';
chmod($app, 0644); chmod($app, 0644);
$str = "\n\n\t\t\t'App\\Plugins\\$filename"."\\ServiceProvider',"; $str = "\n\n\t\t\t'App\\Plugins\\$filename"."\\ServiceProvider',";
$line_i_am_looking_for = 194; $line_i_am_looking_for = 185;
$lines = file($app, FILE_IGNORE_NEW_LINES); $lines = file($app, FILE_IGNORE_NEW_LINES);
$lines[$line_i_am_looking_for] = $str; $lines[$line_i_am_looking_for] = $str;
file_put_contents($app, implode("\n", $lines)); file_put_contents($app, implode("\n", $lines));
@@ -578,7 +578,7 @@ class SettingsController extends Controller
if (!$plug) { if (!$plug) {
$app = base_path().DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'app.php'; $app = base_path().DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'app.php';
$str = "\n'App\\Plugins\\$slug"."\\ServiceProvider',"; $str = "\n'App\\Plugins\\$slug"."\\ServiceProvider',";
$line_i_am_looking_for = 194; $line_i_am_looking_for = 185;
$lines = file($app, FILE_IGNORE_NEW_LINES); $lines = file($app, FILE_IGNORE_NEW_LINES);
$lines[$line_i_am_looking_for] = $str; $lines[$line_i_am_looking_for] = $str;
file_put_contents($app, implode("\n", $lines)); file_put_contents($app, implode("\n", $lines));
@@ -592,7 +592,7 @@ class SettingsController extends Controller
$app = base_path().DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'app.php'; $app = base_path().DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'app.php';
$str = "\n'App\\Plugins\\$slug"."\\ServiceProvider',"; $str = "\n'App\\Plugins\\$slug"."\\ServiceProvider',";
$line_i_am_looking_for = 194; $line_i_am_looking_for = 185;
$lines = file($app, FILE_IGNORE_NEW_LINES); $lines = file($app, FILE_IGNORE_NEW_LINES);
$lines[$line_i_am_looking_for] = $str; $lines[$line_i_am_looking_for] = $str;
file_put_contents($app, implode("\n", $lines)); file_put_contents($app, implode("\n", $lines));