1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-21 00:41:34 +02:00

Merge pull request #6288 from turbo124/v5-develop

General fixes and improvements
This commit is contained in:
David Bomba 2021-07-18 14:10:40 +10:00 committed by GitHub
commit 2e53daa95d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 98 additions and 18 deletions

View File

@ -57,9 +57,6 @@ class PasswordProtection
$user = false;
$google = new Google();
$user = $google->getTokenResponse(request()->header('X-API-OAUTH-PASSWORD'));
nlog("user");
nlog($user);
if (is_array($user)) {
@ -68,8 +65,6 @@ class PasswordProtection
'oauth_provider_id'=> 'google'
];
nlog($query);
//If OAuth and user also has a password set - check both
if ($existing_user = MultiDB::hasUser($query) && auth()->user()->company()->oauth_password_required && auth()->user()->has_password && Hash::check(auth()->user()->password, $request->header('X-API-PASSWORD'))) {

View File

@ -48,6 +48,9 @@ class CreateCompanyTaskStatuses
MultiDB::setDb($this->company->db);
if(TaskStatus::where('company_id', $this->company->id)->count() > 0)
return;
$task_statuses = [
['name' => ctrans('texts.backlog'), 'company_id' => $this->company->id, 'user_id' => $this->user->id, 'created_at' => now(), 'updated_at' => now(), 'status_order' => 1],
['name' => ctrans('texts.ready_to_do'), 'company_id' => $this->company->id, 'user_id' => $this->user->id, 'created_at' => now(), 'updated_at' => now(), 'status_order' => 2],

View File

@ -430,8 +430,6 @@ class Import implements ShouldQueue
private function transformCompanyData(array $data): array
{
nlog("pre transformed");
nlog($data['settings']);
$company_settings = CompanySettings::defaults();
@ -454,9 +452,7 @@ class Import implements ShouldQueue
$data['settings'] = $company_settings;
}
nlog("transformed Settings");
nlog($data['settings']);
return $data;
}

View File

@ -0,0 +1,76 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://www.elastic.co/licensing/elastic-license
*/
namespace App\Jobs\Util;
use App\Jobs\Entity\CreateEntityPdf;
use App\Jobs\Util\UnlinkFile;
use App\Libraries\MultiDB;
use App\Models\Account;
use App\Models\Company;
use App\Models\CreditInvitation;
use App\Models\InvoiceInvitation;
use App\Models\QuoteInvitation;
use App\Utils\Ninja;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Storage;
class RefreshPdfs implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
public $company;
public function __construct(Company $company)
{
$this->company = $company;
}
/**
* Execute the job.
*
* @return void
*/
public function handle()
{
MultiDB::setDb($this->company->db);
InvoiceInvitation::where('company_id', $this->company->id)->cursor()->each(function ($invitation) {
nlog("generating invoice pdf for {$invitation->invoice_id}");
CreateEntityPdf::dispatch($invitation);
});
QuoteInvitation::where('company_id', $this->company->id)->cursor()->each(function ($invitation) {
nlog("generating quote pdf for {$invitation->quote_id}");
CreateEntityPdf::dispatch($invitation);
});
CreditInvitation::where('company_id', $this->company->id)->cursor()->each(function ($invitation) {
nlog("generating credit pdf for {$invitation->credit_id}");
CreateEntityPdf::dispatch($invitation);
});
}
}

View File

@ -940,7 +940,7 @@ class SubscriptionService
'subscription' => $this->subscription->hashed_id,
'recurring_invoice' => $recurring_invoice_hashed_id,
'client' => $invoice->client->hashed_id,
'contact' => $invoice->client->primary_contact()->first()->hashed_id,
'contact' => $invoice->client->primary_contact()->first() ? $invoice->client->contacts->first() : false,
'invoice' => $invoice->hashed_id,
];

View File

@ -48,18 +48,28 @@
@endif
<div class="px-4 py-5 bg-white sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6">
@if($invoice->po_number)
<dt class="text-sm font-medium leading-5 text-gray-500">
{{ ctrans('texts.po_number') }}
</dt>
<dd class="mt-1 text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2">
{{ $invoice->po_number }}
</dd>
@elseif($invoice->public_notes)
<dt class="text-sm font-medium leading-5 text-gray-500">
{{ ctrans('texts.public_notes') }}
</dt>
<dd class="mt-1 text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2">
{{ $invoice->public_notes }}
</dd>
@else
<dt class="text-sm font-medium leading-5 text-gray-500">
{{ ctrans('texts.invoice_date') }}
</dt>
<dd class="mt-1 text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2">
@if($invoice->po_number)
{{ $invoice->po_number }}
@elseif($invoice->public_notes)
{{ $invoice->public_notes }}
@else
{{ $invoice->date}}
@endif
{{ $invoice->date }}
</dd>
@endif
</div>
@if(!empty($invoice->due_date) && !is_null($invoice->due_date))