mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-31 12:24:35 -04:00
Add activities to entities
This commit is contained in:
parent
85c05f7c30
commit
f3a56c8174
@ -45,9 +45,9 @@ class UpdateUserRequest extends Request
|
|||||||
{
|
{
|
||||||
$input = $this->all();
|
$input = $this->all();
|
||||||
|
|
||||||
if (isset($input['company_user']) && ! auth()->user()->isAdmin()) {
|
// if (isset($input['company_user']) && ! auth()->user()->isAdmin()) {
|
||||||
unset($input['company_user']);
|
// unset($input['company_user']);
|
||||||
}
|
// }
|
||||||
|
|
||||||
$this->replace($input);
|
$this->replace($input);
|
||||||
}
|
}
|
||||||
|
@ -89,10 +89,22 @@ class UserRepository extends BaseRepository
|
|||||||
$data['company_user']['notifications'] = CompanySettings::notificationDefaults();
|
$data['company_user']['notifications'] = CompanySettings::notificationDefaults();
|
||||||
$user->companies()->attach($company->id, $data['company_user']);
|
$user->companies()->attach($company->id, $data['company_user']);
|
||||||
} else {
|
} else {
|
||||||
$cu->fill($data['company_user']);
|
|
||||||
$cu->restore();
|
if(auth()->user()->isAdmin())
|
||||||
$cu->tokens()->restore();
|
{
|
||||||
$cu->save();
|
$cu->fill($data['company_user']);
|
||||||
|
$cu->restore();
|
||||||
|
$cu->tokens()->restore();
|
||||||
|
$cu->save();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
|
$cu->notifications = $data['company_user']['notifications'];
|
||||||
|
$cu->settings = $data['company_user']['settings'];
|
||||||
|
$cu->save();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$user->with(['company_users' => function ($query) use ($company, $user) {
|
$user->with(['company_users' => function ($query) use ($company, $user) {
|
||||||
|
@ -11,10 +11,12 @@
|
|||||||
|
|
||||||
namespace App\Transformers;
|
namespace App\Transformers;
|
||||||
|
|
||||||
|
use App\Models\Activity;
|
||||||
use App\Models\Backup;
|
use App\Models\Backup;
|
||||||
use App\Models\Credit;
|
use App\Models\Credit;
|
||||||
use App\Models\CreditInvitation;
|
use App\Models\CreditInvitation;
|
||||||
use App\Models\Document;
|
use App\Models\Document;
|
||||||
|
use App\Transformers\ActivityTransformer;
|
||||||
use App\Utils\Traits\MakesHash;
|
use App\Utils\Traits\MakesHash;
|
||||||
|
|
||||||
class CreditTransformer extends EntityTransformer
|
class CreditTransformer extends EntityTransformer
|
||||||
@ -31,8 +33,16 @@ class CreditTransformer extends EntityTransformer
|
|||||||
'history',
|
'history',
|
||||||
// 'client',
|
// 'client',
|
||||||
'documents',
|
'documents',
|
||||||
|
'activities',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
public function includeActivities(Credit $credit)
|
||||||
|
{
|
||||||
|
$transformer = new ActivityTransformer($this->serializer);
|
||||||
|
|
||||||
|
return $this->includeCollection($credit->activities, $transformer, Activity::class);
|
||||||
|
}
|
||||||
|
|
||||||
public function includeHistory(Credit $credit)
|
public function includeHistory(Credit $credit)
|
||||||
{
|
{
|
||||||
$transformer = new InvoiceHistoryTransformer($this->serializer);
|
$transformer = new InvoiceHistoryTransformer($this->serializer);
|
||||||
|
@ -11,12 +11,14 @@
|
|||||||
|
|
||||||
namespace App\Transformers;
|
namespace App\Transformers;
|
||||||
|
|
||||||
|
use App\Models\Activity;
|
||||||
use App\Models\Backup;
|
use App\Models\Backup;
|
||||||
use App\Models\Client;
|
use App\Models\Client;
|
||||||
use App\Models\Document;
|
use App\Models\Document;
|
||||||
use App\Models\Invoice;
|
use App\Models\Invoice;
|
||||||
use App\Models\InvoiceInvitation;
|
use App\Models\InvoiceInvitation;
|
||||||
use App\Models\Payment;
|
use App\Models\Payment;
|
||||||
|
use App\Transformers\ActivityTransformer;
|
||||||
use App\Utils\Traits\MakesHash;
|
use App\Utils\Traits\MakesHash;
|
||||||
|
|
||||||
class InvoiceTransformer extends EntityTransformer
|
class InvoiceTransformer extends EntityTransformer
|
||||||
@ -33,6 +35,7 @@ class InvoiceTransformer extends EntityTransformer
|
|||||||
'history',
|
'history',
|
||||||
'payments',
|
'payments',
|
||||||
'client',
|
'client',
|
||||||
|
'activities',
|
||||||
// 'documents',
|
// 'documents',
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -80,6 +83,14 @@ class InvoiceTransformer extends EntityTransformer
|
|||||||
return $this->includeCollection($invoice->documents, $transformer, Document::class);
|
return $this->includeCollection($invoice->documents, $transformer, Document::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function includeActivities(Invoice $invoice)
|
||||||
|
{
|
||||||
|
$transformer = new ActivityTransformer($this->serializer);
|
||||||
|
|
||||||
|
return $this->includeCollection($invoice->activities, $transformer, Activity::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public function transform(Invoice $invoice)
|
public function transform(Invoice $invoice)
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
|
@ -11,10 +11,12 @@
|
|||||||
|
|
||||||
namespace App\Transformers;
|
namespace App\Transformers;
|
||||||
|
|
||||||
|
use App\Models\Activity;
|
||||||
use App\Models\Backup;
|
use App\Models\Backup;
|
||||||
use App\Models\Document;
|
use App\Models\Document;
|
||||||
use App\Models\Quote;
|
use App\Models\Quote;
|
||||||
use App\Models\QuoteInvitation;
|
use App\Models\QuoteInvitation;
|
||||||
|
use App\Transformers\ActivityTransformer;
|
||||||
use App\Utils\Traits\MakesHash;
|
use App\Utils\Traits\MakesHash;
|
||||||
|
|
||||||
class QuoteTransformer extends EntityTransformer
|
class QuoteTransformer extends EntityTransformer
|
||||||
@ -30,10 +32,18 @@ class QuoteTransformer extends EntityTransformer
|
|||||||
'invitations',
|
'invitations',
|
||||||
'documents',
|
'documents',
|
||||||
'history',
|
'history',
|
||||||
|
'activities',
|
||||||
// 'payments',
|
// 'payments',
|
||||||
// 'client',
|
// 'client',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
public function includeActivities(Quote $quote)
|
||||||
|
{
|
||||||
|
$transformer = new ActivityTransformer($this->serializer);
|
||||||
|
|
||||||
|
return $this->includeCollection($quote->activities, $transformer, Activity::class);
|
||||||
|
}
|
||||||
|
|
||||||
public function includeHistory(Quote $quote)
|
public function includeHistory(Quote $quote)
|
||||||
{
|
{
|
||||||
$transformer = new InvoiceHistoryTransformer($this->serializer);
|
$transformer = new InvoiceHistoryTransformer($this->serializer);
|
||||||
|
@ -11,10 +11,12 @@
|
|||||||
|
|
||||||
namespace App\Transformers;
|
namespace App\Transformers;
|
||||||
|
|
||||||
|
use App\Models\Activity;
|
||||||
use App\Models\Document;
|
use App\Models\Document;
|
||||||
use App\Models\Invoice;
|
use App\Models\Invoice;
|
||||||
use App\Models\RecurringInvoice;
|
use App\Models\RecurringInvoice;
|
||||||
use App\Models\RecurringInvoiceInvitation;
|
use App\Models\RecurringInvoiceInvitation;
|
||||||
|
use App\Transformers\ActivityTransformer;
|
||||||
use App\Utils\Traits\MakesHash;
|
use App\Utils\Traits\MakesHash;
|
||||||
|
|
||||||
class RecurringInvoiceTransformer extends EntityTransformer
|
class RecurringInvoiceTransformer extends EntityTransformer
|
||||||
@ -29,6 +31,7 @@ class RecurringInvoiceTransformer extends EntityTransformer
|
|||||||
protected $availableIncludes = [
|
protected $availableIncludes = [
|
||||||
'invitations',
|
'invitations',
|
||||||
'documents',
|
'documents',
|
||||||
|
'activities',
|
||||||
// 'payments',
|
// 'payments',
|
||||||
// 'client',
|
// 'client',
|
||||||
];
|
];
|
||||||
@ -62,6 +65,13 @@ class RecurringInvoiceTransformer extends EntityTransformer
|
|||||||
return $this->includeItem($invoice->client, $transformer, ENTITY_CLIENT);
|
return $this->includeItem($invoice->client, $transformer, ENTITY_CLIENT);
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
public function includeActivities(RecurringInvoice $invoice)
|
||||||
|
{
|
||||||
|
$transformer = new ActivityTransformer($this->serializer);
|
||||||
|
|
||||||
|
return $this->includeCollection($invoice->activities, $transformer, Activity::class);
|
||||||
|
}
|
||||||
|
|
||||||
public function includeInvitations(RecurringInvoice $invoice)
|
public function includeInvitations(RecurringInvoice $invoice)
|
||||||
{
|
{
|
||||||
$transformer = new RecurringInvoiceInvitationTransformer($this->serializer);
|
$transformer = new RecurringInvoiceInvitationTransformer($this->serializer);
|
||||||
|
@ -14,7 +14,7 @@ class AddShowTaskEndDateToCompaniesTable extends Migration
|
|||||||
public function up()
|
public function up()
|
||||||
{
|
{
|
||||||
Schema::table('companies', function (Blueprint $table) {
|
Schema::table('companies', function (Blueprint $table) {
|
||||||
$table->boolean('show_task_end_date')->default('false');
|
$table->boolean('show_task_end_date')->default(false);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user