Fixes for tests

This commit is contained in:
David Bomba 2023-08-07 18:57:25 +10:00
parent 9fffa2b329
commit 7cc2f3c665
8 changed files with 16 additions and 13 deletions

View File

@ -181,7 +181,7 @@ class PreviewPurchaseOrderController extends BaseController
DB::connection(config('database.default'))->beginTransaction();
if ($request->has('entity_id')) {
/** @var \Illuminate\Database\Eloquent\Builder|\App\Models\PurchaseOrder $entity_obj|\Illuminate\Database\Eloquent\SoftDeletes */
/** @var \App\Models\PurchaseOrder|\Illuminate\Database\Eloquent\Builder $entity_obj **/
$entity_obj = $class::on(config('database.default'))
->with('vendor.company')
->where('id', $this->decodePrimaryKey($request->input('entity_id')))

View File

@ -49,9 +49,9 @@ class CreateEntityPdf implements ShouldQueue
public \App\Models\Invoice | \App\Models\Quote | \App\Models\Credit | \App\Models\RecurringInvoice | null $entity;
public \App\Models\Company $company;
public \App\Models\Company | null $company;
public \App\Models\ClientContact$contact;
public \App\Models\ClientContact | null $contact;
private $disk;
@ -59,7 +59,7 @@ class CreateEntityPdf implements ShouldQueue
public string $entity_string = '';
public \App\Models\Client $client;
public \App\Models\Client | null $client;
public $deleteWhenMissingModels = true;

View File

@ -83,7 +83,6 @@ use Illuminate\Foundation\Auth\User as Authenticatable;
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\CompanyToken> $tokens
* @property-read int|null $tokens_count
* @property \App\Models\CompanyToken $token
* @property int $company_id
* @method static \Database\Factories\UserFactory factory($count = null, $state = [])
* @method static \Illuminate\Database\Eloquent\Builder|User filter(\App\Filters\QueryFilters $filters)
* @method static \Illuminate\Database\Eloquent\Builder|User newModelQuery()

View File

@ -50,17 +50,17 @@ class InvoiceTransformer extends EntityTransformer
'tax_name3' => $invoice->tax_name3 ? $invoice->tax_name3 : '',
'tax_rate3' => (float) $invoice->tax_rate3,
'is_amount_discount' => (bool) ($invoice->is_amount_discount ?: false),
'invoice_footer' => $invoice->invoice_footer ?: '',
'invoice_footer' => $invoice->footer ?: '',
'partial' => (float) ($invoice->partial ?: 0.0),
'partial_due_date' => $invoice->partial_due_date ?: '',
'custom_value1' => (float) $invoice->custom_value1,
'custom_value2' => (float) $invoice->custom_value2,
'custom_value3' => (bool) $invoice->custom_value3,
'custom_value4' => (bool) $invoice->custom_value4,
'has_tasks' => (bool) $invoice->has_tasks,
'has_expenses' => (bool) $invoice->has_expenses,
'custom_text_value1' => $invoice->custom_text_value1 ?: '',
'custom_text_value2' => $invoice->custom_text_value2 ?: '',
// 'has_tasks' => (bool) $invoice->has_tasks,
// 'has_expenses' => (bool) $invoice->has_expenses,
// 'custom_text_value1' => $invoice->custom_text_value1 ?: '',
// 'custom_text_value2' => $invoice->custom_text_value2 ?: '',
'line_items' => $invoice->line_items,
];
}

View File

@ -11,12 +11,13 @@
namespace App\Transformers;
use App\Models\Activity;
use App\Models\Backup;
use App\Models\Client;
use App\Models\Credit;
use App\Models\CreditInvitation;
use App\Models\Activity;
use App\Models\Document;
use App\Utils\Traits\MakesHash;
use App\Models\CreditInvitation;
use League\Fractal\Resource\Item;
class CreditTransformer extends EntityTransformer

View File

@ -98,6 +98,7 @@ class UserTransformer extends EntityTransformer
{
if (! $user->company_id && request()->header('X-API-TOKEN')) {
$company_token = CompanyToken::where('token', request()->header('X-API-TOKEN'))->first();
/** @var \App\Models\User $user */
$user->company_id = $company_token->company_id;
}

View File

@ -63,6 +63,7 @@ class EmailStats
public static function clearCompanies($companies)
{
$companies->each(function ($company) {
/** @var \App\Models\Company $company */
self::clear($company->company_key);
});
}

View File

@ -44,6 +44,7 @@ class Phantom
public function generate($invitation, $return_pdf = false)
{
$entity = false;
$path = '';
if ($invitation instanceof InvoiceInvitation) {
$entity = 'invoice';
@ -106,7 +107,7 @@ class Phantom
}
if (! Storage::disk(config('filesystems.default'))->exists($path)) {
Storage::disk(config('filesystems.default'))->makeDirectory($path, 0775);
Storage::disk(config('filesystems.default'))->makeDirectory($path);
}
$instance = Storage::disk(config('filesystems.default'))->put($file_path, $pdf);