apply php-cs-fixer

This commit is contained in:
Benjamin Beganović 2020-12-16 12:52:40 +01:00
parent 9f4481d35f
commit 20c010448a
26 changed files with 89 additions and 118 deletions

View File

@ -61,7 +61,7 @@ class PostUpdate extends Command
$output = new BufferedOutput(); $output = new BufferedOutput();
$application->run($input, $output); $application->run($input, $output);
info(print_r($output->fetch(),1)); info(print_r($output->fetch(), 1));
try { try {
Artisan::call('optimize'); Artisan::call('optimize');

View File

@ -11,7 +11,6 @@
namespace App\Exceptions; namespace App\Exceptions;
use App\Models\Account;
use Exception; use Exception;
use Illuminate\Auth\Access\AuthorizationException; use Illuminate\Auth\Access\AuthorizationException;
use Illuminate\Auth\AuthenticationException; use Illuminate\Auth\AuthenticationException;
@ -68,7 +67,6 @@ class Handler extends ExceptionHandler
*/ */
public function report(Throwable $exception) public function report(Throwable $exception)
{ {
if (! Schema::hasTable('accounts')) { if (! Schema::hasTable('accounts')) {
info('account table not found'); info('account table not found');
return; return;
@ -91,26 +89,29 @@ class Handler extends ExceptionHandler
} }
}); });
if($this->validException($exception)) if ($this->validException($exception)) {
app('sentry')->captureException($exception); app('sentry')->captureException($exception);
}
} }
parent::report($exception); parent::report($exception);
} }
private function validException($exception) private function validException($exception)
{ {
if (strpos($exception->getMessage(), 'file_put_contents') !== false) {
return false;
}
if(strpos($exception->getMessage(), 'file_put_contents') !== FALSE) if (strpos($exception->getMessage(), 'Permission denied') !== false) {
return FALSE; return false;
}
if(strpos($exception->getMessage(), 'Permission denied') !== FALSE)
return FALSE;
if(strpos($exception->getMessage(), 'flock()') !== FALSE) if (strpos($exception->getMessage(), 'flock()') !== false) {
return FALSE; return false;
}
return TRUE; return true;
} }
/** /**

View File

@ -16,24 +16,23 @@ use Excel;
class InvoiceExport class InvoiceExport
{ {
private $company; private $company;
public function __construct(Company $company) public function __construct(Company $company)
{ {
$this->company = $company; $this->company = $company;
} }
public function export() public function export()
{ {
// $fileName = 'test.csv'; // $fileName = 'test.csv';
// $data = $this->company->invoices->get(); // $data = $this->company->invoices->get();
// return Excel::create($fileName, function ($excel) use ($data) { // return Excel::create($fileName, function ($excel) use ($data) {
// $excel->sheet('', function ($sheet) use ($data) { // $excel->sheet('', function ($sheet) use ($data) {
// $sheet->loadView('export', $data); // $sheet->loadView('export', $data);
// }); // });
// })->download('csv'); // })->download('csv');
}
} }
}

View File

@ -15,7 +15,6 @@ namespace App\Http\Controllers\ClientPortal;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use App\Http\Requests\ClientPortal\Documents\ShowDocumentRequest; use App\Http\Requests\ClientPortal\Documents\ShowDocumentRequest;
use App\Http\Requests\Document\DownloadMultipleDocumentsRequest; use App\Http\Requests\Document\DownloadMultipleDocumentsRequest;
use App\Models\ClientContact;
use App\Models\Document; use App\Models\Document;
use App\Utils\TempFile; use App\Utils\TempFile;
use App\Utils\Traits\MakesHash; use App\Utils\Traits\MakesHash;
@ -56,10 +55,9 @@ class DocumentController extends Controller
public function publicDownload(string $document_hash) public function publicDownload(string $document_hash)
{ {
$document = Document::where('hash', $document_hash)->firstOrFail(); $document = Document::where('hash', $document_hash)->firstOrFail();
return Storage::disk($document->disk)->download($document->url, $document->name); return Storage::disk($document->disk)->download($document->url, $document->name);
} }
public function downloadMultiple(DownloadMultipleDocumentsRequest $request) public function downloadMultiple(DownloadMultipleDocumentsRequest $request)

View File

@ -143,26 +143,27 @@ class EmailController extends BaseController
$this->entity_type = Invoice::class; $this->entity_type = Invoice::class;
$this->entity_transformer = InvoiceTransformer::class; $this->entity_transformer = InvoiceTransformer::class;
if($entity_obj->invitations->count() >= 1) if ($entity_obj->invitations->count() >= 1) {
$entity_obj->entityEmailEvent($entity_obj->invitations->first(), 'invoice'); $entity_obj->entityEmailEvent($entity_obj->invitations->first(), 'invoice');
}
} }
if ($entity_obj instanceof Quote) { if ($entity_obj instanceof Quote) {
$this->entity_type = Quote::class; $this->entity_type = Quote::class;
$this->entity_transformer = QuoteTransformer::class; $this->entity_transformer = QuoteTransformer::class;
if($entity_obj->invitations->count() >= 1) if ($entity_obj->invitations->count() >= 1) {
event(new QuoteWasEmailed($entity_obj->invitations->first(), $entity_obj->company, Ninja::eventVars())); event(new QuoteWasEmailed($entity_obj->invitations->first(), $entity_obj->company, Ninja::eventVars()));
}
} }
if ($entity_obj instanceof Credit) { if ($entity_obj instanceof Credit) {
$this->entity_type = Credit::class; $this->entity_type = Credit::class;
$this->entity_transformer = CreditTransformer::class; $this->entity_transformer = CreditTransformer::class;
if($entity_obj->invitations->count() >= 1) if ($entity_obj->invitations->count() >= 1) {
event(new CreditWasEmailed($entity_obj->invitations->first(), $entity_obj->company, Ninja::eventVars())); event(new CreditWasEmailed($entity_obj->invitations->first(), $entity_obj->company, Ninja::eventVars()));
}
} }
if ($entity_obj instanceof RecurringInvoice) { if ($entity_obj instanceof RecurringInvoice) {

View File

@ -11,13 +11,9 @@
namespace App\Http\Controllers; namespace App\Http\Controllers;
use App\Http\Controllers\Controller;
use App\Http\Requests\Import\ImportRequest; use App\Http\Requests\Import\ImportRequest;
use App\Http\Requests\Import\PreImportRequest; use App\Http\Requests\Import\PreImportRequest;
use App\Import\Definitions\Import\ImportMap;
use App\Import\Definitions\InvoiceMap;
use App\Jobs\Import\CSVImport; use App\Jobs\Import\CSVImport;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Cache; use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Str; use Illuminate\Support\Str;
use League\Csv\Reader; use League\Csv\Reader;
@ -97,7 +93,6 @@ class ImportController extends Controller
public function import(ImportRequest $request) public function import(ImportRequest $request)
{ {
CSVImport::dispatch($request->all(), auth()->user()->company()); CSVImport::dispatch($request->all(), auth()->user()->company());
return response()->json(['message' => 'Importing data, email will be sent on completion'], 200); return response()->json(['message' => 'Importing data, email will be sent on completion'], 200);
@ -110,7 +105,6 @@ class ImportController extends Controller
private function getCsvData($csvfile) private function getCsvData($csvfile)
{ {
if (! ini_get('auto_detect_line_endings')) { if (! ini_get('auto_detect_line_endings')) {
ini_set('auto_detect_line_endings', '1'); ini_set('auto_detect_line_endings', '1');
} }

View File

@ -12,9 +12,7 @@
namespace App\Http\Controllers; namespace App\Http\Controllers;
use App\Events\Invoice\InvoiceReminderWasEmailed;
use App\Events\Invoice\InvoiceWasCreated; use App\Events\Invoice\InvoiceWasCreated;
use App\Events\Invoice\InvoiceWasEmailed;
use App\Events\Invoice\InvoiceWasUpdated; use App\Events\Invoice\InvoiceWasUpdated;
use App\Factory\CloneInvoiceFactory; use App\Factory\CloneInvoiceFactory;
use App\Factory\CloneInvoiceToQuoteFactory; use App\Factory\CloneInvoiceToQuoteFactory;
@ -31,7 +29,6 @@ use App\Jobs\Entity\EmailEntity;
use App\Jobs\Invoice\StoreInvoice; use App\Jobs\Invoice\StoreInvoice;
use App\Jobs\Invoice\ZipInvoices; use App\Jobs\Invoice\ZipInvoices;
use App\Jobs\Util\UnlinkFile; use App\Jobs\Util\UnlinkFile;
use App\Models\Activity;
use App\Models\Client; use App\Models\Client;
use App\Models\Invoice; use App\Models\Invoice;
use App\Models\Quote; use App\Models\Quote;
@ -730,8 +727,9 @@ class InvoiceController extends BaseController
EmailEntity::dispatch($invitation, $invoice->company, $this->reminder_template); EmailEntity::dispatch($invitation, $invoice->company, $this->reminder_template);
}); });
if($invoice->invitations->count() >= 1) if ($invoice->invitations->count() >= 1) {
$invoice->entityEmailEvent($invoice->invitations->first(), $this->reminder_template); $invoice->entityEmailEvent($invoice->invitations->first(), $this->reminder_template);
}
if (! $bulk) { if (! $bulk) {
return response()->json(['message' => 'email sent'], 200); return response()->json(['message' => 'email sent'], 200);

View File

@ -11,7 +11,6 @@
namespace App\Http\Controllers; namespace App\Http\Controllers;
use App\Designs\Designer;
use App\Jobs\Util\PreviewPdf; use App\Jobs\Util\PreviewPdf;
use App\Models\Client; use App\Models\Client;
use App\Models\ClientContact; use App\Models\ClientContact;
@ -24,10 +23,10 @@ use App\Utils\Ninja;
use App\Utils\PhantomJS\Phantom; use App\Utils\PhantomJS\Phantom;
use App\Utils\Traits\MakesHash; use App\Utils\Traits\MakesHash;
use App\Utils\Traits\MakesInvoiceHtml; use App\Utils\Traits\MakesInvoiceHtml;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Response;
use Illuminate\Support\Facades\App; use Illuminate\Support\Facades\App;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Lang; use Illuminate\Support\Facades\Lang;
use Illuminate\Support\Facades\Response;
class PreviewController extends BaseController class PreviewController extends BaseController
{ {
@ -126,8 +125,9 @@ class PreviewController extends BaseController
->design($design) ->design($design)
->build(); ->build();
if(request()->has('html') && request()->input('html') == true) if (request()->has('html') && request()->input('html') == true) {
return $maker->getCompiledHTML; return $maker->getCompiledHTML;
}
//if phantom js...... inject here.. //if phantom js...... inject here..
if (config('ninja.phantomjs_pdf_generation')) { if (config('ninja.phantomjs_pdf_generation')) {
@ -145,7 +145,6 @@ class PreviewController extends BaseController
private function blankEntity() private function blankEntity()
{ {
App::forgetInstance('translator'); App::forgetInstance('translator');
Lang::replace(Ninja::transformTranslations(auth()->user()->company()->settings)); Lang::replace(Ninja::transformTranslations(auth()->user()->company()->settings));

View File

@ -27,13 +27,11 @@ class ImportRequest extends Request
public function rules() public function rules()
{ {
return [
return [ 'hash' => 'required|string',
'hash' => 'required|string',
'entity_type' => 'required|string', 'entity_type' => 'required|string',
'column_map' => 'required|array', 'column_map' => 'required|array',
'skip_header' => 'required|boolean' 'skip_header' => 'required|boolean'
]; ];
} }
} }

View File

@ -27,11 +27,9 @@ class PreImportRequest extends Request
public function rules() public function rules()
{ {
return [
return [ 'file' => 'required|file|mimes:csv,txt',
'file' => 'required|file|mimes:csv,txt',
'entity_type' => 'required', 'entity_type' => 'required',
]; ];
} }
} }

View File

@ -113,11 +113,12 @@ class StoreRecurringInvoiceRequest extends Request
private function setAutoBillFlag($auto_bill) private function setAutoBillFlag($auto_bill)
{ {
if ($auto_bill == 'always') if ($auto_bill == 'always') {
return true; return true;
}
//if ($auto_bill == 'off' || $auto_bill == 'optin') { //if ($auto_bill == 'off' || $auto_bill == 'optin') {
return false; return false;
//} //}
} }

View File

@ -38,10 +38,11 @@ class StoreUserRequest extends Request
$rules['first_name'] = 'required|string|max:100'; $rules['first_name'] = 'required|string|max:100';
$rules['last_name'] = 'required|string|max:100'; $rules['last_name'] = 'required|string|max:100';
if (config('ninja.db.multi_db_enabled')) if (config('ninja.db.multi_db_enabled')) {
$rules['email'] = [new ValidUserForCompany(), Rule::unique('users')]; $rules['email'] = [new ValidUserForCompany(), Rule::unique('users')];
else } else {
$rules['email'] = Rule::unique('users'); $rules['email'] = Rule::unique('users');
}
if (auth()->user()->company()->account->isFreeHostedClient()) { if (auth()->user()->company()->account->isFreeHostedClient()) {

View File

@ -8,7 +8,7 @@ use Exception;
/** /**
* Class BaseTransformer. * Class BaseTransformer.
*/ */
class BaseTransformer class BaseTransformer
{ {
/** /**
* @var * @var
@ -41,10 +41,11 @@ class BaseTransformer
{ {
$code = array_key_exists('client.currency_id', $data) ? $data['client.currency_id'] : false; $code = array_key_exists('client.currency_id', $data) ? $data['client.currency_id'] : false;
if($code) if ($code) {
return $this->maps['currencies']->where('code', $code)->first()->id; return $this->maps['currencies']->where('code', $code)->first()->id;
}
return $this->maps['company']->settings->currency_id; return $this->maps['company']->settings->currency_id;
} }
/** /**

View File

@ -20,10 +20,10 @@ class ClientTransformer extends BaseTransformer
return false; return false;
} }
$settings = new \stdClass; $settings = new \stdClass;
$settings->currency_id = (string)$this->getCurrencyByCode($data); $settings->currency_id = (string)$this->getCurrencyByCode($data);
return [ return [
'company_id' => $this->maps['company']->id, 'company_id' => $this->maps['company']->id,
'name' => $this->getString($data, 'client.name'), 'name' => $this->getString($data, 'client.name'),
'work_phone' => $this->getString($data, 'client.phone'), 'work_phone' => $this->getString($data, 'client.phone'),
@ -65,6 +65,5 @@ class ClientTransformer extends BaseTransformer
'country_id' => isset($data->country_id) ? $this->getCountryId($data->country_id) : null, 'country_id' => isset($data->country_id) ? $this->getCountryId($data->country_id) : null,
'shipping_country_id' => isset($data->shipping_country_id) ? $this->getCountryId($data->shipping_country_id) : null, 'shipping_country_id' => isset($data->shipping_country_id) ? $this->getCountryId($data->shipping_country_id) : null,
]; ];
} }
} }

View File

@ -87,7 +87,6 @@ class CreateEntityPdf implements ShouldQueue
public function handle() public function handle()
{ {
App::setLocale($this->contact->preferredLocale()); App::setLocale($this->contact->preferredLocale());
App::forgetInstance('translator'); App::forgetInstance('translator');
Lang::replace(Ninja::transformTranslations($this->entity->client->getMergedSettings())); Lang::replace(Ninja::transformTranslations($this->entity->client->getMergedSettings()));

View File

@ -101,7 +101,6 @@ class EmailEntity extends BaseMailerJob implements ShouldQueue
$this->setMailDriver(); $this->setMailDriver();
try { try {
Mail::to($this->invitation->contact->email, $this->invitation->contact->present()->name()) Mail::to($this->invitation->contact->email, $this->invitation->contact->present()->name())
->send( ->send(
new TemplateEmail( new TemplateEmail(

View File

@ -21,19 +21,16 @@ use App\Models\Currency;
use App\Models\User; use App\Models\User;
use App\Repositories\ClientContactRepository; use App\Repositories\ClientContactRepository;
use App\Repositories\ClientRepository; use App\Repositories\ClientRepository;
use Exception;
use Illuminate\Bus\Queueable; use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable; use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Http\Request;
use Illuminate\Queue\InteractsWithQueue; use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels; use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Cache; use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Str; use Illuminate\Support\Facades\Validator;
use League\Csv\Reader; use League\Csv\Reader;
use League\Csv\Statement; use League\Csv\Statement;
use Illuminate\Support\Facades\Validator;
use Illuminate\Support\Facades\Auth;
class CSVImport implements ShouldQueue class CSVImport implements ShouldQueue
{ {
@ -116,11 +113,11 @@ class CSVImport implements ShouldQueue
$client_repository = new ClientRepository($contact_repository); $client_repository = new ClientRepository($contact_repository);
$client_transformer = new ClientTransformer($this->maps); $client_transformer = new ClientTransformer($this->maps);
if($this->skip_header) if ($this->skip_header) {
array_shift($records); array_shift($records);
}
foreach($records as $record) { foreach ($records as $record) {
$keys = $this->column_map; $keys = $this->column_map;
$values = array_intersect_key($record, $this->column_map); $values = array_intersect_key($record, $this->column_map);
@ -132,31 +129,29 @@ class CSVImport implements ShouldQueue
if ($validator->fails()) { if ($validator->fails()) {
$this->error_array[] = ['client' => $client, 'error' => json_encode($validator->errors())]; $this->error_array[] = ['client' => $client, 'error' => json_encode($validator->errors())];
} } else {
else{
$client = $client_repository->save($client, ClientFactory::create($this->company->id, $this->setUser($record))); $client = $client_repository->save($client, ClientFactory::create($this->company->id, $this->setUser($record)));
if(array_key_exists('client.balance', $client_data)) if (array_key_exists('client.balance', $client_data)) {
$client->balance = preg_replace('/[^0-9,.]+/', '', $client_data['client.balance']); $client->balance = preg_replace('/[^0-9,.]+/', '', $client_data['client.balance']);
}
if(array_key_exists('client.paid_to_date', $client_data)) if (array_key_exists('client.paid_to_date', $client_data)) {
$client->paid_to_date = preg_replace('/[^0-9,.]+/', '', $client_data['client.paid_to_date']); $client->paid_to_date = preg_replace('/[^0-9,.]+/', '', $client_data['client.paid_to_date']);
}
$client->save(); $client->save();
$this->import_array['clients'][] = $client->id; $this->import_array['clients'][] = $client->id;
} }
} }
} }
public function failed($exception) public function failed($exception)
{ {
} }
////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////
private function buildMaps() private function buildMaps()
{ {
$this->maps['currencies'] = Currency::all(); $this->maps['currencies'] = Currency::all();
@ -171,24 +166,24 @@ class CSVImport implements ShouldQueue
{ {
$user_key_exists = array_search('client.user_id', $this->column_map); $user_key_exists = array_search('client.user_id', $this->column_map);
if($user_key_exists) if ($user_key_exists) {
return $this->findUser($record[$user_key_exists]); return $this->findUser($record[$user_key_exists]);
else } else {
return $this->company->owner()->id; return $this->company->owner()->id;
}
} }
private function findUser($user_hash) private function findUser($user_hash)
{ {
$user = User::where('company_id', $this->company->id) $user = User::where('company_id', $this->company->id)
->where(\DB::raw('CONCAT_WS(" ", first_name, last_name)'), 'like', '%' . $user_hash . '%') ->where(\DB::raw('CONCAT_WS(" ", first_name, last_name)'), 'like', '%' . $user_hash . '%')
->first(); ->first();
if($user) if ($user) {
return $user->id; return $user->id;
else } else {
return $this->company->owner()->id; return $this->company->owner()->id;
}
} }
private function getCsvData() private function getCsvData()
@ -215,8 +210,5 @@ class CSVImport implements ShouldQueue
} }
return $data; return $data;
} }
} }

View File

@ -35,7 +35,6 @@ class UploadAvatar implements ShouldQueue
public function handle() : ?string public function handle() : ?string
{ {
$tmp_file = sha1(time()).'.png'; $tmp_file = sha1(time()).'.png';
$im = imagecreatefromstring(file_get_contents($this->file)); $im = imagecreatefromstring(file_get_contents($this->file));

View File

@ -13,8 +13,6 @@ namespace App\Models;
use App\DataMapper\ClientSettings; use App\DataMapper\ClientSettings;
use App\DataMapper\CompanySettings; use App\DataMapper\CompanySettings;
use App\Models\CompanyGateway;
use App\Models\Gateway;
use App\Models\Presenters\ClientPresenter; use App\Models\Presenters\ClientPresenter;
use App\Services\Client\ClientService; use App\Services\Client\ClientService;
use App\Utils\Traits\GeneratesCounter; use App\Utils\Traits\GeneratesCounter;
@ -485,7 +483,7 @@ class Client extends BaseModel implements HasLocalePreference
$payment_methods_intersect = $payment_methods_collections->intersectByKeys($payment_methods_collections->flatten(1)->unique()); $payment_methods_intersect = $payment_methods_collections->intersectByKeys($payment_methods_collections->flatten(1)->unique());
// handle custom gateways as they are not unique'd()--------------------------------------------------------- // handle custom gateways as they are not unique'd()---------------------------------------------------------
// we need to split the query here as we allow multiple custom gateways, so we must show all of them, they query logic // we need to split the query here as we allow multiple custom gateways, so we must show all of them, they query logic
// above only pulls in unique gateway types.. ie.. we only allow 1 credit card gateway, but many custom gateways. // above only pulls in unique gateway types.. ie.. we only allow 1 credit card gateway, but many custom gateways.
if ($company_gateways || $company_gateways == '0') { if ($company_gateways || $company_gateways == '0') {
@ -512,7 +510,7 @@ class Client extends BaseModel implements HasLocalePreference
$payment_methods_intersect->push([$gateway->id => $type]); $payment_methods_intersect->push([$gateway->id => $type]);
} }
} else { } else {
$payment_methods_intersect->push([$gateway->id => $type]); $payment_methods_intersect->push([$gateway->id => $type]);
} }
} }
} }

View File

@ -11,7 +11,6 @@
namespace App\Models; namespace App\Models;
use App\Models\GatewayType;
use App\PaymentDrivers\BasePaymentDriver; use App\PaymentDrivers\BasePaymentDriver;
use App\Utils\Number; use App\Utils\Number;
use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Database\Eloquent\SoftDeletes;
@ -236,8 +235,9 @@ class CompanyGateway extends BaseModel
return false; return false;
} }
if($gateway_type_id == GatewayType::CUSTOM) if ($gateway_type_id == GatewayType::CUSTOM) {
$gateway_type_id = GatewayType::CREDIT_CARD; $gateway_type_id = GatewayType::CREDIT_CARD;
}
return $this->fees_and_limits->{$gateway_type_id}; return $this->fees_and_limits->{$gateway_type_id};
} }

View File

@ -17,7 +17,6 @@ use App\Events\Invoice\InvoiceWasUpdated;
use App\Helpers\Invoice\InvoiceSum; use App\Helpers\Invoice\InvoiceSum;
use App\Helpers\Invoice\InvoiceSumInclusive; use App\Helpers\Invoice\InvoiceSumInclusive;
use App\Jobs\Entity\CreateEntityPdf; use App\Jobs\Entity\CreateEntityPdf;
use App\Models\Activity;
use App\Models\Presenters\InvoicePresenter; use App\Models\Presenters\InvoicePresenter;
use App\Services\Invoice\InvoiceService; use App\Services\Invoice\InvoiceService;
use App\Services\Ledger\LedgerService; use App\Services\Ledger\LedgerService;
@ -438,7 +437,6 @@ class Invoice extends BaseModel
public function entityEmailEvent($invitation, $reminder_template) public function entityEmailEvent($invitation, $reminder_template)
{ {
switch ($reminder_template) { switch ($reminder_template) {
case 'invoice': case 'invoice':
event(new InvoiceWasEmailed($invitation, $invitation->company, Ninja::eventVars())); event(new InvoiceWasEmailed($invitation, $invitation->company, Ninja::eventVars()));

View File

@ -33,7 +33,6 @@ class ExpenseRepository extends BaseRepository
*/ */
public function save(array $data, Expense $expense) : ?Expense public function save(array $data, Expense $expense) : ?Expense
{ {
$expense->fill($data); $expense->fill($data);
$expense->number = empty($expense->number) ? $this->getNextExpenseNumber($expense) : $expense->number; $expense->number = empty($expense->number) ? $this->getNextExpenseNumber($expense) : $expense->number;
$expense->save(); $expense->save();

View File

@ -85,16 +85,18 @@ class SystemHealth
public static function checkOpenBaseDir() public static function checkOpenBaseDir()
{ {
if(strlen(ini_get('open_basedir') == 0)) if (strlen(ini_get('open_basedir') == 0)) {
return true; return true;
}
return false; return false;
} }
public static function checkExecWorks() public static function checkExecWorks()
{ {
if(function_exists('exec')) if (function_exists('exec')) {
return true; return true;
}
return false; return false;
} }
@ -118,7 +120,6 @@ class SystemHealth
} }
return 'Node not found.'; return 'Node not found.';
} catch (Exception $e) { } catch (Exception $e) {
return 'Node not found.'; return 'Node not found.';
} }
@ -134,7 +135,6 @@ class SystemHealth
} }
return 'NPM not found'; return 'NPM not found';
} catch (Exception $e) { } catch (Exception $e) {
return 'NPM not found'; return 'NPM not found';
} }

View File

@ -65,8 +65,9 @@ trait ClientGroupSettingsSaver
//this pass will handle any null values that are in the translations //this pass will handle any null values that are in the translations
foreach ($settings->translations as $key => $value) { foreach ($settings->translations as $key => $value) {
if (is_null($settings->translations[$key])) if (is_null($settings->translations[$key])) {
$settings->translations[$key] = ''; $settings->translations[$key] = '';
}
} }
$entity_settings->translations = $settings->translations; $entity_settings->translations = $settings->translations;

View File

@ -60,8 +60,9 @@ trait CompanySettingsSaver
//this pass will handle any null values that are in the translations //this pass will handle any null values that are in the translations
foreach ($settings->translations as $key => $value) { foreach ($settings->translations as $key => $value) {
if (is_null($settings->translations[$key])) if (is_null($settings->translations[$key])) {
$settings->translations[$key] = ''; $settings->translations[$key] = '';
}
} }
$company_settings->translations = $settings->translations; $company_settings->translations = $settings->translations;

View File

@ -209,7 +209,4 @@ trait MakesReminders
return null; return null;
} }
} }
} }