mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Remove redundant properties from account table and transformer
This commit is contained in:
parent
3aca9e701b
commit
8420a4bac1
@ -383,7 +383,7 @@ class DemoMode extends Command
|
||||
$invoice = $invoice->service()->markPaid()->save();
|
||||
|
||||
$invoice->payments->each(function ($payment){
|
||||
$payment->date = now()->addDays(rand(0,90));
|
||||
$payment->date = now()->addDays(rand(-30,30));
|
||||
$payment->save();
|
||||
});
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ class Handler extends ExceptionHandler
|
||||
* @var array
|
||||
*/
|
||||
protected $dontReport = [
|
||||
//
|
||||
\PDOException::class,
|
||||
];
|
||||
|
||||
/**
|
||||
@ -81,6 +81,7 @@ class Handler extends ExceptionHandler
|
||||
}
|
||||
});
|
||||
|
||||
app('sentry')->setRelease(config('ninja.app_version'));
|
||||
app('sentry')->captureException($exception);
|
||||
}
|
||||
|
||||
|
@ -35,7 +35,7 @@ class CanAddUserRule implements Rule
|
||||
*/
|
||||
public function passes($attribute, $value)
|
||||
{
|
||||
return $this->account->num_users < $this->account->pending_num_users;
|
||||
return $this->account->users->count() < $this->account->num_users;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -43,7 +43,7 @@ class CanAddUserRule implements Rule
|
||||
*/
|
||||
public function message()
|
||||
{
|
||||
return ctrans('texts.limit_users', ['limit' => $this->account->pending_num_users]);
|
||||
return ctrans('texts.limit_users', ['limit' => $this->account->num_users]);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -178,7 +178,7 @@ class BaseRepository
|
||||
|
||||
public function getInvitation($invitation, $resource)
|
||||
{
|
||||
if (!array_key_exists('key', $invitation)) {
|
||||
if (is_array($invitation) && !array_key_exists('key', $invitation)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -253,7 +253,15 @@ class BaseRepository
|
||||
|
||||
/* Get array of Keys which have been removed from the invitations array and soft delete each invitation */
|
||||
$model->invitations->pluck('key')->diff($invitations->pluck('key'))->each(function ($invitation) use($resource){
|
||||
$this->getInvitation($invitation, $resource)->delete();
|
||||
// $this->getInvitation($invitation, $resource)->delete();
|
||||
|
||||
$invitation_class = sprintf("App\\Models\\%sInvitation", $resource);
|
||||
|
||||
$invitation = $invitation_class::whereRaw("BINARY `key`= ?", [$invitation])->first();
|
||||
|
||||
if($invitation)
|
||||
$invitation->delete();
|
||||
|
||||
});
|
||||
|
||||
foreach ($data['invitations'] as $invitation) {
|
||||
|
@ -68,19 +68,12 @@ class AccountTransformer extends EntityTransformer
|
||||
'payment_id' => (string) $account->payment_id,
|
||||
'trial_started' => (string) $account->trial_started,
|
||||
'trial_plan' => (string) $account->trial_plan,
|
||||
'pending_plan' => (string) $account->pending_plan, // todo remove
|
||||
'pending_term' => (string) $account->pending_term, // todo remove
|
||||
'plan_price' => (float) $account->plan_price,
|
||||
'pending_plan_price' => (string) $account->pending_plan_price, //todo remove
|
||||
'num_users' => (int) $account->num_users,
|
||||
'pending_num_users' => (int) $account->pending_num_users,
|
||||
'utm_source' => (string) $account->utm_source,
|
||||
'utm_medium' => (string) $account->utm_medium,
|
||||
'utm_content' => (string) $account->utm_content,
|
||||
'utm_term' => (string) $account->utm_term,
|
||||
'discount' => (float) $account->discount, //todo delete
|
||||
'discount_expires' => (string) $account->discount_expires, //todo delete
|
||||
'bluevine_status' => (string) $account->bluevine_status, //todo delete this
|
||||
'referral_code' => (string) $account->referral_code,
|
||||
'latest_version' => (string)$account->latest_version,
|
||||
'current_version' => (string)config('ninja.app_version'),
|
||||
|
@ -8,7 +8,7 @@ return [
|
||||
'license' => env('NINJA_LICENSE', ''),
|
||||
'version_url' => 'https://raw.githubusercontent.com/invoiceninja/invoiceninja/v2/VERSION.txt',
|
||||
'app_name' => env('APP_NAME'),
|
||||
'app_env' => env('APP_ENV', 'local'),
|
||||
'app_env' => env('APP_ENV', 'selfhosted'),
|
||||
'require_https' => env('REQUIRE_HTTPS', true),
|
||||
'app_url' => env('APP_URL', ''),
|
||||
'app_domain' => env('APP_DOMAIN', ''),
|
||||
|
30
config/sentry.php
Normal file
30
config/sentry.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'dsn' => env('SENTRY_LARAVEL_DSN', env('SENTRY_DSN')),
|
||||
|
||||
// capture release as git sha
|
||||
// 'release' => trim(exec('git --git-dir ' . base_path('.git') . ' log --pretty="%h" -n1 HEAD')),
|
||||
|
||||
'breadcrumbs' => [
|
||||
// Capture Laravel logs in breadcrumbs
|
||||
'logs' => true,
|
||||
|
||||
// Capture SQL queries in breadcrumbs
|
||||
'sql_queries' => true,
|
||||
|
||||
// Capture bindings on SQL queries logged in breadcrumbs
|
||||
'sql_bindings' => true,
|
||||
|
||||
// Capture queue job information in breadcrumbs
|
||||
'queue_info' => true,
|
||||
|
||||
// Capture command information in breadcrumbs
|
||||
'command_info' => true,
|
||||
],
|
||||
|
||||
// @see: https://docs.sentry.io/error-reporting/configuration/?platform=php#send-default-pii
|
||||
'send_default_pii' => false,
|
||||
|
||||
];
|
@ -112,13 +112,8 @@ class CreateUsersTable extends Migration
|
||||
$table->date('trial_started')->nullable();
|
||||
$table->enum('trial_plan', ['pro', 'enterprise'])->nullable();
|
||||
|
||||
$table->enum('pending_plan', ['pro', 'enterprise', 'free'])->nullable();
|
||||
$table->enum('pending_term', ['month', 'year'])->nullable();
|
||||
|
||||
$table->decimal('plan_price', 7, 2)->nullable();
|
||||
$table->decimal('pending_plan_price', 7, 2)->nullable();
|
||||
$table->smallInteger('num_users')->default(1);
|
||||
$table->smallInteger('pending_num_users')->default(1);
|
||||
|
||||
$table->string('utm_source')->nullable();
|
||||
$table->string('utm_medium')->nullable();
|
||||
@ -128,10 +123,6 @@ class CreateUsersTable extends Migration
|
||||
$table->string('latest_version')->default('0.0.0');
|
||||
$table->boolean('report_errors')->default(false);
|
||||
|
||||
$table->float('discount')->default(0);
|
||||
$table->date('discount_expires')->nullable();
|
||||
|
||||
$table->enum('bluevine_status', ['ignored', 'signed_up'])->nullable();
|
||||
$table->string('referral_code')->nullable();
|
||||
|
||||
$table->timestamps(6);
|
||||
|
@ -41,7 +41,7 @@ class CompareObjectTest extends TestCase
|
||||
|
||||
$this->assertEquals($build_client_settings->timezone_id, 1);
|
||||
$this->assertEquals($build_client_settings->language_id, 1);
|
||||
$this->assertEquals($build_client_settings->payment_terms, '-1');
|
||||
$this->assertEquals($build_client_settings->payment_terms, '');
|
||||
}
|
||||
|
||||
public function testDirectClientSettingsBuild()
|
||||
@ -50,7 +50,7 @@ class CompareObjectTest extends TestCase
|
||||
|
||||
$this->assertEquals($settings->timezone_id, 1);
|
||||
$this->assertEquals($settings->language_id, 1);
|
||||
$this->assertEquals($settings->payment_terms, '-1');
|
||||
$this->assertEquals($settings->payment_terms, '');
|
||||
$this->assertFalse($settings->auto_archive_invoice);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user