mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 21:22:58 +01:00
Merge remote-tracking branch 'upstream/v2' into v2-2805-client-signup
This commit is contained in:
commit
be1600245f
@ -232,8 +232,12 @@ class CompanySettings extends BaseSettings
|
|||||||
public $portal_custom_js = '';
|
public $portal_custom_js = '';
|
||||||
|
|
||||||
public $client_can_register = false;
|
public $client_can_register = false;
|
||||||
|
public $client_signup_terms = '';
|
||||||
|
public $client_signup_privacy_policy = '';
|
||||||
|
|
||||||
public static $casts = [
|
public static $casts = [
|
||||||
|
'client_signup_terms' => 'string',
|
||||||
|
'client_signup_privacy_policy' => 'string',
|
||||||
'client_can_register' => 'bool',
|
'client_can_register' => 'bool',
|
||||||
'portal_design_id' => 'string',
|
'portal_design_id' => 'string',
|
||||||
'late_fee_endless_percent' => 'float',
|
'late_fee_endless_percent' => 'float',
|
||||||
|
@ -265,7 +265,9 @@ class BaseController extends Controller
|
|||||||
'company.payments.paymentables',
|
'company.payments.paymentables',
|
||||||
'company.quotes.invitations.contact',
|
'company.quotes.invitations.contact',
|
||||||
'company.quotes.invitations.company',
|
'company.quotes.invitations.company',
|
||||||
|
'company.quotes.documents',
|
||||||
'company.credits.invitations.company',
|
'company.credits.invitations.company',
|
||||||
|
'company.credits.documents',
|
||||||
'company.payment_terms.company',
|
'company.payment_terms.company',
|
||||||
//'company.credits.invitations.contact',
|
//'company.credits.invitations.contact',
|
||||||
//'company.credits.invitations.company',
|
//'company.credits.invitations.company',
|
||||||
|
@ -88,7 +88,7 @@ class UploadFile implements ShouldQueue
|
|||||||
$document = new Document();
|
$document = new Document();
|
||||||
$document->user_id = $this->user->id;
|
$document->user_id = $this->user->id;
|
||||||
$document->company_id = $this->company->id;
|
$document->company_id = $this->company->id;
|
||||||
$document->path = $instance;
|
$document->url = $instance;
|
||||||
$document->name = $this->file->getClientOriginalName();
|
$document->name = $this->file->getClientOriginalName();
|
||||||
$document->type = $this->file->extension();
|
$document->type = $this->file->extension();
|
||||||
$document->disk = $this->disk;
|
$document->disk = $this->disk;
|
||||||
|
@ -170,6 +170,12 @@ class Credit extends BaseModel
|
|||||||
return $this->morphToMany(Payment::class, 'paymentable');
|
return $this->morphToMany(Payment::class, 'paymentable');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function documents()
|
||||||
|
{
|
||||||
|
return $this->morphMany(Document::class, 'documentable');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Access the invoice calculator object
|
* Access the invoice calculator object
|
||||||
*
|
*
|
||||||
|
@ -100,7 +100,7 @@ class Document extends BaseModel
|
|||||||
|
|
||||||
public function generateUrl($absolute = false)
|
public function generateUrl($absolute = false)
|
||||||
{
|
{
|
||||||
$url = Storage::disk($this->disk)->url($this->path);
|
$url = Storage::disk($this->disk)->url($this->url);
|
||||||
|
|
||||||
if ($url && $absolute) {
|
if ($url && $absolute) {
|
||||||
return url($url);
|
return url($url);
|
||||||
|
@ -24,13 +24,14 @@ class CreditTransformer extends EntityTransformer
|
|||||||
|
|
||||||
protected $defaultIncludes = [
|
protected $defaultIncludes = [
|
||||||
'invitations',
|
'invitations',
|
||||||
|
'documents',
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $availableIncludes = [
|
protected $availableIncludes = [
|
||||||
'invitations',
|
'invitations',
|
||||||
// 'payments',
|
// 'payments',
|
||||||
// 'client',
|
// 'client',
|
||||||
// 'documents',
|
'documents',
|
||||||
];
|
];
|
||||||
|
|
||||||
public function includeInvitations(Credit $credit)
|
public function includeInvitations(Credit $credit)
|
||||||
|
@ -37,7 +37,7 @@ class DocumentTransformer extends EntityTransformer
|
|||||||
'assigned_user_id' => $this->encodePrimaryKey($document->assigned_user_id),
|
'assigned_user_id' => $this->encodePrimaryKey($document->assigned_user_id),
|
||||||
'project_id' => $this->encodePrimaryKey($document->project_id),
|
'project_id' => $this->encodePrimaryKey($document->project_id),
|
||||||
'vendor_id' => $this->encodePrimaryKey($document->vendor_id),
|
'vendor_id' => $this->encodePrimaryKey($document->vendor_id),
|
||||||
'path' => (string) $document->path ?: '',
|
'url' => (string) $document->url ?: '',
|
||||||
'preview' => (string) $document->preview ?: '',
|
'preview' => (string) $document->preview ?: '',
|
||||||
'name' => (string) $document->name,
|
'name' => (string) $document->name,
|
||||||
'type' => (string) $document->type,
|
'type' => (string) $document->type,
|
||||||
|
@ -11,8 +11,10 @@
|
|||||||
|
|
||||||
namespace App\Transformers;
|
namespace App\Transformers;
|
||||||
|
|
||||||
|
use App\Models\Document;
|
||||||
use App\Models\Quote;
|
use App\Models\Quote;
|
||||||
use App\Models\QuoteInvitation;
|
use App\Models\QuoteInvitation;
|
||||||
|
use App\Transformers\DocumentTransformer;
|
||||||
use App\Transformers\QuoteInvitationTransformer;
|
use App\Transformers\QuoteInvitationTransformer;
|
||||||
use App\Utils\Traits\MakesHash;
|
use App\Utils\Traits\MakesHash;
|
||||||
|
|
||||||
@ -22,13 +24,14 @@ class QuoteTransformer extends EntityTransformer
|
|||||||
|
|
||||||
protected $defaultIncludes = [
|
protected $defaultIncludes = [
|
||||||
'invitations',
|
'invitations',
|
||||||
|
'documents',
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $availableIncludes = [
|
protected $availableIncludes = [
|
||||||
'invitations',
|
'invitations',
|
||||||
|
'documents',
|
||||||
// 'payments',
|
// 'payments',
|
||||||
// 'client',
|
// 'client',
|
||||||
// 'documents',
|
|
||||||
];
|
];
|
||||||
|
|
||||||
public function includeInvitations(Quote $quote)
|
public function includeInvitations(Quote $quote)
|
||||||
@ -58,18 +61,14 @@ class QuoteTransformer extends EntityTransformer
|
|||||||
|
|
||||||
return $this->includeCollection($quote->expenses, $transformer, ENTITY_EXPENSE);
|
return $this->includeCollection($quote->expenses, $transformer, ENTITY_EXPENSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function includeDocuments(quote $quote)
|
|
||||||
{
|
|
||||||
$transformer = new DocumentTransformer($this->account, $this->serializer);
|
|
||||||
|
|
||||||
$quote->documents->each(function ($document) use ($quote) {
|
|
||||||
$document->setRelation('quote', $quote);
|
|
||||||
});
|
|
||||||
|
|
||||||
return $this->includeCollection($quote->documents, $transformer, ENTITY_DOCUMENT);
|
|
||||||
}
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
public function includeDocuments(Quote $quote)
|
||||||
|
{
|
||||||
|
$transformer = new DocumentTransformer($this->serializer);
|
||||||
|
return $this->includeCollection($quote->documents, $transformer, Document::class);
|
||||||
|
}
|
||||||
|
|
||||||
public function transform(Quote $quote)
|
public function transform(Quote $quote)
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
|
@ -222,7 +222,7 @@ class CreateUsersTable extends Migration
|
|||||||
$table->unsignedInteger('company_id')->index();
|
$table->unsignedInteger('company_id')->index();
|
||||||
$table->unsignedInteger('project_id')->nullable();
|
$table->unsignedInteger('project_id')->nullable();
|
||||||
$table->unsignedInteger('vendor_id')->nullable();
|
$table->unsignedInteger('vendor_id')->nullable();
|
||||||
$table->string('path')->nullable();
|
$table->string('url')->nullable();
|
||||||
$table->string('preview')->nullable();
|
$table->string('preview')->nullable();
|
||||||
$table->string('name')->nullable();
|
$table->string('name')->nullable();
|
||||||
$table->string('type')->nullable();
|
$table->string('type')->nullable();
|
||||||
|
@ -47,7 +47,7 @@ class CompanyDocumentsTest extends TestCase
|
|||||||
|
|
||||||
$this->assertNotNull($document);
|
$this->assertNotNull($document);
|
||||||
|
|
||||||
$this->assertTrue(Storage::exists($document->path));
|
$this->assertTrue(Storage::exists($document->url));
|
||||||
|
|
||||||
$this->assertGreaterThan($original_count, Document::whereCompanyId($this->company->id)->count());
|
$this->assertGreaterThan($original_count, Document::whereCompanyId($this->company->id)->count());
|
||||||
|
|
||||||
@ -55,6 +55,6 @@ class CompanyDocumentsTest extends TestCase
|
|||||||
|
|
||||||
$this->assertEquals(0, Document::whereCompanyId($this->company->id)->count());
|
$this->assertEquals(0, Document::whereCompanyId($this->company->id)->count());
|
||||||
|
|
||||||
$this->assertFalse(Storage::exists($document->path));
|
$this->assertFalse(Storage::exists($document->url));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user