1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-08 12:12:48 +01:00

Laravel 7.x Shift (#40)

* Adopt Laravel coding style

The Laravel framework adopts the PSR-2 coding style with some additions.
Laravel apps *should* adopt this coding style as well.

However, Shift allows you to customize the adopted coding style by
adding your own [PHP CS Fixer][1] `.php_cs` config to your project.

You may use [Shift's .php_cs][2] file as a base.

[1]: https://github.com/FriendsOfPHP/PHP-CS-Fixer
[2]: https://gist.github.com/laravel-shift/cab527923ed2a109dda047b97d53c200

* Shift bindings

PHP 5.5.9+ adds the new static `class` property which provides the fully qualified class name. This is preferred over using class name strings as these references are checked by the parser.

* Shift core files

* Shift to Throwable

* Add laravel/ui dependency

* Unindent vendor mail templates

* Shift config files

* Default config files

In an effort to make upgrading the constantly changing config files
easier, Shift defaulted them so you can review the commit diff for
changes. Moving forward, you should use ENV variables or create a
separate config file to allow the core config files to remain
automatically upgradeable.

* Shift Laravel dependencies

* Shift cleanup

* Upgrade to Laravel 7

Co-authored-by: Laravel Shift <shift@laravelshift.com>
This commit is contained in:
David Bomba 2020-09-06 19:38:10 +10:00 committed by GitHub
parent 08de7be767
commit ba75a44eb8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1153 changed files with 10632 additions and 11488 deletions

View File

@ -16,7 +16,7 @@ DB_PASSWORD=ninja
DB_CONNECTION=db-ninja-01
DB_DATABASE1=db-ninja-01
DB_DATABASE2=db-ninja-02
MAIL_DRIVER=log
MAIL_MAILER=log
MAIL_PORT=587
MAIL_ENCRYPTION=tls
MAIL_HOST=

View File

@ -33,7 +33,7 @@ REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_DRIVER=smtp
MAIL_MAILER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null

View File

@ -14,7 +14,7 @@ DB_CONNECTION=db-ninja-01
DB_DATABASE1=ninja01
DB_DATABASE2=ninja02
MAIL_DRIVER=log
MAIL_MAILER=log
TRAVIS=true
API_SECRET=password
TEST_USERNAME=user@example.com

View File

@ -70,13 +70,12 @@ class CheckData extends Command
public function handle()
{
$this->logMessage(date('Y-m-d h:i:s') . ' Running CheckData...');
$this->logMessage(date('Y-m-d h:i:s').' Running CheckData...');
if ($database = $this->option('database')) {
config(['database.default' => $database]);
}
$this->checkInvoiceBalances();
$this->checkInvoicePayments();
$this->checkPaidToDates();
@ -93,25 +92,25 @@ class CheckData extends Command
$this->checkFailedJobs();
}
$this->logMessage('Done: ' . strtoupper($this->isValid ? Account::RESULT_SUCCESS : Account::RESULT_FAILURE));
$this->logMessage('Done: '.strtoupper($this->isValid ? Account::RESULT_SUCCESS : Account::RESULT_FAILURE));
$errorEmail = config('ninja.error_email');
if ($errorEmail) {
Mail::raw($this->log, function ($message) use ($errorEmail, $database) {
$message->to($errorEmail)
->from(config('ninja.error_email'))
->subject("Check-Data: " . strtoupper($this->isValid ? Account::RESULT_SUCCESS : Account::RESULT_FAILURE) . " [{$database}]");
->subject('Check-Data: '.strtoupper($this->isValid ? Account::RESULT_SUCCESS : Account::RESULT_FAILURE)." [{$database}]");
});
} elseif (! $this->isValid) {
throw new Exception("Check data failed!!\n" . $this->log);
throw new Exception("Check data failed!!\n".$this->log);
}
}
private function logMessage($str)
{
$str = date('Y-m-d h:i:s') . ' ' . $str;
$str = date('Y-m-d h:i:s').' '.$str;
$this->info($str);
$this->log .= $str . "\n";
$this->log .= $str."\n";
}
private function checkOAuth()
@ -123,7 +122,7 @@ class CheckData extends Command
->havingRaw('count(users.id) > 1')
->get(['users.oauth_user_id']);
$this->logMessage($users->count() . ' users with duplicate oauth ids');
$this->logMessage($users->count().' users with duplicate oauth ids');
if ($users->count() > 0) {
$this->isValid = false;
@ -132,7 +131,7 @@ class CheckData extends Command
if ($this->option('fix') == 'true') {
foreach ($users as $user) {
$first = true;
$this->logMessage('checking ' . $user->oauth_user_id);
$this->logMessage('checking '.$user->oauth_user_id);
$matches = DB::table('users')
->where('oauth_user_id', '=', $user->oauth_user_id)
->orderBy('id')
@ -140,11 +139,11 @@ class CheckData extends Command
foreach ($matches as $match) {
if ($first) {
$this->logMessage('skipping ' . $match->id);
$this->logMessage('skipping '.$match->id);
$first = false;
continue;
}
$this->logMessage('updating ' . $match->id);
$this->logMessage('updating '.$match->id);
DB::table('users')
->where('id', '=', $match->id)
@ -165,7 +164,7 @@ class CheckData extends Command
->whereNull('contact_key')
->orderBy('id')
->get(['id']);
$this->logMessage($contacts->count() . ' contacts without a contact_key');
$this->logMessage($contacts->count().' contacts without a contact_key');
if ($contacts->count() > 0) {
$this->isValid = false;
@ -184,7 +183,7 @@ class CheckData extends Command
// check for missing contacts
$clients = DB::table('clients')
->leftJoin('client_contacts', function($join) {
->leftJoin('client_contacts', function ($join) {
$join->on('client_contacts.client_id', '=', 'clients.id')
->whereNull('client_contacts.deleted_at');
})
@ -196,7 +195,7 @@ class CheckData extends Command
}
$clients = $clients->get(['clients.id', 'clients.user_id', 'clients.company_id']);
$this->logMessage($clients->count() . ' clients without any contacts');
$this->logMessage($clients->count().' clients without any contacts');
if ($clients->count() > 0) {
$this->isValid = false;
@ -217,7 +216,7 @@ class CheckData extends Command
// check for more than one primary contact
$clients = DB::table('clients')
->leftJoin('client_contacts', function($join) {
->leftJoin('client_contacts', function ($join) {
$join->on('client_contacts.client_id', '=', 'clients.id')
->where('client_contacts.is_primary', '=', true)
->whereNull('client_contacts.deleted_at');
@ -230,7 +229,7 @@ class CheckData extends Command
}
$clients = $clients->get(['clients.id', DB::raw('count(client_contacts.id)')]);
$this->logMessage($clients->count() . ' clients without a single primary contact');
$this->logMessage($clients->count().' clients without a single primary contact');
if ($clients->count() > 0) {
$this->isValid = false;
@ -250,7 +249,7 @@ class CheckData extends Command
$this->isValid = false;
}
$this->logMessage($count . ' failed jobs');
$this->logMessage($count.' failed jobs');
}
private function checkInvitations()
@ -264,7 +263,7 @@ class CheckData extends Command
->havingRaw('count(invoice_invitations.id) = 0')
->get(['invoices.id', 'invoices.user_id', 'invoices.company_id', 'invoices.client_id']);
$this->logMessage($invoices->count() . ' invoices without any invitations');
$this->logMessage($invoices->count().' invoices without any invitations');
if ($invoices->count() > 0) {
$this->isValid = false;
@ -285,134 +284,108 @@ class CheckData extends Command
private function checkInvoiceBalances()
{
$wrong_balances = 0;
$wrong_paid_to_dates = 0;
foreach(Client::cursor() as $client)
{
foreach (Client::cursor() as $client) {
$invoice_balance = $client->invoices->where('is_deleted', false)->where('status_id', '>', 1)->sum('balance');
$ledger = CompanyLedger::where('client_id', $client->id)->orderBy('id', 'DESC')->first();
if($ledger && number_format($invoice_balance, 4) != number_format($client->balance, 4))
{
if ($ledger && number_format($invoice_balance, 4) != number_format($client->balance, 4)) {
$wrong_balances++;
$this->logMessage($client->present()->name . " - " . $client->id . " - balances do not match Invoice Balance = {$invoice_balance} Client Balance = {$client->balance} Ledger Balance = {$ledger->balance}");
$this->logMessage($client->present()->name.' - '.$client->id." - balances do not match Invoice Balance = {$invoice_balance} Client Balance = {$client->balance} Ledger Balance = {$ledger->balance}");
$this->isValid = false;
}
}
}
$this->logMessage("{$wrong_balances} clients with incorrect balances");
$this->logMessage("{$wrong_balances} clients with incorrect balances");
}
private function checkPaidToDates()
{
$wrong_paid_to_dates = 0;
Client::withTrashed()->cursor()->each(function ($client) use($wrong_paid_to_dates){
Client::withTrashed()->cursor()->each(function ($client) use ($wrong_paid_to_dates) {
$total_invoice_payments = 0;
$total_invoice_payments = 0;
foreach($client->invoices as $invoice)
{
foreach ($client->invoices as $invoice) {
$total_amount = $invoice->payments->sum('pivot.amount');
$total_refund = $invoice->payments->sum('pivot.refunded');
$total_invoice_payments += ($total_amount - $total_refund);
}
if(round($total_invoice_payments,2) != round($client->paid_to_date,2)) {
if (round($total_invoice_payments, 2) != round($client->paid_to_date, 2)) {
$wrong_paid_to_dates++;
$this->logMessage($client->present()->name . " - " . $client->id . " - Paid to date does not match Client Paid To Date = {$client->paid_to_date} - Invoice Payments = {$total_invoice_payments}");
$this->logMessage($client->present()->name.' - '.$client->id." - Paid to date does not match Client Paid To Date = {$client->paid_to_date} - Invoice Payments = {$total_invoice_payments}");
$this->isValid = false;
}
});
$this->logMessage("{$wrong_paid_to_dates} clients with incorrect paid to dates");
}
private function checkInvoicePayments()
{
$wrong_balances = 0;
$wrong_paid_to_dates = 0;
//todo reversing an invoice breaks the check data at this point;
Client::cursor()->each(function ($client) use($wrong_balances){
$client->invoices->where('is_deleted', false)->each(function ($invoice) use($wrong_balances, $client){
Client::cursor()->each(function ($client) use ($wrong_balances) {
$client->invoices->where('is_deleted', false)->each(function ($invoice) use ($wrong_balances, $client) {
$total_amount = $invoice->payments->sum('pivot.amount');
$total_refund = $invoice->payments->sum('pivot.refunded');
$total_credit = $invoice->credits->sum('amount');
$total_paid = $total_amount - $total_refund;
if($total_paid != ($invoice->amount - $invoice->balance - $total_credit)) {
if ($total_paid != ($invoice->amount - $invoice->balance - $total_credit)) {
$wrong_balances++;
$this->logMessage($client->present()->name . " - " . $client->id . " - balances do not match Invoice Amount = {$invoice->amount} - Invoice Balance = {$invoice->balance} Total paid = {$total_paid}");
$this->logMessage($client->present()->name.' - '.$client->id." - balances do not match Invoice Amount = {$invoice->amount} - Invoice Balance = {$invoice->balance} Total paid = {$total_paid}");
$this->isValid = false;
}
});
});
$this->logMessage("{$wrong_balances} clients with incorrect invoice balances");
$this->logMessage("{$wrong_balances} clients with incorrect invoice balances");
}
private function checkClientBalances()
{
$wrong_balances = 0;
$wrong_paid_to_dates = 0;
foreach(Client::cursor() as $client)
{
foreach (Client::cursor() as $client) {
$invoice_balance = $client->invoices->sum('balance');
$invoice_amounts = $client->invoices->sum('amount') - $invoice_balance;
$credit_amounts = 0;
foreach($client->invoices as $invoice)
{
foreach ($client->invoices as $invoice) {
$credit_amounts += $invoice->credits->sum('amount');
};
}
/*To handle invoice reversals, we need to "ADD BACK" the credit amounts here*/
$client_paid_to_date = $client->paid_to_date + $credit_amounts;
$ledger = CompanyLedger::where('client_id', $client->id)->orderBy('id', 'DESC')->first();
if($ledger && (string)$invoice_amounts != (string)$client_paid_to_date)
{
if ($ledger && (string) $invoice_amounts != (string) $client_paid_to_date) {
$wrong_paid_to_dates++;
$this->logMessage($client->present()->name . " - " . $client->id . " - client paid to dates do not match {$invoice_amounts} - " .rtrim($client_paid_to_date, "0"));
$this->logMessage($client->present()->name.' - '.$client->id." - client paid to dates do not match {$invoice_amounts} - ".rtrim($client_paid_to_date, '0'));
$this->isValid = false;
}
}
}
$this->logMessage("{$wrong_paid_to_dates} clients with incorrect paid_to_dates");
$this->logMessage("{$wrong_paid_to_dates} clients with incorrect paid_to_dates");
}
private function checkLogoFiles()
@ -460,7 +433,6 @@ class CheckData extends Command
];
}
private function checkCompanyData()
{
$tables = [
@ -497,29 +469,24 @@ class CheckData extends Command
if ($records->count()) {
$this->isValid = false;
$this->logMessage($records->count() . " {$table} records with incorrect {$entityType} company id");
$this->logMessage($records->count()." {$table} records with incorrect {$entityType} company id");
}
}
}
// foreach(User::cursor() as $user) {
// $records = Company::where('account_id',)
// }
}
public function pluralizeEntityType($type)
{
if ($type === 'company') {
return 'companies';
}
}
return $type . 's';
return $type.'s';
}
}

View File

@ -81,7 +81,6 @@ class CreateTestData extends Command
$this->createLargeAccount();
}
private function createSmallAccount()
{
$this->info('Creating Small Account and Company');
@ -92,20 +91,19 @@ class CreateTestData extends Command
'slack_webhook_url' => config('ninja.notification.slack'),
]);
$account->default_company_id = $company->id;
$account->save();
$user = User::whereEmail('small@example.com')->first();
if (!$user) {
if (! $user) {
$user = factory(\App\Models\User::class)->create([
'account_id' => $account->id,
'email' => 'small@example.com',
'confirmation_code' => $this->createDbHash(config('database.default'))
'confirmation_code' => $this->createDbHash(config('database.default')),
]);
}
$company_token = new CompanyToken;
$company_token->user_id = $user->id;
$company_token->company_id = $company->id;
@ -131,17 +129,16 @@ class CreateTestData extends Command
'company_id' => $company->id,
]);
$this->info('Creating '.$this->count. ' clients');
$this->info('Creating '.$this->count.' clients');
for ($x=0; $x<$this->count; $x++) {
$z = $x+1;
$this->info("Creating client # ".$z);
for ($x = 0; $x < $this->count; $x++) {
$z = $x + 1;
$this->info('Creating client # '.$z);
$this->createClient($company, $user);
}
for($x=0; $x<$this->count; $x++)
{
for ($x = 0; $x < $this->count; $x++) {
$client = $company->clients->random();
$this->info('creating invoice for client #'.$client->id);
@ -177,7 +174,6 @@ class CreateTestData extends Command
$this->info('creating project for client #'.$client->id);
$this->createProject($client);
}
}
private function createMediumAccount()
@ -195,11 +191,11 @@ class CreateTestData extends Command
$user = User::whereEmail('medium@example.com')->first();
if (!$user) {
if (! $user) {
$user = factory(\App\Models\User::class)->create([
'account_id' => $account->id,
'email' => 'medium@example.com',
'confirmation_code' => $this->createDbHash(config('database.default'))
'confirmation_code' => $this->createDbHash(config('database.default')),
]);
}
@ -222,25 +218,23 @@ class CreateTestData extends Command
'settings' => null,
]);
factory(\App\Models\Product::class, 50)->create([
'user_id' => $user->id,
'company_id' => $company->id,
]);
$this->count = $this->count*10;
$this->count = $this->count * 10;
$this->info('Creating '.$this->count. ' clients');
$this->info('Creating '.$this->count.' clients');
for ($x=0; $x<$this->count; $x++) {
$z = $x+1;
$this->info("Creating client # ".$z);
for ($x = 0; $x < $this->count; $x++) {
$z = $x + 1;
$this->info('Creating client # '.$z);
$this->createClient($company, $user);
}
for($x=0; $x<$this->count*100; $x++)
{
for ($x = 0; $x < $this->count * 100; $x++) {
$client = $company->clients->random();
$this->info('creating invoice for client #'.$client->id);
@ -294,11 +288,11 @@ class CreateTestData extends Command
$user = User::whereEmail('large@example.com')->first();
if (!$user) {
if (! $user) {
$user = factory(\App\Models\User::class)->create([
'account_id' => $account->id,
'email' => 'large@example.com',
'confirmation_code' => $this->createDbHash(config('database.default'))
'confirmation_code' => $this->createDbHash(config('database.default')),
]);
}
@ -321,26 +315,23 @@ class CreateTestData extends Command
'settings' => null,
]);
factory(\App\Models\Product::class, 15000)->create([
'user_id' => $user->id,
'company_id' => $company->id,
]);
$this->count = $this->count*100;
$this->count = $this->count * 100;
$this->info('Creating '.$this->count. ' clients');
$this->info('Creating '.$this->count.' clients');
for ($x=0; $x<$this->count*500; $x++) {
$z = $x+1;
$this->info("Creating client # ".$z);
for ($x = 0; $x < $this->count * 500; $x++) {
$z = $x + 1;
$this->info('Creating client # '.$z);
$this->createClient($company, $user);
}
for($x=0; $x<$this->count; $x++)
{
for ($x = 0; $x < $this->count; $x++) {
$client = $company->clients->random();
$this->info('creating invoice for client #'.$client->id);
@ -382,37 +373,36 @@ class CreateTestData extends Command
{
// dispatch(function () use ($company, $user) {
// });
$client = factory(\App\Models\Client::class)->create([
'user_id' => $user->id,
'company_id' => $company->id
'company_id' => $company->id,
]);
factory(\App\Models\ClientContact::class, 1)->create([
'user_id' => $user->id,
'client_id' => $client->id,
'company_id' => $company->id,
'is_primary' => 1
'is_primary' => 1,
]);
factory(\App\Models\ClientContact::class, rand(1, 5))->create([
'user_id' => $user->id,
'client_id' => $client->id,
'company_id' => $company->id
'company_id' => $company->id,
]);
$client->id_number = $this->getNextClientNumber($client);
$settings = $client->settings;
$settings->currency_id = (string)rand(1,79);
$settings->currency_id = (string) rand(1, 79);
$client->settings = $settings;
$country = Country::all()->random();
$client->country_id = $country->id;
$client->save();
}
private function createExpense($client)
@ -420,7 +410,7 @@ class CreateTestData extends Command
factory(\App\Models\Expense::class, rand(1, 5))->create([
'user_id' => $client->user->id,
'client_id' => $client->id,
'company_id' => $client->company->id
'company_id' => $client->company->id,
]);
}
@ -428,22 +418,21 @@ class CreateTestData extends Command
{
$vendor = factory(\App\Models\Vendor::class)->create([
'user_id' => $client->user->id,
'company_id' => $client->company->id
'company_id' => $client->company->id,
]);
factory(\App\Models\VendorContact::class, 1)->create([
'user_id' => $client->user->id,
'vendor_id' => $vendor->id,
'company_id' => $client->company->id,
'is_primary' => 1
'is_primary' => 1,
]);
factory(\App\Models\VendorContact::class, rand(1, 5))->create([
'user_id' => $client->user->id,
'vendor_id' => $vendor->id,
'company_id' => $client->company->id,
'is_primary' => 0
'is_primary' => 0,
]);
}
@ -451,7 +440,7 @@ class CreateTestData extends Command
{
$vendor = factory(\App\Models\Task::class)->create([
'user_id' => $client->user->id,
'company_id' => $client->company->id
'company_id' => $client->company->id,
]);
}
@ -459,7 +448,7 @@ class CreateTestData extends Command
{
$vendor = factory(\App\Models\Project::class)->create([
'user_id' => $client->user->id,
'company_id' => $client->company->id
'company_id' => $client->company->id,
]);
}
@ -471,7 +460,7 @@ class CreateTestData extends Command
$faker = \Faker\Factory::create();
$invoice = InvoiceFactory::create($client->company->id, $client->user->id);//stub the company and user_id
$invoice = InvoiceFactory::create($client->company->id, $client->user->id); //stub the company and user_id
$invoice->client_id = $client->id;
// $invoice->date = $faker->date();
$dateable = Carbon::now()->subDays(rand(0, 90));
@ -511,9 +500,7 @@ class CreateTestData extends Command
$this->invoice_repo->markSent($invoice);
if (rand(0, 1)) {
$invoice = $invoice->service()->markPaid()->save();
}
//@todo this slow things down, but gives us PDFs of the invoices for inspection whilst debugging.
event(new InvoiceWasCreated($invoice, $invoice->company, Ninja::eventVars()));
@ -572,10 +559,10 @@ class CreateTestData extends Command
$faker = \Faker\Factory::create();
//$quote = QuoteFactory::create($client->company->id, $client->user->id);//stub the company and user_id
$quote =factory(\App\Models\Quote::class)->create(['user_id' => $client->user->id, 'company_id' => $client->company->id, 'client_id' => $client->id]);
$quote = factory(\App\Models\Quote::class)->create(['user_id' => $client->user->id, 'company_id' => $client->company->id, 'client_id' => $client->id]);
$quote->date = $faker->date();
$quote->client_id = $client->id;
$quote->setRelation('client', $client);
$quote->line_items = $this->buildLineItems(rand(1, 10));
@ -613,7 +600,7 @@ class CreateTestData extends Command
{
$line_items = [];
for ($x=0; $x<$count; $x++) {
for ($x = 0; $x < $count; $x++) {
$item = InvoiceItemFactory::create();
$item->quantity = 1;
//$item->cost = 10;
@ -635,7 +622,7 @@ class CreateTestData extends Command
$product = Product::all()->random();
$item->cost = (float)$product->cost;
$item->cost = (float) $product->cost;
$item->product_key = $product->product_key;
$item->notes = $product->notes;
$item->custom_value1 = $product->custom_value1;
@ -643,8 +630,6 @@ class CreateTestData extends Command
$item->custom_value3 = $product->custom_value3;
$item->custom_value4 = $product->custom_value4;
$line_items[] = $item;
}

View File

@ -21,8 +21,8 @@ use Carbon\Carbon;
use Composer\Composer;
use Composer\Console\Application;
use Composer\Factory;
use Composer\IO\NullIO;
use Composer\Installer;
use Composer\IO\NullIO;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Artisan;
use Illuminate\Support\Facades\Cache;
@ -53,7 +53,7 @@ class DemoMode extends Command
protected $description = 'Setup demo mode';
protected $invoice_repo;
public function __construct(InvoiceRepository $invoice_repo)
{
parent::__construct();
@ -71,7 +71,7 @@ class DemoMode extends Command
set_time_limit(0);
$cached_tables = config('ninja.cached_tables');
foreach ($cached_tables as $name => $class) {
if (! Cache::has($name)) {
// check that the table exists in case the migration is pending
@ -94,25 +94,20 @@ class DemoMode extends Command
}
}
$this->info("Migrating");
$this->info('Migrating');
Artisan::call('migrate:fresh --force');
$this->info("Seeding");
$this->info('Seeding');
Artisan::call('db:seed --force');
$this->info("Seeding Random Data");
$this->info('Seeding Random Data');
$this->createSmallAccount();
VersionCheck::dispatchNow();
CompanySizeCheck::dispatchNow();
}
private function createSmallAccount()
{
$faker = \Faker\Factory::create();
@ -127,10 +122,10 @@ class DemoMode extends Command
'slack_webhook_url' => config('ninja.notification.slack'),
'enabled_modules' => 32767,
'company_key' => 'KEY',
'enable_shop_api' => true
'enable_shop_api' => true,
]);
$settings = $company->settings;
$settings = $company->settings;
$settings->name = $faker->company;
$settings->address1 = $faker->buildingNumber;
@ -139,25 +134,25 @@ class DemoMode extends Command
$settings->state = $faker->state;
$settings->postal_code = $faker->postcode;
$settings->website = $faker->url;
$settings->vat_number = (string)$faker->numberBetween(123456789, 987654321);
$settings->phone = (string)$faker->phoneNumber;
$settings->vat_number = (string) $faker->numberBetween(123456789, 987654321);
$settings->phone = (string) $faker->phoneNumber;
$company->settings = $settings;
$company->save();
$company->settings = $settings;
$company->save();
$account->default_company_id = $company->id;
$account->save();
$user = User::whereEmail('small@example.com')->first();
if (!$user) {
if (! $user) {
$user = factory(\App\Models\User::class)->create([
'account_id' => $account->id,
'email' => 'small@example.com',
'confirmation_code' => $this->createDbHash(config('database.default'))
'confirmation_code' => $this->createDbHash(config('database.default')),
]);
}
$company_token = new CompanyToken;
$company_token->user_id = $user->id;
$company_token->company_id = $company->id;
@ -165,7 +160,7 @@ class DemoMode extends Command
$company_token->name = 'test token';
$company_token->token = Str::random(64);
$company_token->is_system = true;
$company_token->save();
$user->companies()->attach($company->id, [
@ -180,13 +175,12 @@ class DemoMode extends Command
$u2 = User::where('email', 'demo@invoiceninja.com')->first();
if(!$u2){
if (! $u2) {
$u2 = factory(\App\Models\User::class)->create([
'email' => 'demo@invoiceninja.com',
'password' => Hash::make('demo'),
'account_id' => $account->id,
'confirmation_code' => $this->createDbHash(config('database.default'))
'confirmation_code' => $this->createDbHash(config('database.default')),
]);
$company_token = new CompanyToken;
@ -213,43 +207,41 @@ class DemoMode extends Command
'company_id' => $company->id,
]);
$this->info('Creating '.$this->count. ' clients');
$this->info('Creating '.$this->count.' clients');
for ($x=0; $x<$this->count; $x++) {
$z = $x+1;
$this->info("Creating client # ".$z);
for ($x = 0; $x < $this->count; $x++) {
$z = $x + 1;
$this->info('Creating client # '.$z);
$this->createClient($company, $user, $u2->id);
}
for($x=0; $x<$this->count; $x++)
{
for ($x = 0; $x < $this->count; $x++) {
$client = $company->clients->random();
$this->info('creating entities for client #'.$client->id);
$this->createInvoice($client, $u2->id);
$this->createInvoice($client, $u2->id);
// for($y=0; $y<($this->count); $y++){
// $this->info("creating invoice #{$y} for client #".$client->id);
// }
$client = $company->clients->random();
$this->createCredit($client, $u2->id);
$this->createCredit($client, $u2->id);
// for($y=0; $y<($this->count); $y++){
// $this->info("creating credit #{$y} for client #".$client->id);
// }
$client = $company->clients->random();
$this->createQuote($client, $u2->id);
$this->createQuote($client, $u2->id);
// for($y=0; $y<($this->count); $y++){
// $this->info("creating quote #{$y} for client #".$client->id);
// }
$client = $company->clients->random();
$this->createExpense($client, $u2->id);
$this->createExpense($client, $u2->id);
//$this->info("creating expense for client #".$client->id);
@ -268,45 +260,44 @@ class DemoMode extends Command
// $this->info("creating project for client #".$client->id);
}
}
private function createClient($company, $user, $assigned_user_id = null)
{
// dispatch(function () use ($company, $user) {
// });
$client = factory(\App\Models\Client::class)->create([
'user_id' => $user->id,
'company_id' => $company->id
'company_id' => $company->id,
]);
factory(\App\Models\ClientContact::class)->create([
'user_id' => $user->id,
'client_id' => $client->id,
'company_id' => $company->id,
'is_primary' => 1
'is_primary' => 1,
]);
factory(\App\Models\ClientContact::class, rand(1, 5))->create([
'user_id' => $user->id,
'client_id' => $client->id,
'company_id' => $company->id
'company_id' => $company->id,
]);
$client->id_number = $this->getNextClientNumber($client);
$settings = $client->settings;
$settings->currency_id = (string)rand(1,3);
$settings->currency_id = (string) rand(1, 3);
$client->settings = $settings;
if(rand(0,1))
if (rand(0, 1)) {
$client->assigned_user_id = $assigned_user_id;
}
$client->country_id = array_rand([36,392,840,124,276,826]);
$client->country_id = array_rand([36, 392, 840, 124, 276, 826]);
$client->save();
}
private function createExpense($client)
@ -314,7 +305,7 @@ class DemoMode extends Command
factory(\App\Models\Expense::class, rand(1, 5))->create([
'user_id' => $client->user_id,
'client_id' => $client->id,
'company_id' => $client->company_id
'company_id' => $client->company_id,
]);
}
@ -322,22 +313,21 @@ class DemoMode extends Command
{
$vendor = factory(\App\Models\Vendor::class)->create([
'user_id' => $client->user_id,
'company_id' => $client->company_id
'company_id' => $client->company_id,
]);
factory(\App\Models\VendorContact::class)->create([
'user_id' => $client->user->id,
'vendor_id' => $vendor->id,
'company_id' => $client->company_id,
'is_primary' => 1
'is_primary' => 1,
]);
factory(\App\Models\VendorContact::class, rand(1, 5))->create([
'user_id' => $client->user->id,
'vendor_id' => $vendor->id,
'company_id' => $client->company_id,
'is_primary' => 0
'is_primary' => 0,
]);
}
@ -345,7 +335,7 @@ class DemoMode extends Command
{
$vendor = factory(\App\Models\Task::class)->create([
'user_id' => $client->user->id,
'company_id' => $client->company_id
'company_id' => $client->company_id,
]);
}
@ -353,7 +343,7 @@ class DemoMode extends Command
{
$vendor = factory(\App\Models\Project::class)->create([
'user_id' => $client->user->id,
'company_id' => $client->company_id
'company_id' => $client->company_id,
]);
}
@ -365,13 +355,14 @@ class DemoMode extends Command
$faker = \Faker\Factory::create();
$invoice = InvoiceFactory::create($client->company->id, $client->user->id);//stub the company and user_id
$invoice = InvoiceFactory::create($client->company->id, $client->user->id); //stub the company and user_id
$invoice->client_id = $client->id;
if((bool)rand(0,1))
if ((bool) rand(0, 1)) {
$dateable = Carbon::now()->subDays(rand(0, 90));
else
} else {
$dateable = Carbon::now()->addDays(rand(0, 90));
}
$invoice->date = $dateable;
@ -393,8 +384,8 @@ class DemoMode extends Command
$invoice->tax_rate3 = 5;
}
// $invoice->custom_value1 = $faker->date;
// $invoice->custom_value2 = rand(0, 1) ? 'yes' : 'no';
// $invoice->custom_value1 = $faker->date;
// $invoice->custom_value2 = rand(0, 1) ? 'yes' : 'no';
$invoice->save();
@ -403,20 +394,20 @@ class DemoMode extends Command
$invoice = $invoice_calc->getInvoice();
if(rand(0,1))
if (rand(0, 1)) {
$invoice->assigned_user_id = $assigned_user_id;
}
$invoice->save();
$invoice->service()->createInvitations()->markSent();
$this->invoice_repo->markSent($invoice);
if ((bool)rand(0, 2)) {
if ((bool) rand(0, 2)) {
$invoice = $invoice->service()->markPaid()->save();
$invoice->payments->each(function ($payment){
$payment->date = now()->addDays(rand(-30,30));
$invoice->payments->each(function ($payment) {
$payment->date = now()->addDays(rand(-30, 30));
$payment->save();
});
}
@ -435,10 +426,11 @@ class DemoMode extends Command
$credit = factory(\App\Models\Credit::class)->create(['user_id' => $client->user->id, 'company_id' => $client->company->id, 'client_id' => $client->id]);
if((bool)rand(0,1))
if ((bool) rand(0, 1)) {
$dateable = Carbon::now()->subDays(rand(0, 90));
else
} else {
$dateable = Carbon::now()->addDays(rand(0, 90));
}
$credit->date = $dateable;
@ -467,8 +459,9 @@ class DemoMode extends Command
$credit = $invoice_calc->getCredit();
if(rand(0,1))
if (rand(0, 1)) {
$credit->assigned_user_id = $assigned_user_id;
}
$credit->save();
$credit->service()->markSent()->save();
@ -477,16 +470,14 @@ class DemoMode extends Command
private function createQuote($client, $assigned_user_id = null)
{
$faker = \Faker\Factory::create();
$quote =factory(\App\Models\Quote::class)->create(['user_id' => $client->user->id, 'company_id' => $client->company_id, 'client_id' => $client->id]);
$quote = factory(\App\Models\Quote::class)->create(['user_id' => $client->user->id, 'company_id' => $client->company_id, 'client_id' => $client->id]);
if((bool)rand(0,1)){
if ((bool) rand(0, 1)) {
$dateable = Carbon::now()->subDays(rand(1, 30));
$dateable_due = $dateable->addDays(rand(1, 30));
}
else{
} else {
$dateable = Carbon::now()->addDays(rand(1, 30));
$dateable_due = $dateable->addDays(rand(-10, 30));
}
@ -495,7 +486,7 @@ class DemoMode extends Command
$quote->due_date = $dateable_due;
$quote->client_id = $client->id;
$quote->setRelation('client', $client);
$quote->line_items = $this->buildLineItems(rand(1, 10));
@ -523,9 +514,10 @@ class DemoMode extends Command
$quote = $quote_calc->getQuote();
if(rand(0,1))
if (rand(0, 1)) {
$quote->assigned_user_id = $assigned_user_id;
}
$quote->save();
$quote->service()->markSent()->save();
@ -536,7 +528,7 @@ class DemoMode extends Command
{
$line_items = [];
for ($x=0; $x<$count; $x++) {
for ($x = 0; $x < $count; $x++) {
$item = InvoiceItemFactory::create();
$item->quantity = 1;
//$item->cost = 10;
@ -558,7 +550,7 @@ class DemoMode extends Command
$product = Product::all()->random();
$item->cost = (float)$product->cost;
$item->cost = (float) $product->cost;
$item->product_key = $product->product_key;
$item->notes = $product->notes;
$item->custom_value1 = $product->custom_value1;
@ -566,8 +558,6 @@ class DemoMode extends Command
$item->custom_value3 = $product->custom_value3;
$item->custom_value4 = $product->custom_value4;
$line_items[] = $item;
}

View File

@ -58,7 +58,7 @@ class ImportMigrations extends Command
foreach ($directory as $file) {
if ($file->getExtension() === 'zip') {
$this->info('Started processing: ' . $file->getBasename() . ' at ' . now());
$this->info('Started processing: '.$file->getBasename().' at '.now());
StartMigration::dispatch($file->getRealPath(), $this->getUser(), $this->getUser()->companies()->first());
}
}
@ -72,7 +72,7 @@ class ImportMigrations extends Command
$user = factory(\App\Models\User::class)->create([
'account_id' => $account->id,
'email' => $this->faker->email,
'confirmation_code' => $this->createDbHash(config('database.default'))
'confirmation_code' => $this->createDbHash(config('database.default')),
]);
$company_token = CompanyToken::create([
@ -107,8 +107,8 @@ class ImportMigrations extends Command
'account_id' => $account->id,
]);
if(!$account->default_company_id){
$account->default_company_id = $company->id;
if (! $account->default_company_id) {
$account->default_company_id = $company->id;
$account->save();
}

View File

@ -3,17 +3,16 @@
namespace App\Console\Commands;
use Composer\Composer;
use Composer\Console\Application;
use Composer\Factory;
use Composer\IO\NullIO;
use Composer\Installer;
use Composer\IO\NullIO;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Artisan;
use Symfony\Component\Console\Input\ArrayInput;
use Composer\Console\Application;
class PostUpdate extends Command
{
protected $name = 'ninja:post-update';
/**
* The name and signature of the console command.
@ -38,10 +37,10 @@ class PostUpdate extends Command
{
set_time_limit(0);
info("running post update");
info('running post update');
try {
Artisan::call('migrate',['--force' => true]);
Artisan::call('migrate', ['--force' => true]);
} catch (Exception $e) {
\Log::error("I wasn't able to migrate the data.");
}
@ -52,49 +51,49 @@ class PostUpdate extends Command
\Log::error("I wasn't able to optimize.");
}
$composer_data = array(
$composer_data = [
'url' => 'https://getcomposer.org/composer.phar',
'dir' => __DIR__.'/.code',
'bin' => __DIR__.'/.code/composer.phar',
'json' => __DIR__.'/.code/composer.json',
'conf' => array(
"autoload" => array(
"psr-4" => array(
"" => "local/"
)
)
)
);
'conf' => [
'autoload' => [
'psr-4' => [
'' => 'local/',
],
],
],
];
if(!is_dir($composer_data['dir']))
mkdir($composer_data['dir'],0777,true);
if (! is_dir($composer_data['dir'])) {
mkdir($composer_data['dir'], 0777, true);
}
if(!is_dir("{$composer_data['dir']}/local"))
mkdir("{$composer_data['dir']}/local",0777,true);
if (! is_dir("{$composer_data['dir']}/local")) {
mkdir("{$composer_data['dir']}/local", 0777, true);
}
copy($composer_data['url'],$composer_data['bin']);
copy($composer_data['url'], $composer_data['bin']);
require_once "phar://{$composer_data['bin']}/src/bootstrap.php";
$conf_json = json_encode($composer_data['conf'],JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES|JSON_UNESCAPED_UNICODE);
file_put_contents($composer_data['json'],$conf_json);
$conf_json = json_encode($composer_data['conf'], JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
file_put_contents($composer_data['json'], $conf_json);
chdir($composer_data['dir']);
putenv("COMPOSER_HOME={$composer_data['dir']}");
putenv("OSTYPE=OS400");
putenv('OSTYPE=OS400');
$app = new \Composer\Console\Application();
$factory = new \Composer\Factory();
$output = $factory->createOutput();
$input = new \Symfony\Component\Console\Input\ArrayInput(array(
$input = new \Symfony\Component\Console\Input\ArrayInput([
'command' => 'install',
));
]);
$input->setInteractive(false);
echo "<pre>";
$cmdret = $app->doRun($input,$output);
echo "end!";
\Log::error(print_r($cmdret,1));
echo '<pre>';
$cmdret = $app->doRun($input, $output);
echo 'end!';
\Log::error(print_r($cmdret, 1));
}
}

View File

@ -70,8 +70,7 @@ class SendTestEmails extends Command
$user = User::whereEmail('user@example.com')->first();
if (!$user) {
if (! $user) {
$account = factory(\App\Models\Account::class)->create();
$user = factory(\App\Models\User::class)->create([
@ -82,8 +81,6 @@ class SendTestEmails extends Command
'last_name' => 'Doe',
]);
$company = factory(\App\Models\Company::class)->create([
'account_id' => $account->id,
]);
@ -103,12 +100,9 @@ class SendTestEmails extends Command
$account = $company->account;
}
$client = Client::all()->first();
if (!$client) {
if (! $client) {
$client = ClientFactory::create($company->id, $user->id);
$client->save();

View File

@ -1,6 +1,6 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com)
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
@ -37,13 +37,11 @@ class CreateTestCreditJob implements ShouldQueue
protected $client;
/**
* Create a new job instance.
*
* @return void
*/
public function __construct(Client $client)
{
$this->client = $client;
@ -96,12 +94,11 @@ class CreateTestCreditJob implements ShouldQueue
event(new CreateCreditInvitation($credit, $credit->company, Ninja::eventVars()));
}
private function buildLineItems($count = 1)
{
$line_items = [];
for ($x=0; $x<$count; $x++) {
for ($x = 0; $x < $count; $x++) {
$item = InvoiceItemFactory::create();
$item->quantity = 1;
//$item->cost = 10;
@ -123,7 +120,7 @@ class CreateTestCreditJob implements ShouldQueue
$product = Product::all()->random();
$item->cost = (float)$product->cost;
$item->cost = (float) $product->cost;
$item->product_key = $product->product_key;
$item->notes = $product->notes;
$item->custom_value1 = $product->custom_value1;
@ -131,8 +128,6 @@ class CreateTestCreditJob implements ShouldQueue
$item->custom_value3 = $product->custom_value3;
$item->custom_value4 = $product->custom_value4;
$line_items[] = $item;
}

View File

@ -1,6 +1,6 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com)
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
@ -36,13 +36,11 @@ class CreateTestInvoiceJob implements ShouldQueue
protected $client;
/**
* Create a new job instance.
*
* @return void
*/
public function __construct(Client $client)
{
$this->client = $client;
@ -57,7 +55,7 @@ class CreateTestInvoiceJob implements ShouldQueue
{
$faker = \Faker\Factory::create();
$invoice = InvoiceFactory::create($this->client->company->id, $this->client->user->id);//stub the company and user_id
$invoice = InvoiceFactory::create($this->client->company->id, $this->client->user->id); //stub the company and user_id
$invoice->client_id = $this->client->id;
// $invoice->date = $faker->date();
$dateable = Carbon::now()->subDays(rand(0, 90));
@ -97,7 +95,6 @@ class CreateTestInvoiceJob implements ShouldQueue
//$this->invoice_repo->markSent($invoice);
if (rand(0, 1)) {
$payment = PaymentFactory::create($this->client->company->id, $this->client->user->id);
$payment->date = $dateable;
@ -121,12 +118,11 @@ class CreateTestInvoiceJob implements ShouldQueue
event(new InvoiceWasCreated($invoice, $invoice->company, Ninja::eventVars()));
}
private function buildLineItems($count = 1)
{
$line_items = [];
for ($x=0; $x<$count; $x++) {
for ($x = 0; $x < $count; $x++) {
$item = InvoiceItemFactory::create();
$item->quantity = 1;
//$item->cost = 10;
@ -148,7 +144,7 @@ class CreateTestInvoiceJob implements ShouldQueue
$product = Product::all()->random();
$item->cost = (float)$product->cost;
$item->cost = (float) $product->cost;
$item->product_key = $product->product_key;
$item->notes = $product->notes;
$item->custom_value1 = $product->custom_value1;
@ -156,8 +152,6 @@ class CreateTestInvoiceJob implements ShouldQueue
$item->custom_value3 = $product->custom_value3;
$item->custom_value4 = $product->custom_value4;
$line_items[] = $item;
}

View File

@ -1,6 +1,6 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com)
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
@ -36,13 +36,11 @@ class CreateTestQuoteJob implements ShouldQueue
protected $client;
/**
* Create a new job instance.
*
* @return void
*/
public function __construct(Client $client)
{
$this->client = $client;
@ -57,7 +55,7 @@ class CreateTestQuoteJob implements ShouldQueue
{
$faker = \Faker\Factory::create();
$quote =factory(\App\Models\Quote::class)->create(['user_id' => $this->client->user->id, 'company_id' => $this->client->company->id, 'client_id' => $this->client->id]);
$quote = factory(\App\Models\Quote::class)->create(['user_id' => $this->client->user->id, 'company_id' => $this->client->company->id, 'client_id' => $this->client->id]);
$quote->date = $faker->date();
$quote->line_items = $this->buildLineItems(rand(1, 10));
@ -89,13 +87,11 @@ class CreateTestQuoteJob implements ShouldQueue
CreateQuoteInvitations::dispatch($quote, $quote->company);
}
private function buildLineItems($count = 1)
{
$line_items = [];
for ($x=0; $x<$count; $x++) {
for ($x = 0; $x < $count; $x++) {
$item = InvoiceItemFactory::create();
$item->quantity = 1;
//$item->cost = 10;
@ -117,7 +113,7 @@ class CreateTestQuoteJob implements ShouldQueue
$product = Product::all()->random();
$item->cost = (float)$product->cost;
$item->cost = (float) $product->cost;
$item->product_key = $product->product_key;
$item->notes = $product->notes;
$item->custom_value1 = $product->custom_value1;
@ -125,8 +121,6 @@ class CreateTestQuoteJob implements ShouldQueue
$item->custom_value3 = $product->custom_value3;
$item->custom_value4 = $product->custom_value4;
$line_items[] = $item;
}

View File

@ -1,6 +1,6 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com)
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
@ -43,7 +43,7 @@ class Kernel extends ConsoleKernel
*/
protected function schedule(Schedule $schedule)
{
//$schedule->job(new RecurringInvoicesCron)->hourly();
$schedule->job(new VersionCheck)->daily();
@ -54,9 +54,9 @@ class Kernel extends ConsoleKernel
$schedule->job(new CompanySizeCheck)->daily();
$schedule->job(new UpdateExchangeRates)->daily();
/* Run hosted specific jobs */
if(Ninja::isHosted()) {
if (Ninja::isHosted()) {
$schedule->job(new AdjustEmailQuota())->daily();
$schedule->job(new SendFailedEmails())->daily();
}

View File

@ -4,39 +4,37 @@ namespace App\DataMapper\Analytics;
class LoginFailure
{
/**
* The type of Sample.
*
* Monotonically incrementing counter
*
* - counter
*
* @var string
*/
public $type = 'counter';
/**
* The type of Sample
*
* Monotonically incrementing counter
*
* - counter
*
* @var string
*/
public $type = 'counter';
/**
* The name of the counter.
* @var string
*/
public $name = 'login.failure';
/**
* The name of the counter
* @var string
*/
public $name = 'login.failure';
/**
* The datetime of the counter measurement.
*
* date("Y-m-d H:i:s")
*
* @var DateTime
*/
public $datetime;
/**
* The datetime of the counter measurement
*
* date("Y-m-d H:i:s")
*
* @var DateTime
*/
public $datetime;
/**
* The increment amount... should always be
* set to 0
*
* @var integer
*/
public $metric = 0;
}
/**
* The increment amount... should always be
* set to 0.
*
* @var int
*/
public $metric = 0;
}

View File

@ -4,39 +4,37 @@ namespace App\DataMapper\Analytics;
class LoginSuccess
{
/**
* The type of Sample.
*
* Monotonically incrementing counter
*
* - counter
*
* @var string
*/
public $type = 'counter';
/**
* The type of Sample
*
* Monotonically incrementing counter
*
* - counter
*
* @var string
*/
public $type = 'counter';
/**
* The name of the counter.
* @var string
*/
public $name = 'login.success';
/**
* The name of the counter
* @var string
*/
public $name = 'login.success';
/**
* The datetime of the counter measurement.
*
* date("Y-m-d H:i:s")
*
* @var DateTime
*/
public $datetime;
/**
* The datetime of the counter measurement
*
* date("Y-m-d H:i:s")
*
* @var DateTime
*/
public $datetime;
/**
* The increment amount... should always be
* set to 0
*
* @var integer
*/
public $metric = 0;
}
/**
* The increment amount... should always be
* set to 0.
*
* @var int
*/
public $metric = 0;
}

View File

@ -1,6 +1,6 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com)
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
@ -12,7 +12,7 @@
namespace App\DataMapper;
/**
* ClientSettings
* ClientSettings.
*/
class BaseSettings
{
@ -22,7 +22,7 @@ class BaseSettings
$obj->{$key} = $value;
}
}
public static function setCasts($obj, $casts)
{
foreach ($casts as $key => $value) {
@ -46,7 +46,7 @@ class BaseSettings
return is_null($value) ? '' : (string) $value;
case 'bool':
case 'boolean':
return (bool)($value);
return (bool) ($value);
case 'object':
return json_decode($value);
case 'array':

View File

@ -1,6 +1,6 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com)
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
@ -17,7 +17,7 @@ use App\Models\Client;
use App\Utils\TranslationHelper;
/**
* ClientSettings
* ClientSettings.
*
* Client settings are built as a superset of Company Settings
*
@ -25,13 +25,11 @@ use App\Utils\TranslationHelper;
*
* Client settings are passed down to the entity level where they can be further customized and then saved
* into the settings column of the entity, so there is no need to create additional entity level settings handlers.
*
*/
class ClientSettings extends BaseSettings
{
/**
* Settings which which are unique to client settings
* Settings which which are unique to client settings.
*/
public $industry_id;
public $size_id;
@ -40,11 +38,11 @@ class ClientSettings extends BaseSettings
'industry_id' => 'string',
'size_id' => 'string',
];
/**
* Cast object values and return entire class
* prevents missing properties from not being returned
* and always ensure an up to date class is returned
* and always ensure an up to date class is returned.
*
* @return \stdClass
*/
@ -54,16 +52,14 @@ class ClientSettings extends BaseSettings
}
/**
*
* Default Client Settings scaffold
* Default Client Settings scaffold.
*
* @return \stdClass
*
*/
public static function defaults() : \stdClass
{
$data = (object)[
'entity' => (string)Client::class,
$data = (object) [
'entity' => (string) Client::class,
'industry_id' => '',
'size_id' => '',
];
@ -71,9 +67,8 @@ class ClientSettings extends BaseSettings
return self::setCasts($data, self::$casts);
}
/**
* Merges settings from Company to Client
* Merges settings from Company to Client.
*
* @param \stdClass $company_settings
* @param \stdClass $client_settings
@ -81,21 +76,21 @@ class ClientSettings extends BaseSettings
*/
public static function buildClientSettings($company_settings, $client_settings)
{
if (!$client_settings) {
if (! $client_settings) {
return $company_settings;
}
foreach ($company_settings as $key => $value) {
/* pseudo code
if the property exists and is a string BUT has no length, treat it as TRUE
*/
if (((property_exists($client_settings, $key) && is_string($client_settings->{$key}) && (iconv_strlen($client_settings->{$key}) <1)))
|| !isset($client_settings->{$key})
if (((property_exists($client_settings, $key) && is_string($client_settings->{$key}) && (iconv_strlen($client_settings->{$key}) < 1)))
|| ! isset($client_settings->{$key})
&& property_exists($company_settings, $key)) {
$client_settings->{$key} = $company_settings->{$key};
}
}
return $client_settings;
}
}

View File

@ -1,6 +1,6 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com)
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
@ -15,65 +15,64 @@ use App\DataMapper\CompanySettings;
use App\Utils\Traits\MakesHash;
/**
* CompanySettings
* CompanySettings.
*/
class CompanySettings extends BaseSettings
{
use MakesHash;
/*Group settings based on functionality*/
/*Invoice*/
public $auto_archive_invoice = false;
public $auto_archive_invoice = false;
public $lock_invoices = 'off'; //off,when_sent,when_paid
public $enable_client_portal_tasks = false;
public $enable_client_portal_password = false;
public $enable_client_portal = true; //implemented
public $enable_client_portal_dashboard = true; //implemented
public $signature_on_pdf = false;
public $document_email_attachment = false;
public $enable_client_portal_tasks = false;
public $enable_client_portal_password = false;
public $enable_client_portal = true; //implemented
public $enable_client_portal_dashboard = true; //implemented
public $signature_on_pdf = false;
public $document_email_attachment = false;
//public $send_portal_password = false;
public $portal_design_id = '1';
public $portal_design_id = '1';
public $timezone_id = '';
public $date_format_id = '';
public $military_time = false;
public $timezone_id = '';
public $date_format_id = '';
public $military_time = false;
public $language_id = '';
public $show_currency_code = false;
public $language_id = '';
public $show_currency_code = false;
public $company_gateway_ids = '';
public $company_gateway_ids = '';
public $currency_id = '1';
public $currency_id = '1';
public $custom_value1 = '';
public $custom_value2 = '';
public $custom_value3 = '';
public $custom_value4 = '';
public $custom_value1 = '';
public $custom_value2 = '';
public $custom_value3 = '';
public $custom_value4 = '';
public $default_task_rate = 0;
public $default_task_rate = 0;
public $payment_terms = "";
public $send_reminders = false;
public $payment_terms = '';
public $send_reminders = false;
public $custom_message_dashboard = '';
public $custom_message_unpaid_invoice = '';
public $custom_message_paid_invoice = '';
public $custom_message_dashboard = '';
public $custom_message_unpaid_invoice = '';
public $custom_message_paid_invoice = '';
public $custom_message_unapproved_quote = '';
public $auto_archive_quote = false;
public $auto_convert_quote = true;
public $auto_email_invoice = true;
public $auto_archive_quote = false;
public $auto_convert_quote = true;
public $auto_email_invoice = true;
public $inclusive_taxes = false;
public $quote_footer = '';
public $quote_footer = '';
public $translations;
public $counter_number_applied = 'when_saved';// when_saved , when_sent
public $quote_number_applied = 'when_saved';// when_saved , when_sent
public $counter_number_applied = 'when_saved'; // when_saved , when_sent
public $quote_number_applied = 'when_saved'; // when_saved , when_sent
/* Counters */
public $invoice_number_pattern = '';
@ -104,71 +103,71 @@ class CompanySettings extends BaseSettings
public $payment_number_counter = 1;
public $shared_invoice_quote_counter = false;
public $recurring_number_prefix = 'R';
public $reset_counter_frequency_id = '0';
public $reset_counter_date = '';
public $counter_padding = 4;
public $recurring_number_prefix = 'R';
public $reset_counter_frequency_id = '0';
public $reset_counter_date = '';
public $counter_padding = 4;
public $auto_bill = 'off'; //off,always,optin,optout
public $design = 'views/pdf/design1.blade.php';
public $invoice_terms = '';
public $quote_terms = '';
public $invoice_taxes = 0;
// public $enabled_item_tax_rates = 0;
public $invoice_design_id = 'VolejRejNm';
public $quote_design_id = 'VolejRejNm';
public $credit_design_id = 'VolejRejNm';
public $invoice_footer = '';
public $credit_footer = '';
public $credit_terms = '';
public $invoice_labels = '';
public $tax_name1 = '';
public $tax_rate1 = 0;
public $tax_name2 = '';
public $tax_rate2 = 0;
public $tax_name3 = '';
public $tax_rate3 = 0;
public $payment_type_id = '0';
public $invoice_fields = '';
public $invoice_terms = '';
public $quote_terms = '';
public $invoice_taxes = 0;
// public $enabled_item_tax_rates = 0;
public $invoice_design_id = 'VolejRejNm';
public $quote_design_id = 'VolejRejNm';
public $credit_design_id = 'VolejRejNm';
public $invoice_footer = '';
public $credit_footer = '';
public $credit_terms = '';
public $invoice_labels = '';
public $tax_name1 = '';
public $tax_rate1 = 0;
public $tax_name2 = '';
public $tax_rate2 = 0;
public $tax_name3 = '';
public $tax_rate3 = 0;
public $payment_type_id = '0';
public $invoice_fields = '';
public $show_accept_invoice_terms = false;
public $show_accept_quote_terms = false;
public $show_accept_quote_terms = false;
public $require_invoice_signature = false;
public $require_quote_signature = false;
public $require_quote_signature = false;
//email settings
public $email_sending_method = 'default';//enum 'default','gmail'
public $email_sending_method = 'default'; //enum 'default','gmail'
public $gmail_sending_user_id = '0';
public $reply_to_email = '';
public $bcc_email = '';
public $reply_to_email = '';
public $bcc_email = '';
public $pdf_email_attachment = false;
public $ubl_email_attachment = false;
public $email_style = 'light'; //plain, light, dark, custom
public $email_style_custom = ''; //the template itself
public $email_subject_invoice = '';
public $email_subject_quote = '';
public $email_subject_payment = '';
public $email_subject_payment_partial = '';
public $email_subject_statement = '';
public $email_template_invoice = '';
public $email_template_quote = '';
public $email_template_payment = '';
public $email_template_payment_partial = '';
public $email_template_statement = '';
public $email_subject_reminder1 = '';
public $email_subject_reminder2 = '';
public $email_subject_reminder3 = '';
public $email_subject_reminder_endless = '';
public $email_template_reminder1 = '';
public $email_template_reminder2 = '';
public $email_template_reminder3 = '';
public $email_style = 'light'; //plain, light, dark, custom
public $email_style_custom = ''; //the template itself
public $email_subject_invoice = '';
public $email_subject_quote = '';
public $email_subject_payment = '';
public $email_subject_payment_partial = '';
public $email_subject_statement = '';
public $email_template_invoice = '';
public $email_template_quote = '';
public $email_template_payment = '';
public $email_template_payment_partial = '';
public $email_template_statement = '';
public $email_subject_reminder1 = '';
public $email_subject_reminder2 = '';
public $email_subject_reminder3 = '';
public $email_subject_reminder_endless = '';
public $email_template_reminder1 = '';
public $email_template_reminder2 = '';
public $email_template_reminder3 = '';
public $email_template_reminder_endless = '';
public $email_signature = '';
public $enable_email_markup = true;
public $email_signature = '';
public $enable_email_markup = true;
public $email_subject_custom1 = '';
public $email_subject_custom2 = '';
@ -186,47 +185,47 @@ class CompanySettings extends BaseSettings
public $num_days_reminder2 = 0;
public $num_days_reminder3 = 0;
public $schedule_reminder1 = '';// (enum: after_invoice_date, before_due_date, after_due_date)
public $schedule_reminder2 = '';// (enum: after_invoice_date, before_due_date, after_due_date)
public $schedule_reminder3 = '';// (enum: after_invoice_date, before_due_date, after_due_date)
public $schedule_reminder1 = ''; // (enum: after_invoice_date, before_due_date, after_due_date)
public $schedule_reminder2 = ''; // (enum: after_invoice_date, before_due_date, after_due_date)
public $schedule_reminder3 = ''; // (enum: after_invoice_date, before_due_date, after_due_date)
public $reminder_send_time = 32400;//number of seconds from UTC +0 to send reminders
public $reminder_send_time = 32400; //number of seconds from UTC +0 to send reminders
public $late_fee_amount1 = 0;
public $late_fee_amount2 = 0;
public $late_fee_amount3 = 0;
public $endless_reminder_frequency_id = '0';
public $late_fee_endless_amount = 0;
public $late_fee_endless_percent = 0;
public $late_fee_endless_amount = 0;
public $late_fee_endless_percent = 0;
public $client_online_payment_notification = true; //@todo implement in notifications
public $client_manual_payment_notification = true; //@todo implement in notifications
/* Company Meta data that we can use to build sub companies*/
public $name = '';
public $name = '';
public $company_logo = '';
public $website = '';
public $address1 = '';
public $address2 = '';
public $city = '';
public $state = '';
public $postal_code = '';
public $phone = '';
public $email = '';
public $website = '';
public $address1 = '';
public $address2 = '';
public $city = '';
public $state = '';
public $postal_code = '';
public $phone = '';
public $email = '';
public $country_id;
public $vat_number = '';
public $id_number = '';
public $id_number = '';
public $page_size = 'A4'; //Letter, Legal, Tabloid, Ledger, A0, A1, A2, A3, A4, A5, A6
public $font_size = 9;
public $primary_font = 'Roboto';
public $secondary_font = 'Roboto';
public $page_size = 'A4'; //Letter, Legal, Tabloid, Ledger, A0, A1, A2, A3, A4, A5, A6
public $font_size = 9;
public $primary_font = 'Roboto';
public $secondary_font = 'Roboto';
public $hide_paid_to_date = false;
public $embed_documents = false;
public $all_pages_header = false;
public $all_pages_footer = false;
public $embed_documents = false;
public $all_pages_header = false;
public $all_pages_footer = false;
public $pdf_variables = '';
public $portal_custom_head = '';
@ -237,11 +236,10 @@ class CompanySettings extends BaseSettings
public $client_can_register = false;
public $client_portal_terms = '';
public $client_portal_privacy_policy = '';
public $client_portal_enable_uploads = false;
public $client_portal_enable_uploads = false;
public $client_portal_allow_under_payment = false;
public $client_portal_allow_over_payment = false;
public static $casts = [
'client_portal_allow_under_payment' => 'bool',
'client_portal_allow_over_payment' => 'bool',
@ -414,7 +412,6 @@ class CompanySettings extends BaseSettings
'client_portal_enable_uploads' => 'bool',
];
public static $free_plan_casts = [
'currency_id' => 'string',
'company_gateway_ids' => 'string',
@ -453,7 +450,7 @@ class CompanySettings extends BaseSettings
/**
* Array of variables which
* cannot be modified client side
* cannot be modified client side.
*/
public static $protected_fields = [
// 'credit_number_counter',
@ -470,7 +467,7 @@ class CompanySettings extends BaseSettings
/**
* Cast object values and return entire class
* prevents missing properties from not being returned
* and always ensure an up to date class is returned
* and always ensure an up to date class is returned.
*
* @return \stdClass
*/
@ -480,29 +477,29 @@ class CompanySettings extends BaseSettings
}
/**
* Provides class defaults on init
* Provides class defaults on init.
* @return object
*/
public static function defaults():\stdClass
{
$config = json_decode(config('ninja.settings'));
$data = (object) get_class_vars(CompanySettings::class);
$data = (object) get_class_vars(self::class);
unset($data->casts);
unset($data->protected_fields);
unset($data->free_plan_casts);
unset($data->string_casts);
$data->timezone_id = (string) config('ninja.i18n.timezone_id');
$data->currency_id = (string) config('ninja.i18n.currency_id');
$data->language_id = (string) config('ninja.i18n.language_id');
$data->payment_terms = (string) config('ninja.i18n.payment_terms');
$data->military_time = (bool) config('ninja.i18n.military_time');
$data->date_format_id = (string) config('ninja.i18n.date_format_id');
$data->country_id = (string) config('ninja.i18n.country_id');
$data->translations = (object) [];
$data->pdf_variables = (object) self::getEntityVariableDefaults();
$data->timezone_id = (string) config('ninja.i18n.timezone_id');
$data->currency_id = (string) config('ninja.i18n.currency_id');
$data->language_id = (string) config('ninja.i18n.language_id');
$data->payment_terms = (string) config('ninja.i18n.payment_terms');
$data->military_time = (bool) config('ninja.i18n.military_time');
$data->date_format_id = (string) config('ninja.i18n.date_format_id');
$data->country_id = (string) config('ninja.i18n.country_id');
$data->translations = (object) [];
$data->pdf_variables = (object) self::getEntityVariableDefaults();
return self::setCasts($data, self::$casts);
}
@ -516,10 +513,10 @@ class CompanySettings extends BaseSettings
*/
public static function setProperties($settings):\stdClass
{
$company_settings = (object) get_class_vars(CompanySettings::class);
$company_settings = (object) get_class_vars(self::class);
foreach ($company_settings as $key => $value) {
if (!property_exists($settings, $key)) {
if (! property_exists($settings, $key)) {
$settings->{ $key} = self::castAttribute($key, $company_settings->{ $key});
}
}
@ -614,10 +611,10 @@ class CompanySettings extends BaseSettings
'$custom_surcharge3',
'$custom_surcharge4',
'$paid_to_date',
'$client.balance'
'$client.balance',
],
];
return json_decode(json_encode($variables));
}
}

View File

@ -1,6 +1,6 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com)
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
@ -15,12 +15,10 @@ use App\Models\Client;
use App\Models\User;
/**
* Class DefaultSettings
* @package App\DataMapper
* Class DefaultSettings.
*/
class DefaultSettings extends BaseSettings
{
/**
* @var int
*/
@ -33,7 +31,7 @@ class DefaultSettings extends BaseSettings
*/
public static function userSettings() : \stdClass
{
return (object)[
return (object) [
// class_basename(User::class) => self::userSettingsObject(),
];
}
@ -43,7 +41,7 @@ class DefaultSettings extends BaseSettings
*/
private static function userSettingsObject() : \stdClass
{
return (object)[
return (object) [
// 'per_page' => self::$per_page,
];
}

View File

@ -1,6 +1,6 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com)
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
@ -12,26 +12,25 @@
namespace App\DataMapper;
/**
* EmailSpooledForSend
* EmailSpooledForSend.
*
* Stubbed class used to store the meta data
* Stubbed class used to store the meta data
* for an email that was unable to be sent
* for a reason such as:
*
*
* - Quota exceeded
* - SMTP issues
* - Upstream connectivity
*
*/
class EmailSpooledForSend
{
public $entity_name;
public $entity_name;
public $invitation_key = '';
public $invitation_key = '';
public $reminder_template = '';
public $reminder_template = '';
public $subject = '';
public $subject = '';
public $body = '';
}
public $body = '';
}

View File

@ -1,6 +1,6 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com)
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
@ -23,7 +23,7 @@ class EmailTemplateDefaults
switch ($template) {
/* Template */
case 'email_template_invoice':
return self::emailInvoiceTemplate();
break;
@ -62,7 +62,7 @@ class EmailTemplateDefaults
break;
/* Subject */
case 'email_subject_invoice':
return self::emailInvoiceSubject();
break;
@ -119,10 +119,10 @@ class EmailTemplateDefaults
'allow_unsafe_links' => false,
]);
$invoice_message = '<p>' . self::transformText('invoice_message') . '</p><br><br><p>$view_link</p>';
$invoice_message = '<p>'.self::transformText('invoice_message').'</p><br><br><p>$view_link</p>';
return $invoice_message;
//return $converter->convertToHtml($invoice_message);
}
public static function emailQuoteSubject()
@ -214,9 +214,8 @@ class EmailTemplateDefaults
return Parsedown::instance()->line('Statement Templates needs texts record!');
}
private static function transformText($string)
{
return str_replace(":", "$", ctrans('texts.'.$string));
return str_replace(':', '$', ctrans('texts.'.$string));
}
}

View File

@ -1,6 +1,6 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com)
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*

View File

@ -1,6 +1,6 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com)
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
@ -15,76 +15,73 @@ use App\DataMapper\CompanySettings;
use App\Utils\Traits\MakesHash;
/**
* FreeCompanySettings
* FreeCompanySettings.
*/
class FreeCompanySettings extends BaseSettings
{
use MakesHash;
/*Group settings based on functionality*/
public $credit_design_id = 'VolejRejNm';
public $client_number_pattern = '';
public $client_number_counter = 1;
public $credit_number_pattern = '';
public $credit_number_counter = 1;
public $currency_id = '1';
public $custom_value1 = '';
public $custom_value2 = '';
public $custom_value3 = '';
public $custom_value4 = '';
public $date_format_id = '';
public $credit_design_id = 'VolejRejNm';
public $client_number_pattern = '';
public $client_number_counter = 1;
public $credit_number_pattern = '';
public $credit_number_counter = 1;
public $currency_id = '1';
public $custom_value1 = '';
public $custom_value2 = '';
public $custom_value3 = '';
public $custom_value4 = '';
public $date_format_id = '';
// public $enabled_item_tax_rates = 0;
public $expense_number_pattern = '';
public $expense_number_counter = 1;
public $inclusive_taxes = false;
public $invoice_design_id = 'VolejRejNm';
public $invoice_number_pattern = '';
public $invoice_number_counter = 1;
public $invoice_taxes = 0;
public $language_id = '';
public $military_time = false;
public $payment_number_pattern = '';
public $payment_number_counter = 1;
public $payment_terms = "";
public $payment_type_id = '0';
public $portal_design_id = '1';
public $quote_design_id = 'VolejRejNm';
public $quote_number_pattern = '';
public $quote_number_counter = 1;
public $timezone_id = '';
public $show_currency_code = false;
public $company_gateway_ids = '';
public $task_number_pattern = '';
public $task_number_counter = 1;
public $tax_name1 = '';
public $tax_rate1 = 0;
public $tax_name2 = '';
public $tax_rate2 = 0;
public $tax_name3 = '';
public $tax_rate3 = 0;
public $ticket_number_pattern = '';
public $ticket_number_counter = 1;
public $expense_number_pattern = '';
public $expense_number_counter = 1;
public $inclusive_taxes = false;
public $invoice_design_id = 'VolejRejNm';
public $invoice_number_pattern = '';
public $invoice_number_counter = 1;
public $invoice_taxes = 0;
public $language_id = '';
public $military_time = false;
public $payment_number_pattern = '';
public $payment_number_counter = 1;
public $payment_terms = '';
public $payment_type_id = '0';
public $portal_design_id = '1';
public $quote_design_id = 'VolejRejNm';
public $quote_number_pattern = '';
public $quote_number_counter = 1;
public $timezone_id = '';
public $show_currency_code = false;
public $company_gateway_ids = '';
public $task_number_pattern = '';
public $task_number_counter = 1;
public $tax_name1 = '';
public $tax_rate1 = 0;
public $tax_name2 = '';
public $tax_rate2 = 0;
public $tax_name3 = '';
public $tax_rate3 = 0;
public $ticket_number_pattern = '';
public $ticket_number_counter = 1;
public $translations;
public $vendor_number_pattern = '';
public $vendor_number_counter = 1;
public $vendor_number_pattern = '';
public $vendor_number_counter = 1;
/* Company Meta data that we can use to build sub companies*/
public $address1 = '';
public $address2 = '';
public $city = '';
public $address1 = '';
public $address2 = '';
public $city = '';
public $company_logo = '';
public $country_id;
public $email = '';
public $id_number = '';
public $name = '';
public $phone = '';
public $postal_code = '';
public $state = '';
public $email = '';
public $id_number = '';
public $name = '';
public $phone = '';
public $postal_code = '';
public $state = '';
public $vat_number = '';
public $website = '';
public $website = '';
public static $casts = [
'portal_design_id' => 'string',
@ -141,7 +138,7 @@ class FreeCompanySettings extends BaseSettings
/**
* Cast object values and return entire class
* prevents missing properties from not being returned
* and always ensure an up to date class is returned
* and always ensure an up to date class is returned.
*
* @return \stdClass
*/
@ -150,7 +147,7 @@ class FreeCompanySettings extends BaseSettings
}
/**
* Provides class defaults on init
* Provides class defaults on init.
* @return object
*/
public static function defaults():\stdClass
@ -162,18 +159,16 @@ class FreeCompanySettings extends BaseSettings
unset($data->casts);
unset($data->protected_fields);
$data->timezone_id = (string) config('ninja.i18n.timezone_id');
$data->currency_id = (string) config('ninja.i18n.currency_id');
$data->language_id = (string) config('ninja.i18n.language_id');
$data->payment_terms = (int) config('ninja.i18n.payment_terms');
$data->military_time = (bool) config('ninja.i18n.military_time');
$data->date_format_id = (string) config('ninja.i18n.date_format_id');
$data->country_id = (string) config('ninja.i18n.country_id');
$data->translations = (object) [];
$data->pdf_variables = (object) self::getEntityVariableDefaults();
$data->timezone_id = (string) config('ninja.i18n.timezone_id');
$data->currency_id = (string) config('ninja.i18n.currency_id');
$data->language_id = (string) config('ninja.i18n.language_id');
$data->payment_terms = (int) config('ninja.i18n.payment_terms');
$data->military_time = (bool) config('ninja.i18n.military_time');
$data->date_format_id = (string) config('ninja.i18n.date_format_id');
$data->country_id = (string) config('ninja.i18n.country_id');
$data->translations = (object) [];
$data->pdf_variables = (object) self::getEntityVariableDefaults();
return self::setCasts($data, self::$casts);
}
}

View File

@ -1,6 +1,6 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com)
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*

View File

@ -1,6 +1,6 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com)
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*

View File

@ -1,6 +1,6 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com)
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*

View File

@ -1,6 +1,6 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com)
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
@ -14,14 +14,14 @@ namespace App\Designs;
abstract class AbstractDesign
{
abstract public function includes();
abstract public function header();
abstract public function body();
abstract public function product();
abstract public function task();
abstract public function footer();
}

View File

@ -1,6 +1,6 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com)
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*

View File

@ -1,6 +1,6 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com)
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*

View File

@ -1,6 +1,6 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com)
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
@ -17,7 +17,6 @@ class Clean extends AbstractDesign
{
}
public function includes()
{
return '<title>$number</title>
@ -39,7 +38,6 @@ class Clean extends AbstractDesign
</style>';
}
public function header()
{
return '<div class="px-12 my-10">

View File

@ -1,6 +1,6 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com)
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
@ -20,7 +20,6 @@ class Creative extends AbstractDesign
{
}
public function includes()
{
return '<title>$number</title>
@ -42,7 +41,6 @@ $custom_css
</style>';
}
public function header()
{
return '<div class="m-12">
@ -114,7 +112,6 @@ $custom_css
return '';
}
public function product()
{
return '';

View File

@ -1,6 +1,6 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com)
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
@ -18,13 +18,13 @@ class Custom
public $header;
public $body;
public $product;
public $task;
public $footer;
public $name;
public function __construct($design)
@ -34,11 +34,11 @@ class Custom
$this->includes = $design->design->includes;
$this->header = $design->design->header;
$this->body = $design->design->body;
$this->product = $design->design->product;
$this->task = $design->design->task;
$this->footer = $design->design->footer;

View File

@ -1,6 +1,6 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com)
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
@ -64,10 +64,10 @@ class Designer
/**
* Returns the design
* formatted HTML
* formatted HTML.
* @return string The HTML design built
*/
public function build():Designer
public function build():self
{
$this->setHtml()
->exportVariables()
@ -104,13 +104,12 @@ class Designer
<div class="flex items-center justify-between m-12">
%s <!-- Placeholder for signature -->
%s <!-- Placehoder for Invoice Ninja logo -->
</div>'
;
</div>';
$signature = '<img class="h-40" src="$contact.signature" />';
$logo = '<div></div>';
if (!$this->entity->user->account->isPaid()) {
if (! $this->entity->user->account->isPaid()) {
$logo = '<img class="h-32" src="$app_url/images/created-by-invoiceninja-new.png" />';
}
@ -129,7 +128,7 @@ class Designer
public function setHtml()
{
$this->html = '';
$this->html = '';
return $this;
}
@ -158,12 +157,12 @@ class Designer
{
//$s = microtime(true);
$company = $this->entity->company;
$this->exported_variables['$custom_css'] = $this->entity->generateCustomCSS();
$this->exported_variables['$app_url'] = $this->entity->generateAppUrl();
$this->exported_variables['$client_details'] = $this->processVariables($this->input_variables['client_details'], $this->clientDetails($company));
$this->exported_variables['$company_details'] = $this->processVariables($this->input_variables['company_details'], $this->companyDetails($company));
$this->exported_variables['$company_address'] = $this->processVariables($this->input_variables['company_address'], $this->companyAddress($company));
$this->exported_variables['$custom_css'] = $this->entity->generateCustomCSS();
$this->exported_variables['$app_url'] = $this->entity->generateAppUrl();
$this->exported_variables['$client_details'] = $this->processVariables($this->input_variables['client_details'], $this->clientDetails($company));
$this->exported_variables['$company_details'] = $this->processVariables($this->input_variables['company_details'], $this->companyDetails($company));
$this->exported_variables['$company_address'] = $this->processVariables($this->input_variables['company_address'], $this->companyAddress($company));
if ($this->entity_string == 'invoice') {
//$this->exported_variables['$entity_labels'] = $this->processLabels($this->input_variables['invoice_details'], $this->invoiceDetails($company));
@ -178,11 +177,10 @@ class Designer
$this->exported_variables['$entity_details'] = $this->processVariables($this->input_variables['invoice_details'], $this->quoteDetails($company));
}
$this->exported_variables['$product_table_header']= $this->entity->buildTableHeader($this->input_variables['product_columns']);
$this->exported_variables['$product_table_body'] = $this->entity->buildTableBody($this->input_variables['product_columns'], $this->design->product, '$product');
$this->exported_variables['$task_table_header'] = $this->entity->buildTableHeader($this->input_variables['task_columns']);
$this->exported_variables['$task_table_body'] = $this->entity->buildTableBody($this->input_variables['task_columns'], $this->design->task, '$task');
$this->exported_variables['$product_table_header'] = $this->entity->buildTableHeader($this->input_variables['product_columns']);
$this->exported_variables['$product_table_body'] = $this->entity->buildTableBody($this->input_variables['product_columns'], $this->design->product, '$product');
$this->exported_variables['$task_table_header'] = $this->entity->buildTableHeader($this->input_variables['task_columns']);
$this->exported_variables['$task_table_body'] = $this->entity->buildTableBody($this->input_variables['task_columns'], $this->design->task, '$task');
if (strlen($this->exported_variables['$task_table_body']) == 0) {
$this->exported_variables['$task_table_header'] = '';
@ -191,6 +189,7 @@ class Designer
if (strlen($this->exported_variables['$product_table_body']) == 0) {
$this->exported_variables['$product_table_header'] = '';
}
return $this;
}
@ -214,7 +213,7 @@ class Designer
foreach (array_keys($input_variables) as $value) {
if (array_key_exists($value, $variables)) {
//$tmp = str_replace("</span>", "_label</span>", $variables[$value]);
$tmp = strtr($variables[$value], "</span>", "_label</span>");
$tmp = strtr($variables[$value], '</span>', '_label</span>');
$output .= $tmp;
}
}
@ -357,12 +356,12 @@ class Designer
{
$custom_fields = $company->custom_fields;
if (!$custom_fields) {
if (! $custom_fields) {
return $data;
}
foreach (self::$custom_fields as $cf) {
if (!property_exists($custom_fields, $cf) || (strlen($custom_fields->{$cf}) == 0)) {
if (! property_exists($custom_fields, $cf) || (strlen($custom_fields->{$cf}) == 0)) {
unset($data[$cf]);
}
}

View File

@ -1,6 +1,6 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com)
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
@ -17,7 +17,6 @@ class Elegant extends AbstractDesign
{
}
public function includes()
{
return '<title>$number</title>
@ -39,7 +38,6 @@ class Elegant extends AbstractDesign
</style>';
}
public function header()
{
return '<div class="m-10">

View File

@ -1,6 +1,6 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com)
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
@ -17,7 +17,6 @@ class Hipster extends AbstractDesign
{
}
public function includes()
{
return '<title>$number</title>
@ -40,7 +39,6 @@ $custom_css
</style>';
}
public function header()
{
return '<div class="px-12 py-16">

View File

@ -1,6 +1,6 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com)
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
@ -17,7 +17,6 @@ class Modern extends AbstractDesign
{
}
public function includes()
{
return '<title>$number</title>
@ -36,7 +35,6 @@ $custom_css
<body>';
}
public function header()
{
return '

View File

@ -1,6 +1,6 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com)
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
@ -17,7 +17,6 @@ class Photo extends AbstractDesign
{
}
public function includes()
{
return '<title>$number</title>
@ -43,8 +42,6 @@ $custom_css
</style>';
}
public function header()
{
return '<div class="px-16 py-10">

View File

@ -1,6 +1,6 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com)
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
@ -17,7 +17,6 @@ class Plain extends AbstractDesign
{
}
public function includes()
{
return '<title>$number</title>

View File

@ -1,6 +1,6 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com)
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
@ -17,7 +17,6 @@ class Playful extends AbstractDesign
{
}
public function includes()
{
return '<title>$number</title>
@ -39,7 +38,6 @@ $custom_css
</style>';
}
public function header()
{
return '<div class="my-12 mx-16">

View File

@ -1,6 +1,6 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com)
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
@ -12,16 +12,15 @@
namespace App\Events\Account;
use Illuminate\Broadcasting\Channel;
use Illuminate\Queue\SerializesModels;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Broadcasting\PresenceChannel;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Broadcasting\PresenceChannel;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels;
/**
* Class AccountCreated
* @package App\Events\Account
* Class AccountCreated.
*/
class AccountCreated
{
@ -35,6 +34,7 @@ class AccountCreated
public $company;
public $event_vars;
/**
* Create a new event instance.
*

View File

@ -1,6 +1,6 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com)
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
@ -47,7 +47,6 @@ class ClientWasArchived
$this->client = $client;
$this->company = $company;
$this->event_vars = $event_vars;
}
/**

View File

@ -1,6 +1,6 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com)
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
@ -41,6 +41,5 @@ class ClientWasCreated
$this->client = $client;
$this->company = $company;
$this->event_vars = $event_vars;
}
}

View File

@ -1,6 +1,6 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com)
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
@ -40,6 +40,5 @@ class ClientWasDeleted
$this->client = $client;
$this->company = $company;
$this->event_vars = $event_vars;
}
}

View File

@ -1,6 +1,6 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com)
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
@ -40,6 +40,5 @@ class ClientWasRestored
$this->client = $client;
$this->company = $company;
$this->event_vars = $event_vars;
}
}

View File

@ -1,6 +1,6 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com)
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
@ -40,6 +40,5 @@ class ClientWasUpdated
$this->client = $client;
$this->company = $company;
$this->event_vars = $event_vars;
}
}

View File

@ -1,6 +1,6 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com)
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*

View File

@ -1,6 +1,6 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com)
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
@ -21,21 +21,21 @@ use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels;
/**
* Class UserLoggedIn
* @package App\Events\User
* Class UserLoggedIn.
*/
class ContactLoggedIn
{
use Dispatchable, InteractsWithSockets, SerializesModels;
/**
* @var $client_contact
* @var
*/
public $client_contact;
public $company;
public $event_vars;
/**
* Create a new event instance.
*

View File

@ -1,6 +1,6 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com)
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
@ -9,7 +9,6 @@
* @license https://opensource.org/licenses/AAL
*/
namespace App\Events\Credit;
use App\Models\Company;
@ -25,8 +24,9 @@ class CreditWasArchived
public $credit;
public $company;
public $event_vars;
/**
* Create a new event instance.
*

View File

@ -1,6 +1,6 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com)
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
@ -9,7 +9,6 @@
* @license https://opensource.org/licenses/AAL
*/
namespace App\Events\Credit;
use App\Models\Company;
@ -25,8 +24,9 @@ class CreditWasCreated
public $credit;
public $company;
public $event_vars;
/**
* Create a new event instance.
*

View File

@ -1,6 +1,6 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com)
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
@ -9,7 +9,6 @@
* @license https://opensource.org/licenses/AAL
*/
namespace App\Events\Credit;
use App\Models\Company;
@ -25,8 +24,9 @@ class CreditWasDeleted
public $credit;
public $company;
public $event_vars;
/**
* Create a new event instance.
*

View File

@ -1,6 +1,6 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com)
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
@ -23,8 +23,9 @@ class CreditWasEmailed
public $credit;
public $company;
public $event_vars;
/**
* Create a new event instance.
*

View File

@ -1,6 +1,6 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com)
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
@ -23,15 +23,15 @@ class CreditWasEmailedAndFailed
public $credit;
public $errors;
public $company;
public $event_vars;
public function __construct(Credit $credit, $company, array $errors, array $event_vars)
{
$this->credit = $credit;
$this->company = $company;
$this->errors = $errors;

View File

@ -1,6 +1,6 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com)
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
@ -27,8 +27,9 @@ class CreditWasMarkedSent
public $credit;
public $company;
public $event_vars;
/**
* Create a new event instance.
*

View File

@ -1,6 +1,6 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com)
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
@ -40,6 +40,5 @@ class CreditWasRestored
$this->credit = $credit;
$this->company = $company;
$this->event_vars = $event_vars;
}
}

View File

@ -1,6 +1,6 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com)
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
@ -24,8 +24,9 @@ class CreditWasUpdated
public $credit;
public $company;
public $event_vars;
/**
* Create a new event instance.
*

View File

@ -1,6 +1,6 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com)
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*

View File

@ -1,6 +1,6 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com)
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
@ -36,6 +36,7 @@ class DesignWasArchived
public $company;
public $event_vars;
/**
* Create a new event instance.
*

View File

@ -1,6 +1,6 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com)
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
@ -30,6 +30,7 @@ class DesignWasCreated
public $company;
public $event_vars;
/**
* Create a new event instance.
*

View File

@ -1,6 +1,6 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com)
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
@ -30,6 +30,7 @@ class DesignWasDeleted
public $company;
public $event_vars;
/**
* Create a new event instance.
*
@ -53,5 +54,4 @@ class DesignWasDeleted
{
return new PrivateChannel('channel-name');
}
}

View File

@ -1,6 +1,6 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com)
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
@ -21,7 +21,7 @@ use Illuminate\Queue\SerializesModels;
class DesignWasRestored
{
use SerializesModels;
/**
* @var Design
*/
@ -30,6 +30,7 @@ class DesignWasRestored
public $company;
public $event_vars;
/**
* Create a new event instance.
*

View File

@ -1,6 +1,6 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com)
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
@ -30,6 +30,7 @@ class DesignWasUpdated
public $company;
public $event_vars;
/**
* Create a new event instance.
*
@ -43,6 +44,7 @@ class DesignWasUpdated
$this->event_vars = $event_vars;
}
/**
* Get the channels the event should broadcast on.
*
@ -52,5 +54,4 @@ class DesignWasUpdated
{
return new PrivateChannel('channel-name');
}
}

View File

@ -1,6 +1,6 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com)
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*

View File

@ -1,6 +1,6 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com)
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*

View File

@ -1,6 +1,6 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com)
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*

View File

@ -1,6 +1,6 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com)
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*

View File

@ -1,6 +1,6 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com)
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*

View File

@ -1,6 +1,6 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com)
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
@ -30,6 +30,7 @@ class ExpenseWasArchived
public $company;
public $event_vars;
/**
* Create a new event instance.
*

View File

@ -1,6 +1,6 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com)
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
@ -30,6 +30,7 @@ class ExpenseWasCreated
public $company;
public $event_vars;
/**
* Create a new event instance.
*

View File

@ -1,6 +1,6 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com)
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
@ -30,6 +30,7 @@ class ExpenseWasDeleted
public $company;
public $event_vars;
/**
* Create a new event instance.
*

View File

@ -1,6 +1,6 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com)
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
@ -30,6 +30,7 @@ class ExpenseWasRestored
public $company;
public $event_vars;
/**
* Create a new event instance.
*

View File

@ -1,6 +1,6 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com)
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
@ -30,6 +30,7 @@ class ExpenseWasUpdated
public $company;
public $event_vars;
/**
* Create a new event instance.
*

View File

@ -1,6 +1,6 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com)
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
@ -30,6 +30,7 @@ class InvoiceWasArchived
public $company;
public $event_vars;
/**
* Create a new event instance.
*

View File

@ -1,6 +1,6 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com)
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
@ -30,6 +30,7 @@ class InvoiceWasCancelled
public $company;
public $event_vars;
/**
* Create a new event instance.
*

View File

@ -1,6 +1,6 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com)
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
@ -30,6 +30,7 @@ class InvoiceWasCreated
public $company;
public $event_vars;
/**
* Create a new event instance.
*

View File

@ -1,6 +1,6 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com)
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
@ -30,6 +30,7 @@ class InvoiceWasDeleted
public $company;
public $event_vars;
/**
* Create a new event instance.
*

View File

@ -1,6 +1,6 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com)
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
@ -30,6 +30,7 @@ class InvoiceWasEmailed
public $company;
public $event_vars;
/**
* Create a new event instance.
*

View File

@ -1,6 +1,6 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com)
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
@ -35,6 +35,7 @@ class InvoiceWasEmailedAndFailed
public $company;
public $event_vars;
/**
* Create a new event instance.
*
@ -43,9 +44,9 @@ class InvoiceWasEmailedAndFailed
public function __construct(Invoice $invoice, Company $company, string $errors, array $event_vars)
{
$this->invoice = $invoice;
$this->company = $company;
$this->errors = $errors;
$this->event_vars = $event_vars;

View File

@ -1,6 +1,6 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com)
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
@ -30,6 +30,7 @@ class InvoiceWasMarkedSent
public $company;
public $event_vars;
/**
* Create a new event instance.
*

View File

@ -1,6 +1,6 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com)
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
@ -30,6 +30,7 @@ class InvoiceWasPaid
public $company;
public $event_vars;
/**
* Create a new event instance.
*

View File

@ -1,6 +1,6 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com)
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
@ -26,12 +26,13 @@ class InvoiceWasRestored
* @var Invoice
*/
public $invoice;
public $fromDeleted;
public $company;
public $event_vars;
/**
* Create a new event instance.
*

View File

@ -1,6 +1,6 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com)
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
@ -30,6 +30,7 @@ class InvoiceWasReversed
public $company;
public $event_vars;
/**
* Create a new event instance.
*

View File

@ -1,6 +1,6 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com)
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
@ -32,6 +32,7 @@ class InvoiceWasUpdated
public $company;
public $event_vars;
/**
* Create a new event instance.
*

View File

@ -1,6 +1,6 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com)
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
@ -30,6 +30,7 @@ class InvoiceWasViewed
public $company;
public $event_vars;
/**
* Create a new event instance.
*

View File

@ -1,6 +1,6 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com)
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
@ -31,6 +31,7 @@ class InvitationWasViewed
public $company;
public $event_vars;
/**
* Create a new event instance.
*

View File

@ -1,6 +1,6 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com)
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
@ -31,8 +31,9 @@ class MethodDeleted
private $payment_method;
public $company;
public $event_vars;
/**
* Create a new event instance.
*
@ -42,7 +43,7 @@ class MethodDeleted
{
$this->payment_method = $payment_method;
$this->company = $company;
$this->event_vars = $event_vars;
$this->event_vars = $event_vars;
}
/**

View File

@ -1,6 +1,6 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com)
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
@ -30,6 +30,7 @@ class PaymentCompleted
public $company;
public $event_vars;
/**
* Create a new event instance.
*

View File

@ -1,6 +1,6 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com)
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
@ -22,7 +22,6 @@ class PaymentFailed
{
use SerializesModels;
/**
* @var Payment
*/
@ -31,6 +30,7 @@ class PaymentFailed
public $company;
public $event_vars;
/**
* Create a new event instance.
*

View File

@ -1,6 +1,6 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com)
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
@ -22,7 +22,6 @@ class PaymentWasArchived
{
use SerializesModels;
/**
* @var Payment
*/
@ -31,6 +30,7 @@ class PaymentWasArchived
public $company;
public $event_vars;
/**
* Create a new event instance.
*

View File

@ -1,6 +1,6 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com)
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
@ -30,6 +30,7 @@ class PaymentWasCreated
public $company;
public $event_vars;
/**
* Create a new event instance.
*

View File

@ -1,6 +1,6 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com)
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
@ -22,7 +22,6 @@ class PaymentWasDeleted
{
use SerializesModels;
/**
* @var Payment
*/
@ -31,6 +30,7 @@ class PaymentWasDeleted
public $company;
public $event_vars;
/**
* Create a new event instance.
*

View File

@ -1,6 +1,6 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com)
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
@ -22,7 +22,6 @@ class PaymentWasEmailed
{
use SerializesModels;
/**
* @var Payment
*/
@ -31,6 +30,7 @@ class PaymentWasEmailed
public $company;
public $event_vars;
/**
* Create a new event instance.
*

View File

@ -1,6 +1,6 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com)
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
@ -31,6 +31,7 @@ class PaymentWasEmailedAndFailed
public $company;
public $event_vars;
/**
* PaymentWasEmailedAndFailed constructor.
* @param Payment $payment

View File

@ -1,6 +1,6 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com)
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
@ -32,6 +32,7 @@ class PaymentWasRefunded
public $company;
public $event_vars;
/**
* Create a new event instance.
*

View File

@ -1,6 +1,6 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com)
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
@ -29,6 +29,7 @@ class PaymentWasRestored
public $fromDeleted;
public $company;
public $event_vars;
/**
* Create a new event instance.
*

View File

@ -1,6 +1,6 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com)
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
@ -22,7 +22,6 @@ class PaymentWasUpdated
{
use SerializesModels;
/**
* @var Payment
*/
@ -31,6 +30,7 @@ class PaymentWasUpdated
public $company;
public $event_vars;
/**
* Create a new event instance.
*

View File

@ -1,6 +1,6 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com)
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
@ -22,7 +22,6 @@ class PaymentWasVoided
{
use SerializesModels;
/**
* @var Payment
*/
@ -31,6 +30,7 @@ class PaymentWasVoided
public $company;
public $event_vars;
/**
* Create a new event instance.
*

View File

@ -1,6 +1,6 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com)
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
@ -26,6 +26,7 @@ class ProductWasArchived
public $company;
public $event_vars;
/**
* Create a new event instance.
*

View File

@ -1,6 +1,6 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com)
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
@ -29,12 +29,13 @@ class ProductWasCreated
public $company;
public $event_vars;
/**
* Create a new event instance.
*
* @return void
*/
public function __construct(Product $product, $input = null, Company $company, array $event_vars)
public function __construct(Product $product, $input, Company $company, array $event_vars)
{
$this->product = $product;
$this->input = $input;

View File

@ -1,6 +1,6 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com)
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
@ -27,6 +27,7 @@ class ProductWasDeleted
public $company;
public $event_vars;
/**
* Create a new event instance.
*

View File

@ -1,6 +1,6 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com)
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
@ -26,6 +26,7 @@ class ProductWasUpdated
public $company;
public $event_vars;
/**
* Create a new event instance.
*

Some files were not shown because too many files have changed in this diff Show More