Existing bugs commits squashed

validation-bugsnag-email

auto-update

datatables

adding-engine

backup

fixes

Apply fixes from StyleCI

duedate fixes

Apply fixes from StyleCI

style-changes

changes

Apply fixes from StyleCI

changes-n

Apply fixes from StyleCI

manual-update

database:sync

issues

bugfixes

mail

Apply fixes from StyleCI

Apply fixes from StyleCI
This commit is contained in:
RafficMohammed
2023-01-31 13:17:59 +05:30
committed by RafficMohammed
parent 2ae90d7fcb
commit 0654723809
10 changed files with 149 additions and 77 deletions

View File

@@ -36,6 +36,7 @@ use App\Model\helpdesk\Utility\Date_time_format;
use App\Model\helpdesk\Utility\Timezones; use App\Model\helpdesk\Utility\Timezones;
use App\User; use App\User;
use Auth; use Auth;
use Carbon\Carbon;
use Chumper\Datatable\Facades\DatatableFacade; use Chumper\Datatable\Facades\DatatableFacade;
use Crypt; use Crypt;
use DB; use DB;
@@ -162,7 +163,7 @@ class TicketController extends Controller
} }
} }
//create user //create user
$result = $this->create_user($email, $fullname, $subject, $body, $phone, $phonecode, $mobile_number, $helptopic, $sla, $priority, $source->id, $headers, $help->department, $assignto, $form_data, $auto_response, $status); $result = $this->create_user($email, $fullname, $subject, $body, $phone, $phonecode, $mobile_number, $helptopic, $sla, $priority, $source->id, $headers, $help->department, $assignto, $form_data, $auto_response, $status, $duedate);
if ($result[1]) { if ($result[1]) {
$status = $this->checkUserVerificationStatus(); $status = $this->checkUserVerificationStatus();
if ($status == 1) { if ($status == 1) {
@@ -630,7 +631,7 @@ class TicketController extends Controller
* *
* @return type bool * @return type bool
*/ */
public function create_user($emailadd, $username, $subject, $body, $phone, $phonecode, $mobile_number, $helptopic, $sla, $priority, $source, $headers, $dept, $assignto, $from_data, $auto_response, $status) public function create_user($emailadd, $username, $subject, $body, $phone, $phonecode, $mobile_number, $helptopic, $sla, $priority, $source, $headers, $dept, $assignto, $from_data, $auto_response, $status, $duedate = null)
{ {
// define global variables // define global variables
@@ -714,7 +715,7 @@ class TicketController extends Controller
$user_id = $checkemail->id; $user_id = $checkemail->id;
} }
event(new \App\Events\ClientTicketFormPost($from_data, $emailadd, $source)); event(new \App\Events\ClientTicketFormPost($from_data, $emailadd, $source));
$ticket_number = $this->check_ticket($user_id, $subject, $body, $helptopic, $sla, $priority, $source, $headers, $dept, $assignto, $from_data, $status); $ticket_number = $this->check_ticket($user_id, $subject, $body, $helptopic, $sla, $priority, $source, $headers, $dept, $assignto, $from_data, $status, $duedate);
$ticket_number2 = $ticket_number[0]; $ticket_number2 = $ticket_number[0];
$ticketdata = Tickets::where('ticket_number', '=', $ticket_number2)->first(); $ticketdata = Tickets::where('ticket_number', '=', $ticket_number2)->first();
@@ -912,7 +913,7 @@ class TicketController extends Controller
* *
* @return type string * @return type string
*/ */
public function check_ticket($user_id, $subject, $body, $helptopic, $sla, $priority, $source, $headers, $dept, $assignto, $form_data, $status) public function check_ticket($user_id, $subject, $body, $helptopic, $sla, $priority, $source, $headers, $dept, $assignto, $form_data, $status, $duedate = null)
{ {
$read_ticket_number = explode('[#', $subject); $read_ticket_number = explode('[#', $subject);
if (isset($read_ticket_number[1])) { if (isset($read_ticket_number[1])) {
@@ -965,12 +966,12 @@ class TicketController extends Controller
} }
} }
} else { } else {
$ticket_number = $this->createTicket($user_id, $subject, $body, $helptopic, $sla, $priority, $source, $headers, $dept, $assignto, $form_data, $status); $ticket_number = $this->createTicket($user_id, $subject, $body, $helptopic, $sla, $priority, $source, $headers, $dept, $assignto, $form_data, $status, $duedate);
return [$ticket_number, 0]; return [$ticket_number, 0];
} }
} else { } else {
$ticket_number = $this->createTicket($user_id, $subject, $body, $helptopic, $sla, $priority, $source, $headers, $dept, $assignto, $form_data, $status); $ticket_number = $this->createTicket($user_id, $subject, $body, $helptopic, $sla, $priority, $source, $headers, $dept, $assignto, $form_data, $status, $duedate);
return [$ticket_number, 0]; return [$ticket_number, 0];
} }
@@ -988,7 +989,7 @@ class TicketController extends Controller
* *
* @return type string * @return type string
*/ */
public function createTicket($user_id, $subject, $body, $helptopic, $sla, $priority, $source, $headers, $dept, $assignto, $form_data, $status) public function createTicket($user_id, $subject, $body, $helptopic, $sla, $priority, $source, $headers, $dept, $assignto, $form_data, $status, $duedate = null)
{ {
$ticket_number = ''; $ticket_number = '';
$max_number = Tickets::whereRaw('id = (select max(`id`) from tickets)')->first(); $max_number = Tickets::whereRaw('id = (select max(`id`) from tickets)')->first();
@@ -1036,9 +1037,21 @@ class TicketController extends Controller
$ticket->save(); $ticket->save();
$sla_plan = Sla_plan::where('id', '=', $sla)->first(); $sla_plan = Sla_plan::where('id', '=', $sla)->first();
if ($duedate) {
$duedate_datetime = Carbon::createFromFormat('d/m/Y', $duedate);
$grace_period = $sla_plan->grace_period;
$grace_interval = \DateInterval::createFromDateString($grace_period);
$duedate_datetime->add($grace_interval);
// Format the due date with time
$due_formatted = $duedate_datetime->format('Y-m-d H:i:s');
$ticket->duedate = $due_formatted;
} else {
$ovdate = $ticket->created_at; $ovdate = $ticket->created_at;
$new_date = date_add($ovdate, date_interval_create_from_date_string($sla_plan->grace_period)); $new_date = date_add($ovdate, date_interval_create_from_date_string($sla_plan->grace_period));
$ticket->duedate = $new_date; $ticket->duedate = $new_date;
}
$ticket->save(); $ticket->save();
$ticket_number = $ticket->ticket_number; $ticket_number = $ticket->ticket_number;
@@ -2344,13 +2357,20 @@ class TicketController extends Controller
{ {
$ticketid = $request->input('ticketid'); $ticketid = $request->input('ticketid');
$ticket = Tickets::find($ticketid); $ticket = Tickets::find($ticketid);
$firstThread = $ticket->thread()->select('user_id', 'poster', 'body')->first(); if ($ticket) {
$lastThread = $ticket->thread()->select('user_id', 'poster', 'body')->orderBy('id', 'desc')->first(); $threads = $ticket->thread()->select('user_id', 'poster', 'body')->get();
$numThreads = $threads->count();
$tooltip = '';
return '<b>'.$firstThread->user->user_name.' ('.$firstThread->poster.')</b></br>' foreach ($threads as $thread) {
.$firstThread->purify().'<br><hr>' $tooltip .= '<b>'.$thread->user->user_name.' ('.$thread->poster.')</b></br>'
.'<b>'.$lastThread->user->user_name.'('.$lastThread->poster.')</b>' .$thread->purify().'<br><hr>';
.$lastThread->purify().'<br><hr>'; }
$tooltip .= 'This ticket has '.$numThreads.' threads.';
return $tooltip;
}
} }
//Auto-close tickets //Auto-close tickets

View File

@@ -84,14 +84,14 @@ return [
'array' => 'The :attribute must not have more than :value items.', 'array' => 'The :attribute must not have more than :value items.',
'file' => 'The :attribute must be less than or equal to :value kilobytes.', 'file' => 'The :attribute must be less than or equal to :value kilobytes.',
'numeric' => 'The :attribute must be less than or equal to :value.', 'numeric' => 'The :attribute must be less than or equal to :value.',
'string' => 'The :attribute must be less than or equal to :value characters.', 'string' => 'The :attribute must not be greater than :max characters.',
], ],
'mac_address' => 'The :attribute must be a valid MAC address.', 'mac_address' => 'The :attribute must be a valid MAC address.',
'max' => [ 'max' => [
'array' => 'The :attribute must not have more than :max items.', 'array' => 'The :attribute must not have more than :max items.',
'file' => 'The :attribute must not be greater than :max kilobytes.', 'file' => 'The :attribute must not be greater than :max kilobytes.',
'numeric' => 'The :attribute must not be greater than :max.', 'numeric' => 'The :attribute must not be greater than :max.',
'string' => 'The :attribute must not be greater than :max characters.', 'string' => 'The ISO-CODE is invalid',
], ],
'max_digits' => 'The :attribute must not have more than :max digits.', 'max_digits' => 'The :attribute must not have more than :max digits.',
'mimes' => 'The :attribute must be a file of type: :values.', 'mimes' => 'The :attribute must be a file of type: :values.',

View File

@@ -69,7 +69,7 @@ $bootstrapPermission = substr(sprintf('%o', fileperms($basePath.DIRECTORY_SEPARA
?> ?>
<td style='color:green'><?= $storagePermission; ?></td> <td style='color:green'><?= $storagePermission; ?></td>
<?php <?php
} else { } else {
?> ?>
<td style='color:red'><?= $storagePermission; ?>&nbsp; (Directory should be writable by your web server or Faveo will not run. Give preferred permissions as 755 for directory and 644 for files.)</td> <td style='color:red'><?= $storagePermission; ?>&nbsp; (Directory should be writable by your web server or Faveo will not run. Give preferred permissions as 755 for directory and 644 for files.)</td>
<?php <?php
@@ -106,7 +106,7 @@ $bootstrapPermission = substr(sprintf('%o', fileperms($basePath.DIRECTORY_SEPARA
} }
echo '</tr>'; echo '</tr>';
} }
?> ?>
</table> </table>
<br/> <br/>
<table class="t01"> <table class="t01">
@@ -116,29 +116,29 @@ $bootstrapPermission = substr(sprintf('%o', fileperms($basePath.DIRECTORY_SEPARA
</tr> </tr>
<?php <?php
echo '<tr>'; echo '<tr>';
if (version_compare(phpversion(), '7.1') == -1 || version_compare('7.1.50', phpversion()) == -1) { if (version_compare(phpversion(), '7.1') == -1 || version_compare('7.1.50', phpversion()) == -1) {
echo "<td>PHP Version</td> <td style='color:red'>".phpversion().'<p>Recommended PHP version 7.1</p></td>'; echo "<td>PHP Version</td> <td style='color:red'>".phpversion().'<p>Recommended PHP version 7.1</p></td>';
} else { } else {
echo "<td>PHP Version</td> <td style='color:green'>".phpversion().'</td>'; echo "<td>PHP Version</td> <td style='color:green'>".phpversion().'</td>';
} }
echo '</tr>'; echo '</tr>';
echo '<tr>'; echo '<tr>';
$env = '../.env'; $env = '../.env';
if (!is_file($env)) { if (!is_file($env)) {
echo "<td>.env file</td> <td style='color:green'>Not found</td>"; echo "<td>.env file</td> <td style='color:green'>Not found</td>";
} else { } else {
echo "<td>.env file</td> <td style='color:red'>Yes Found<p>Please delete '$env' </p></td>"; echo "<td>.env file</td> <td style='color:red'>Yes Found<p>Please delete '$env' </p></td>";
} }
echo '</tr>'; echo '</tr>';
echo '<tr>'; echo '<tr>';
$redirect = in_array('mod_rewrite', apache_get_modules()); $redirect = in_array('mod_rewrite', apache_get_modules());
if ($redirect) { if ($redirect) {
echo "<td>Rewrite Engine (User friendly URL)</td> <td style='color:green'>ON</td>"; echo "<td>Rewrite Engine (User friendly URL)</td> <td style='color:green'>ON</td>";
} else { } else {
echo "<td>Rewrite Engine (User friendly URL)</td> <td style='color:red'>OFF</td>"; echo "<td>Rewrite Engine (User friendly URL)</td> <td style='color:red'>OFF</td>";
} }
echo '</tr>'; echo '</tr>';
?> ?>
</table> </table>
<p style='color:red;'>NOTE: Please delete the file 'probe.php' once you have fixed all the issues.</p> <p style='color:red;'>NOTE: Please delete the file 'probe.php' once you have fixed all the issues.</p>
</div> </div>

View File

@@ -51,7 +51,7 @@
<div class="alert alert-dismissable" style="background: #F3F3F3"> <div class="alert alert-dismissable" style="background: #F3F3F3">
<i class="fas fa-info-circle"></i>&nbsp;{!!Lang::get('lang.crone-url-message')!!} <i class="fas fa-info-circle"></i>&nbsp;{!!Lang::get('lang.crone-url-message')!!}
<a href="https://www.support.faveohelpdesk.com/show/cron-job-scheduling" style="color:black" target="blank">{!!Lang::get('lang.click')!!}</a> {!!Lang::get('lang.check-cron-set')!!} <a href="https://support.faveohelpdesk.com/show/how-to-configure-cron-jobs-in-faveo" style="color:black" target="blank">{!!Lang::get('lang.click')!!}</a> {!!Lang::get('lang.check-cron-set')!!}
</div> </div>
<div class="row"> <div class="row">

View File

@@ -15,12 +15,22 @@ class="nav-link active"
@section('ticket') @section('ticket')
class="active" class="active"
@stop @stop
<style>
.clear-input {
position: absolute;
top: 20%;
right: 5%;
bottom: 0;
width: 30px;
margin: auto;
}
</style>
@section('PageHeader') @section('PageHeader')
<h1>{{Lang::get('lang.tickets')}}</h1> <h1>{{Lang::get('lang.tickets')}}</h1>
@stop @stop
@section('content') @section('content')
<!-- Main content --> <!-- Main content -->
{!! Form::open(['route'=>'post.newticket','method'=>'post','id'=>'form']) !!} {!! Form::open(['route'=>'post.newticket','method'=>'post','id'=>'form']) !!}
@if(Session::has('success')) @if(Session::has('success'))
@@ -191,6 +201,7 @@ class="active"
<div class="form-group" id="duedate"> <div class="form-group" id="duedate">
<label>{!! Lang::get('lang.due_date') !!}:</label> <label>{!! Lang::get('lang.due_date') !!}:</label>
{!! Form::text('duedate',null,['class' => 'form-control','id'=>'datemask']) !!} {!! Form::text('duedate',null,['class' => 'form-control','id'=>'datemask']) !!}
<button class="btn clear-input" id="duedates" style="display: none" type="button"><i class="fas fa-times"></i></button>
</div> </div>
</div> </div>
<div class="col-md-3"> <div class="col-md-3">
@@ -352,11 +363,25 @@ class="active"
}); });
$(function () { $(function () {
$('#datemask').datetimepicker({ var picker = $('#datemask').datetimepicker({
format: 'DD/MM/YYYY' format: 'DD/MM/YYYY',
});
picker.on('dp.change', function(e) {
if (e.date) {
$('.clear-input').show();
} else {
$('.clear-input').hide();
}
});
$('.clear-input').click(function() {
$('#datemask').val('');
$('.clear-input').hide();
}); });
}); });
</script> </script>
@stop @stop

View File

@@ -222,10 +222,12 @@ if ($thread->title != "") {
<div class="col-md-3"> <div class="col-md-3">
<b>{!! Lang::get('lang.due_date') !!}: </b> <b>{!! Lang::get('lang.due_date') !!}: </b>
<?php <?php
$time = $tickets->created_at; $duedate = $tickets->duedate;
$time = date_create($time); $user_timezone = new DateTimeZone('Asia/Kolkata');
$time = date_create($tickets->duedate, $user_timezone);
date_add($time, date_interval_create_from_date_string($SlaPlan->grace_period)); date_add($time, date_interval_create_from_date_string($SlaPlan->grace_period));
echo UTC::usertimezone(date_format($time, 'Y-m-d H:i:s')); date_add($time, date_interval_create_from_date_string('30 minutes'));
echo $time->format('Y-m-d H:i:s');
?> ?>
</div> </div>
<div class="col-md-3"> <div class="col-md-3">
@@ -885,6 +887,12 @@ if ($thread->title != "") {
<div id="show" style="display:none;text-align: center;"> <div id="show" style="display:none;text-align: center;">
<img src="{{asset("lb-faveo/media/images/gifloader.gif")}}"> <img src="{{asset("lb-faveo/media/images/gifloader.gif")}}">
</div> </div>
<script>
$('#Edit').on('hidden.bs.modal', function (e) {
$(this).find('form')[0].reset();
});
</script>
<div class="modal-footer justify-content-between"> <div class="modal-footer justify-content-between">
<button type="button" class="btn btn-default" data-dismiss="modal" id="dismis">{!! Lang::get('lang.close') !!}</button> <button type="button" class="btn btn-default" data-dismiss="modal" id="dismis">{!! Lang::get('lang.close') !!}</button>
<input type="submit" class="btn btn-primary" value="{!! Lang::get('lang.update') !!}"> <input type="submit" class="btn btn-primary" value="{!! Lang::get('lang.update') !!}">

View File

@@ -588,13 +588,13 @@ class="nav-link active"
<div class="col-md-6"> <div class="col-md-6">
<div class="form-group"> <div class="form-group">
<label>{!! Lang::get('lang.address') !!}</label> <label>{!! Lang::get('lang.address') !!}</label>
<textarea name="address" class="form-control"></textarea> <textarea name="address" id="address" class="form-control"></textarea>
</div> </div>
</div> </div>
<div class="col-md-6"> <div class="col-md-6">
<div class="form-group"> <div class="form-group">
<label>{!! Lang::get('lang.internal_notes') !!}</label> <label>{!! Lang::get('lang.internal_notes') !!}</label>
<textarea name="internal" class="form-control"></textarea> <textarea name="internal" id="internal" class="form-control"></textarea>
</div> </div>
</div> </div>
</div> </div>
@@ -617,6 +617,15 @@ class="nav-link active"
{!! Form::close() !!} {!! Form::close() !!}
</div><!-- /.modal-content --> </div><!-- /.modal-content -->
</div><!-- /.modal-dialog --> </div><!-- /.modal-dialog -->
<script>
$('#create_org').on('hidden.bs.modal', function (e) {
$(this).find('form')[0].reset();
$('#address').summernote('reset');
$('#internal').summernote('reset');
});
</script>
</div><!-- /.modal --> </div><!-- /.modal -->
<script type="text/javascript"> <script type="text/javascript">
jQuery(document).ready(function($) { jQuery(document).ready(function($) {
@@ -696,6 +705,13 @@ class="nav-link active"
<button type="button" class="btn btn-default" data-dismiss="modal" id="dismis4">{!! Lang::get('lang.close') !!}</button> <button type="button" class="btn btn-default" data-dismiss="modal" id="dismis4">{!! Lang::get('lang.close') !!}</button>
<button type="submit" class="btn btn-success" id="submt2">{!! Lang::get('lang.assign') !!}</button> <button type="submit" class="btn btn-success" id="submt2">{!! Lang::get('lang.assign') !!}</button>
</div> </div>
<script>
$('#assign').on('hidden.bs.modal', function (e) {
$(this).find('form')[0].reset();
});
</script>
{!! Form::close()!!} {!! Form::close()!!}
</div><!-- /.modal-content --> </div><!-- /.modal-content -->
</div><!-- /.modal-dialog --> </div><!-- /.modal-dialog -->

View File

@@ -60,7 +60,7 @@ class="nav-link active"
<div class="row"> <div class="row">
<div class="col-md-3"> <div class="col-md-3">
{!! Form::label('pagination',Lang::get('lang.numberofelementstodisplay')) !!} <span class="text-red"> *</span> {!! Form::label('pagination',Lang::get('lang.numberofelementstodisplay')) !!} <span class="text-red"> *</span>
<input type="number" class="form-control" name='pagination' value="{!! $settings->pagination !!}" min="2"> <input type="number" class="form-control" name='pagination' value="{!! $settings->pagination !!}" min="2" required>
</div> </div>
</div> </div>
</div> </div>

View File

@@ -3,6 +3,7 @@
namespace Chumper\Zipper\Repositories; namespace Chumper\Zipper\Repositories;
use Exception; use Exception;
use Illuminate\Support\Str;
use ZipArchive; use ZipArchive;
class ZipRepository implements RepositoryInterface class ZipRepository implements RepositoryInterface
@@ -114,10 +115,12 @@ class ZipRepository implements RepositoryInterface
if ($stats['size'] === 0 && $stats['crc'] === 0) { if ($stats['size'] === 0 && $stats['crc'] === 0) {
continue; continue;
} }
call_user_func_array($callback, [ $file = $this->archive->getNameIndex($i);
'file' => $this->archive->getNameIndex($i), $stats = $this->archive->statIndex($i);
'stats' => $this->archive->statIndex($i) if (Str::startsWith($file, 'some_prefix')) {
]); $callback($file, $stats);
}
} }
} }