Skip to content

Commit

Permalink
Merge branch 'master' of github.com:freescout-helpdesk/freescout into…
Browse files Browse the repository at this point in the history
… dist
  • Loading branch information
freescout-help-desk committed Nov 7, 2023
2 parents c28b663 + 5aa7552 commit 4c9f247
Show file tree
Hide file tree
Showing 6 changed files with 1,237 additions and 8 deletions.
7 changes: 6 additions & 1 deletion app/Http/Controllers/ConversationsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2821,14 +2821,19 @@ public function searchCustomers($request, $user)
->orWhere('customers.last_name', $like_op, $like)
->orWhere('customers.company', $like_op, $like)
->orWhere('customers.job_title', $like_op, $like)
->orWhere('customers.phones', $like_op, '%"'.\Helper::phoneToNumeric($q).'"%')
->orWhere('customers.websites', $like_op, $like)
->orWhere('customers.social_profiles', $like_op, $like)
->orWhere('customers.address', $like_op, $like)
->orWhere('customers.city', $like_op, $like)
->orWhere('customers.state', $like_op, $like)
->orWhere('customers.zip', $like_op, $like)
->orWhere('emails.email', $like_op, $like);

$phone_numeric = \Helper::phoneToNumeric($q);

if ($phone_numeric) {
$query->orWhere('customers.phones', $like_op, '%"'.$phone_numeric.'"%');
}
});

if (!empty($filters['mailbox']) && in_array($filters['mailbox'], $mailbox_ids)) {
Expand Down
11 changes: 9 additions & 2 deletions app/Jobs/SendReplyToCustomer.php
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,9 @@ public function handle()
}

try {
// https://github.com/freescout-helpdesk/freescout/issues/3502
$imap_sent_folder = mb_convert_encoding($imap_sent_folder, "UTF7-IMAP","UTF-8");

// https://github.com/Webklex/php-imap/issues/380
if (method_exists($client, 'getFolderByPath')) {
$folder = $client->getFolderByPath($imap_sent_folder);
Expand All @@ -431,18 +434,22 @@ public function handle()
if ($folder) {
try {
$save_result = $this->saveEmailToFolder($client, $folder, $envelope, $parts, $bcc_array);

// Sometimes emails with attachments by some reason are not saved.
// https://github.com/freescout-helpdesk/freescout/issues/2749
if (!$save_result) {
// Save without attachments.
$this->saveEmailToFolder($client, $folder, $envelope, [$part_body], $bcc_array);
$save_result = $this->saveEmailToFolder($client, $folder, $envelope, [$part_body], $bcc_array);
if (!$save_result) {
\Log::error('Could not save outgoing reply to the IMAP folder (check folder name and make sure IMAP folder does not have spaces - folders with spaces do not work): '.$imap_sent_folder);
}
}
} catch (\Exception $e) {
// Just log error and continue.
\Helper::logException($e, 'Could not save outgoing reply to the IMAP folder: ');
}
} else {
\Log::error('Could not save outgoing reply to the IMAP folder (make sure IMAP folder does not have spaces - folders with spaces do not work): '.$imap_sent_folder);
\Log::error('Could not save outgoing reply to the IMAP folder (check folder name and make sure IMAP folder does not have spaces - folders with spaces do not work): '.$imap_sent_folder);
}
} catch (\Exception $e) {
// Just log error and continue.
Expand Down
3 changes: 3 additions & 0 deletions app/Misc/Mail.php
Original file line number Diff line number Diff line change
Expand Up @@ -896,6 +896,9 @@ public static function prepareMailable($mailable)

public static function getImapFolder($client, $folder_name)
{
// https://github.com/freescout-helpdesk/freescout/issues/3502
$folder_name = mb_convert_encoding($folder_name, "UTF7-IMAP","UTF-8");

if (method_exists($client, 'getFolderByPath')) {
return $client->getFolderByPath($folder_name);
} else {
Expand Down
8 changes: 4 additions & 4 deletions app/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -1212,18 +1212,18 @@ public static function getRobotsCondition()
// https://github.com/freescout-helpdesk/freescout/issues/3489
public function setFirstNameAttribute($first_name)
{
$this->attributes['first_name'] = mb_substr($first_name, 0, 20);
$this->attributes['first_name'] = mb_substr($first_name ?? '', 0, 20);
}
public function setLastNameAttribute($last_name)
{
$this->attributes['last_name'] = mb_substr($last_name, 0, 30);
$this->attributes['last_name'] = mb_substr($last_name ?? '', 0, 30);
}
public function setEmailAttribute($email)
{
$this->attributes['email'] = mb_substr($email, 0, 100);
$this->attributes['email'] = mb_substr($email ?? '', 0, 100);
}
public function setJobTitleAttribute($job_title)
{
$this->attributes['job_title'] = mb_substr($job_title, 0, 100);
$this->attributes['job_title'] = mb_substr($job_title ?? '', 0, 100);
}
}
2 changes: 1 addition & 1 deletion config/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
| or any other location as required by the application or its packages.
*/

'version' => '1.8.107',
'version' => '1.8.108',

/*
|--------------------------------------------------------------------------
Expand Down
Loading

0 comments on commit 4c9f247

Please sign in to comment.