diff --git a/app/Jobs/Util/Import.php b/app/Jobs/Util/Import.php index c7e97d07bf..f3c640464b 100644 --- a/app/Jobs/Util/Import.php +++ b/app/Jobs/Util/Import.php @@ -74,6 +74,7 @@ use App\Repositories\VendorRepository; use App\Utils\Traits\CleanLineItems; use App\Utils\Traits\CompanyGatewayFeesAndLimitsSaver; use App\Utils\Traits\MakesHash; +use App\Utils\Traits\Uploadable; use Exception; use Illuminate\Bus\Queueable; use Illuminate\Contracts\Queue\ShouldQueue; @@ -91,7 +92,7 @@ class Import implements ShouldQueue use CompanyGatewayFeesAndLimitsSaver; use MakesHash; use CleanLineItems; - + use Uploadable; /** * @var array */ @@ -260,6 +261,14 @@ class Import implements ShouldQueue $company_repository = new CompanyRepository(); $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(); /*Improve memory handling by setting everything to null when we have finished*/ diff --git a/app/Utils/Traits/Uploadable.php b/app/Utils/Traits/Uploadable.php index d11f53f539..7be78167d5 100644 --- a/app/Utils/Traits/Uploadable.php +++ b/app/Utils/Traits/Uploadable.php @@ -25,8 +25,6 @@ trait Uploadable { $company_logo = $company->settings->company_logo; -info("company logo to be deleted = {$company_logo}"); - $file_name = basename($company_logo); $storage_path = $company->company_key . '/' . $file_name;