Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Controllers/ConfigurationsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public function index()
'list_owner_notification', 'status_owner_notification', 'email.template', 'email.owner.newticket.template', 'email.account.name', 'email.account.mailbox', 'custom_recipients', ];
$tickets_section = ['default_priority_id', 'default_status_id', 'default_close_status_id', 'default_reopen_status_id',
'attachments_ticket_max_size', 'attachments_ticket_max_files_num', 'attachments_mimes',
'attachments_path', 'thumbnails_path', 'oldest_year', 'html_replacements', 'use_default_status_id', 'delete_modal_type', 'embedded_image_prefix'];
'attachments_path', 'thumbnails_path', 'oldest_year', 'html_replacements', 'use_default_status_id', 'delete_modal_type', 'embedded_image_prefix', ];
$perms_section = ['agent_restrict', 'close_ticket_perm', 'reopen_ticket_perm'];
$editor_section = ['editor_enabled', 'editor_html_highlighter', 'codemirror_theme',
'summernote_locale', 'summernote_options_json_file', 'summernote_options_user', 'purifier_config', ];
Expand Down
4 changes: 2 additions & 2 deletions src/Controllers/TicketsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,13 +176,13 @@ public function getTicketCollectionFrom($ticketList)
});
}

if (isset($search_fields['attachment_text'])){
if (isset($search_fields['attachment_text'])) {
$collection->whereIn('panichd_tickets.id', $this->listTicketsWhereAttachmentHas($search_fields['attachment_text']));
}

if (isset($search_fields['any_text_field'])) {
$a_attachment_tickets = $this->listTicketsWhereAttachmentHas($search_fields['any_text_field']);

// Coincidence in any ticket field
$collection->where(function ($query) use ($search_fields, $a_attachment_tickets) {
$query->where('subject', 'like', '%'.$search_fields['any_text_field'].'%')
Expand Down
4 changes: 1 addition & 3 deletions src/PanicHDServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,10 +189,8 @@ public function boot()
// $editor_options = $user_editor != "0" ? $user_editor : file_get_contents(base_path(Setting::grab('summernote_options_json_file')));
if ($user_editor != '0') {
$editor_options = $user_editor;

}elseif (Setting::grab('summernote_options_json_file') != 'default' and file_exists(base_path(Setting::grab('summernote_options_json_file')))) {
} elseif (Setting::grab('summernote_options_json_file') != 'default' and file_exists(base_path(Setting::grab('summernote_options_json_file')))) {
$editor_options = file_get_contents(base_path(Setting::grab('summernote_options_json_file')));

} else {
$editor_options = file_get_contents(realpath(__DIR__).'/JSON/summernote_init.json');
}
Expand Down
2 changes: 1 addition & 1 deletion src/Seeds/DemoDataSeeder.php
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ public function run()
$this->comments_per_ticket_max
);

if ($comments_qty){
if ($comments_qty) {
for ($c = 1; $c <= $comments_qty; $c++) {
if (is_null($ticket->completed_at)) {
$random_comment_date = $faker->dateTimeBetween(
Expand Down
2 changes: 1 addition & 1 deletion src/Seeds/SettingsTableSeeder.php
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ public function getDefaults()
/*
* Prefix for embedded images: Embedded images in text fields with resolutions above specified limit
* get transformed in an attachment with an image thumbnail. That attachment name is
* formed by this field value and an automatic number
* formed by this field value and an automatic number
* Default: embedded_image
*/
'embedded_image_prefix' => 'image',
Expand Down
19 changes: 9 additions & 10 deletions src/Traits/Attachments.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ protected function createAttachmentsFrom($html, $ticket, $comment = false, $coun
$node->setAttribute('class', 'summernote_embedded_image');
} else {
// Create filename
$original_filename = Setting::grab('embedded_image_prefix') . '_' . ($i + $count).'.png';
$original_filename = Setting::grab('embedded_image_prefix').'_'.($i + $count).'.png';

$file_name = $this->makeFilename($original_filename.date('YmdHis', time()), $ticket->id.'_embedded', '');

Expand Down Expand Up @@ -613,23 +613,22 @@ protected function deleteThumbnail($file_name)
/*
* Search a string in all attachment fields
* Return ticket id's that contain the found attachments
*
*
* @return Array
*/
public function listTicketsWhereAttachmentHas($needle)
{
// Coincidence in Ticket / Comment attachments
$attachments_col = Attachment::where('original_filename', 'like', '%' . $needle . '%')
->orWhere('new_filename', 'like', '%' . $needle . '%')
->orWhere('description', 'like', '%' . $needle . '%')
$attachments_col = Attachment::where('original_filename', 'like', '%'.$needle.'%')
->orWhere('new_filename', 'like', '%'.$needle.'%')
->orWhere('description', 'like', '%'.$needle.'%')
->with('ticket', 'comment.ticket')->get();

$a_ticket_ids = [];
foreach ($attachments_col as $att){
if (!is_null($att->ticket)){
foreach ($attachments_col as $att) {
if (!is_null($att->ticket)) {
$a_ticket_ids[] = $att->ticket->id;

}elseif (!is_null($att->comment) and !is_null($att->comment->ticket)){
} elseif (!is_null($att->comment) and !is_null($att->comment->ticket)) {
$a_ticket_ids[] = $att->comment->ticket->id;
}
}
Expand Down
3 changes: 1 addition & 2 deletions src/Translations/es/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,7 @@

<p>Opciones: <code>modal</code>, <code>integrada</code></p>
ENDHTML
, 'embedded_image_prefix' => 'Las imágenes incrustadas con resolución por encima del límite son transformadas en un fichero adjunto que tiene de nombre este prefijo con una numeración automática',

, 'embedded_image_prefix' => 'Las imágenes incrustadas con resolución por encima del límite son transformadas en un fichero adjunto que tiene de nombre este prefijo con una numeración automática',

/* ------------------ JS EDITOR ------------------ */, 'editor_enabled' => <<<'ENDHTML'
<p>Activar editor summernote en áreas de texto</p>
Expand Down
2 changes: 1 addition & 1 deletion src/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
'parameters' => [
$field_name => 'ticket_comment',
],
]);
]);

//Ticket complete route for permitted user.
Route::patch("$main_route_path/{id}/complete", 'PanicHD\PanicHD\Controllers\TicketsController@complete')
Expand Down