Merge pull request #4264 from turbo124/v5-develop

Fixes for importing company logo
This commit is contained in:
David Bomba 2020-11-04 11:34:06 +11:00 committed by GitHub
commit 9b7aef1de6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 3 deletions

View File

@ -74,6 +74,7 @@ use App\Repositories\VendorRepository;
use App\Utils\Traits\CleanLineItems; use App\Utils\Traits\CleanLineItems;
use App\Utils\Traits\CompanyGatewayFeesAndLimitsSaver; use App\Utils\Traits\CompanyGatewayFeesAndLimitsSaver;
use App\Utils\Traits\MakesHash; use App\Utils\Traits\MakesHash;
use App\Utils\Traits\Uploadable;
use Exception; use Exception;
use Illuminate\Bus\Queueable; use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Contracts\Queue\ShouldQueue;
@ -91,7 +92,7 @@ class Import implements ShouldQueue
use CompanyGatewayFeesAndLimitsSaver; use CompanyGatewayFeesAndLimitsSaver;
use MakesHash; use MakesHash;
use CleanLineItems; use CleanLineItems;
use Uploadable;
/** /**
* @var array * @var array
*/ */
@ -260,6 +261,14 @@ class Import implements ShouldQueue
$company_repository = new CompanyRepository(); $company_repository = new CompanyRepository();
$company_repository->save($data, $this->company); $company_repository->save($data, $this->company);
if(isset($data['settings']->company_logo)) {
$tempImage = tempnam(sys_get_temp_dir(), basename($data['settings']->company_logo));
copy($data['settings']->company_logo, $tempImage);
$this->uploadLogo($tempImage, $this->company, $this->company);
}
Company::reguard(); Company::reguard();
/*Improve memory handling by setting everything to null when we have finished*/ /*Improve memory handling by setting everything to null when we have finished*/

View File

@ -25,8 +25,6 @@ trait Uploadable
{ {
$company_logo = $company->settings->company_logo; $company_logo = $company->settings->company_logo;
info("company logo to be deleted = {$company_logo}");
$file_name = basename($company_logo); $file_name = basename($company_logo);
$storage_path = $company->company_key . '/' . $file_name; $storage_path = $company->company_key . '/' . $file_name;