1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-05 18:52:44 +01:00

Fixes for importing company logo

This commit is contained in:
David Bomba 2020-11-04 11:32:18 +11:00
parent 5089f2183b
commit 37aaa1fc5b
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\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*/

View File

@ -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;