diff --git a/app/Console/Commands/ArtisanUpgrade.php b/app/Console/Commands/ArtisanUpgrade.php index 6180ad781c..405fe4675c 100644 --- a/app/Console/Commands/ArtisanUpgrade.php +++ b/app/Console/Commands/ArtisanUpgrade.php @@ -41,41 +41,32 @@ class ArtisanUpgrade extends Command public function handle() { set_time_limit(0); - // Composer\Factory::getHomeDir() method + // Composer\Factory::getHomeDir() method // needs COMPOSER_HOME environment variable set putenv('COMPOSER_HOME=' . __DIR__ . '/vendor/bin/composer'); // call `composer install` command programmatically $input = new ArrayInput(array('command' => 'install')); $application = new Application(); - $application->setAutoExit(false); // prevent `$application->run` method from exitting the script + //$application->setAutoExit(false); // prevent `$application->run` method from exitting the script $application->run($input); try { - Artisan::call('migrate'); - - }catch(Exception $e) { - + } catch (Exception $e) { \Log::error("I wasn't able to migrate the data."); } try { - Artisan::call('optimize'); - - }catch(Exception $e) { - + } catch (Exception $e) { \Log::error("I wasn't able to optimize."); } try { - Artisan::call('queue:restart'); - - }catch(Exception $e) { - + } catch (Exception $e) { \Log::error("I wasn't able to restart the queue"); } } diff --git a/app/Console/Commands/CreateTestData.php b/app/Console/Commands/CreateTestData.php index f608881e3f..5d7a8625ee 100644 --- a/app/Console/Commands/CreateTestData.php +++ b/app/Console/Commands/CreateTestData.php @@ -122,7 +122,7 @@ class CreateTestData extends Command 'settings' => null, ]); - factory(\App\Models\Product::class,50)->create([ + factory(\App\Models\Product::class, 50)->create([ 'user_id' => $user->id, 'company_id' => $company->id, ]); @@ -136,32 +136,28 @@ class CreateTestData extends Command $this->createClient($company, $user); } - foreach($company->clients as $client) { - + foreach ($company->clients as $client) { $this->info('creating invoice for client #'.$client->id); - $this->createInvoice($client); + $this->createInvoice($client); $this->info('creating credit for client #'.$client->id); - $this->createCredit($client); + $this->createCredit($client); $this->info('creating quote for client #'.$client->id); - $this->createQuote($client); + $this->createQuote($client); $this->info('creating expense for client #'.$client->id); - $this->createExpense($client); + $this->createExpense($client); $this->info('creating vendor for client #'.$client->id); - $this->createVendor($client); + $this->createVendor($client); $this->info('creating task for client #'.$client->id); - $this->createTask($client); + $this->createTask($client); $this->info('creating project for client #'.$client->id); - $this->createProject($client); - - + $this->createProject($client); } - } private function createMediumAccount() @@ -208,7 +204,7 @@ class CreateTestData extends Command ]); - factory(\App\Models\Product::class,50)->create([ + factory(\App\Models\Product::class, 50)->create([ 'user_id' => $user->id, 'company_id' => $company->id, ]); @@ -224,43 +220,49 @@ class CreateTestData extends Command $this->createClient($company, $user); } - foreach($company->clients as $client) { - + foreach ($company->clients as $client) { $this->info('creating invoice for client #'.$client->id); - for($i=0; $i<$this->count; $i++) - $this->createInvoice($client); + for ($i=0; $i<$this->count; $i++) { + $this->createInvoice($client); + } $this->info('creating credit for client #'.$client->id); - for($i=0; $i<$this->count; $i++) - $this->createCredit($client); + for ($i=0; $i<$this->count; $i++) { + $this->createCredit($client); + } $this->info('creating quote for client #'.$client->id); - for($i=0; $i<$this->count; $i++) - $this->createQuote($client); + for ($i=0; $i<$this->count; $i++) { + $this->createQuote($client); + } $this->info('creating expense for client #'.$client->id); - for($i=0; $i<$this->count; $i++) - $this->createExpense($client); + for ($i=0; $i<$this->count; $i++) { + $this->createExpense($client); + } $this->info('creating vendor for client #'.$client->id); - for($i=0; $i<$this->count; $i++) - $this->createVendor($client); + for ($i=0; $i<$this->count; $i++) { + $this->createVendor($client); + } $this->info('creating task for client #'.$client->id); - for($i=0; $i<$this->count; $i++) - $this->createTask($client); + for ($i=0; $i<$this->count; $i++) { + $this->createTask($client); + } $this->info('creating project for client #'.$client->id); - for($i=0; $i<$this->count; $i++) - $this->createProject($client); + for ($i=0; $i<$this->count; $i++) { + $this->createProject($client); + } } } @@ -308,7 +310,7 @@ class CreateTestData extends Command ]); - factory(\App\Models\Product::class,50)->create([ + factory(\App\Models\Product::class, 50)->create([ 'user_id' => $user->id, 'company_id' => $company->id, ]); @@ -325,30 +327,28 @@ class CreateTestData extends Command $this->createClient($company, $user); } - foreach($company->clients as $client) { - + foreach ($company->clients as $client) { $this->info('creating invoice for client #'.$client->id); - $this->createInvoice($client); + $this->createInvoice($client); $this->info('creating credit for client #'.$client->id); - $this->createCredit($client); + $this->createCredit($client); $this->info('creating quote for client #'.$client->id); - $this->createQuote($client); + $this->createQuote($client); $this->info('creating expense for client #'.$client->id); - $this->createExpense($client); + $this->createExpense($client); $this->info('creating vendor for client #'.$client->id); - $this->createVendor($client); + $this->createVendor($client); $this->info('creating task for client #'.$client->id); - $this->createTask($client); + $this->createTask($client); $this->info('creating project for client #'.$client->id); - $this->createProject($client); + $this->createProject($client); } - } private function createClient($company, $user) @@ -357,42 +357,36 @@ class CreateTestData extends Command // dispatch(function () use ($company, $user) { // }); - $client = factory(\App\Models\Client::class)->create([ + $client = factory(\App\Models\Client::class)->create([ 'user_id' => $user->id, 'company_id' => $company->id ]); - factory(\App\Models\ClientContact::class, 1)->create([ + factory(\App\Models\ClientContact::class, 1)->create([ 'user_id' => $user->id, 'client_id' => $client->id, 'company_id' => $company->id, 'is_primary' => 1 ]); - factory(\App\Models\ClientContact::class, rand(1, 5))->create([ + factory(\App\Models\ClientContact::class, rand(1, 5))->create([ 'user_id' => $user->id, 'client_id' => $client->id, 'company_id' => $company->id ]); - - - } private function createExpense($client) { - factory(\App\Models\Expense::class, rand(1, 5))->create([ 'user_id' => $client->user->id, 'client_id' => $client->id, 'company_id' => $client->company->id ]); - } private function createVendor($client) { - $vendor = factory(\App\Models\Vendor::class)->create([ 'user_id' => $client->user->id, 'company_id' => $client->company->id @@ -412,12 +406,10 @@ class CreateTestData extends Command 'company_id' => $client->company->id, 'is_primary' => 0 ]); - } private function createTask($client) { - $vendor = factory(\App\Models\Task::class)->create([ 'user_id' => $client->user->id, 'company_id' => $client->company->id @@ -426,7 +418,6 @@ class CreateTestData extends Command private function createProject($client) { - $vendor = factory(\App\Models\Project::class)->create([ 'user_id' => $client->user->id, 'company_id' => $client->company->id @@ -444,10 +435,10 @@ class CreateTestData extends Command $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)); + $dateable = Carbon::now()->subDays(rand(0, 90)); $invoice->date = $dateable; - $invoice->line_items = $this->buildLineItems(rand(1,10)); + $invoice->line_items = $this->buildLineItems(rand(1, 10)); $invoice->uses_inclusive_taxes = false; if (rand(0, 1)) { @@ -517,10 +508,10 @@ class CreateTestData extends Command $credit = factory(\App\Models\Credit::class)->create(['user_id' => $client->user->id, 'company_id' => $client->company->id, 'client_id' => $client->id]); - $dateable = Carbon::now()->subDays(rand(0,90)); + $dateable = Carbon::now()->subDays(rand(0, 90)); $credit->date = $dateable; - $credit->line_items = $this->buildLineItems(rand(1,10)); + $credit->line_items = $this->buildLineItems(rand(1, 10)); $credit->uses_inclusive_taxes = false; if (rand(0, 1)) { @@ -548,7 +539,6 @@ class CreateTestData extends Command $credit->save(); $credit->service()->markSent()->save(); $credit->service()->createInvitations(); - } private function createQuote($client) @@ -566,7 +556,7 @@ class CreateTestData extends Command $quote->setRelation('client', $client); - $quote->line_items = $this->buildLineItems(rand(1,10)); + $quote->line_items = $this->buildLineItems(rand(1, 10)); $quote->uses_inclusive_taxes = false; if (rand(0, 1)) { @@ -595,15 +585,13 @@ class CreateTestData extends Command $quote->service()->markSent()->save(); $quote->service()->createInvitations(); - } 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; @@ -623,15 +611,15 @@ class CreateTestData extends Command $item->tax_rate1 = 5; } - $product = Product::all()->random(); + $product = Product::all()->random(); - $item->cost = (float)$product->cost; - $item->product_key = $product->product_key; - $item->notes = $product->notes; - $item->custom_value1 = $product->custom_value1; - $item->custom_value2 = $product->custom_value2; - $item->custom_value3 = $product->custom_value3; - $item->custom_value4 = $product->custom_value4; + $item->cost = (float)$product->cost; + $item->product_key = $product->product_key; + $item->notes = $product->notes; + $item->custom_value1 = $product->custom_value1; + $item->custom_value2 = $product->custom_value2; + $item->custom_value3 = $product->custom_value3; + $item->custom_value4 = $product->custom_value4; diff --git a/app/Console/Commands/DesignUpdate.php b/app/Console/Commands/DesignUpdate.php index 41cbca57ff..6575f4beda 100644 --- a/app/Console/Commands/DesignUpdate.php +++ b/app/Console/Commands/DesignUpdate.php @@ -38,9 +38,7 @@ class DesignUpdate extends Command */ public function handle() { - - foreach(Design::whereIsCustom(false)->get() as $design){ - + foreach (Design::whereIsCustom(false)->get() as $design) { $class = 'App\Designs\\'.$design->name; $invoice_design = new $class(); @@ -55,7 +53,5 @@ class DesignUpdate extends Command $design->design = $design_object; $design->save(); } - } - } diff --git a/app/Console/Commands/ImportMigrations.php b/app/Console/Commands/ImportMigrations.php index 5683f594f9..5393d0bb63 100644 --- a/app/Console/Commands/ImportMigrations.php +++ b/app/Console/Commands/ImportMigrations.php @@ -40,7 +40,6 @@ class ImportMigrations extends Command */ public function __construct() { - $this->faker = \Faker\Factory::create(); parent::__construct(); diff --git a/app/Console/Commands/SendTestEmails.php b/app/Console/Commands/SendTestEmails.php index 88f7cd62cd..42f2c55912 100644 --- a/app/Console/Commands/SendTestEmails.php +++ b/app/Console/Commands/SendTestEmails.php @@ -72,7 +72,6 @@ class SendTestEmails extends Command if (!$user) { - $user = factory(\App\Models\User::class)->create([ 'confirmation_code' => '123', 'email' => $faker->safeEmail, @@ -97,10 +96,7 @@ class SendTestEmails extends Command //'settings' => DefaultSettings::userSettings(), 'settings' => null, ]); - - } - else - { + } else { $company = $user->company_users->first()->company; $account = $company->account; } @@ -111,7 +107,6 @@ class SendTestEmails extends Command if (!$client) { - $client = ClientFactory::create($company->id, $user->id); $client->save(); @@ -138,10 +133,10 @@ class SendTestEmails extends Command $invoice->setRelation('client', $client); $invoice->save(); - $ii = InvoiceInvitationFactory::create($invoice->company_id, $invoice->user_id); - $ii->invoice_id = $invoice->id; - $ii->client_contact_id = $client->primary_contact()->first()->id; - $ii->save(); + $ii = InvoiceInvitationFactory::create($invoice->company_id, $invoice->user_id); + $ii->invoice_id = $invoice->id; + $ii->client_contact_id = $client->primary_contact()->first()->id; + $ii->save(); $invoice->setRelation('invitations', $ii); $invoice->service()->markSent()->save(); diff --git a/app/Console/Commands/TestData/CreateTestCreditJob.php b/app/Console/Commands/TestData/CreateTestCreditJob.php index 32a4dee4fe..47b72d75d2 100644 --- a/app/Console/Commands/TestData/CreateTestCreditJob.php +++ b/app/Console/Commands/TestData/CreateTestCreditJob.php @@ -46,7 +46,6 @@ class CreateTestCreditJob implements ShouldQueue public function __construct(Client $client) { $this->client = $client; - } /** @@ -54,7 +53,7 @@ class CreateTestCreditJob implements ShouldQueue * * @return void */ - public function handle() + public function handle() { $faker = \Faker\Factory::create(); @@ -63,10 +62,10 @@ class CreateTestCreditJob implements ShouldQueue //$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)); + $dateable = Carbon::now()->subDays(rand(0, 90)); $credit->date = $dateable; - $credit->line_items = $this->buildLineItems(rand(1,10)); + $credit->line_items = $this->buildLineItems(rand(1, 10)); $credit->uses_inclusive_taxes = false; if (rand(0, 1)) { @@ -101,8 +100,7 @@ class CreateTestCreditJob implements ShouldQueue { $line_items = []; - for($x=0; $x<$count; $x++) - { + for ($x=0; $x<$count; $x++) { $item = InvoiceItemFactory::create(); $item->quantity = 1; //$item->cost = 10; @@ -122,15 +120,15 @@ class CreateTestCreditJob implements ShouldQueue $item->tax_rate1 = 5; } - $product = Product::all()->random(); + $product = Product::all()->random(); - $item->cost = (float)$product->cost; - $item->product_key = $product->product_key; - $item->notes = $product->notes; - $item->custom_value1 = $product->custom_value1; - $item->custom_value2 = $product->custom_value2; - $item->custom_value3 = $product->custom_value3; - $item->custom_value4 = $product->custom_value4; + $item->cost = (float)$product->cost; + $item->product_key = $product->product_key; + $item->notes = $product->notes; + $item->custom_value1 = $product->custom_value1; + $item->custom_value2 = $product->custom_value2; + $item->custom_value3 = $product->custom_value3; + $item->custom_value4 = $product->custom_value4; diff --git a/app/Console/Commands/TestData/CreateTestInvoiceJob.php b/app/Console/Commands/TestData/CreateTestInvoiceJob.php index 02a8ce9634..9ad587373a 100644 --- a/app/Console/Commands/TestData/CreateTestInvoiceJob.php +++ b/app/Console/Commands/TestData/CreateTestInvoiceJob.php @@ -45,7 +45,6 @@ class CreateTestInvoiceJob implements ShouldQueue public function __construct(Client $client) { $this->client = $client; - } /** @@ -53,18 +52,17 @@ class CreateTestInvoiceJob implements ShouldQueue * * @return void */ - public function handle() + public function handle() { - $faker = \Faker\Factory::create(); $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)); + $dateable = Carbon::now()->subDays(rand(0, 90)); $invoice->date = $dateable; - $invoice->line_items = $this->buildLineItems(rand(1,10)); + $invoice->line_items = $this->buildLineItems(rand(1, 10)); $invoice->uses_inclusive_taxes = false; if (rand(0, 1)) { @@ -127,8 +125,7 @@ class CreateTestInvoiceJob implements ShouldQueue { $line_items = []; - for($x=0; $x<$count; $x++) - { + for ($x=0; $x<$count; $x++) { $item = InvoiceItemFactory::create(); $item->quantity = 1; //$item->cost = 10; @@ -148,15 +145,15 @@ class CreateTestInvoiceJob implements ShouldQueue $item->tax_rate1 = 5; } - $product = Product::all()->random(); + $product = Product::all()->random(); - $item->cost = (float)$product->cost; - $item->product_key = $product->product_key; - $item->notes = $product->notes; - $item->custom_value1 = $product->custom_value1; - $item->custom_value2 = $product->custom_value2; - $item->custom_value3 = $product->custom_value3; - $item->custom_value4 = $product->custom_value4; + $item->cost = (float)$product->cost; + $item->product_key = $product->product_key; + $item->notes = $product->notes; + $item->custom_value1 = $product->custom_value1; + $item->custom_value2 = $product->custom_value2; + $item->custom_value3 = $product->custom_value3; + $item->custom_value4 = $product->custom_value4; diff --git a/app/Console/Commands/TestData/CreateTestQuoteJob.php b/app/Console/Commands/TestData/CreateTestQuoteJob.php index 1d1b834d1d..ad3b81d8c8 100644 --- a/app/Console/Commands/TestData/CreateTestQuoteJob.php +++ b/app/Console/Commands/TestData/CreateTestQuoteJob.php @@ -46,7 +46,6 @@ class CreateTestQuoteJob implements ShouldQueue public function __construct(Client $client) { $this->client = $client; - } /** @@ -61,7 +60,7 @@ class CreateTestQuoteJob implements ShouldQueue $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)); + $quote->line_items = $this->buildLineItems(rand(1, 10)); $quote->uses_inclusive_taxes = false; if (rand(0, 1)) { @@ -88,7 +87,6 @@ class CreateTestQuoteJob implements ShouldQueue $quote->service()->markSent()->save(); CreateQuoteInvitations::dispatch($quote, $quote->company); - } @@ -97,8 +95,7 @@ class CreateTestQuoteJob implements ShouldQueue { $line_items = []; - for($x=0; $x<$count; $x++) - { + for ($x=0; $x<$count; $x++) { $item = InvoiceItemFactory::create(); $item->quantity = 1; //$item->cost = 10; @@ -118,15 +115,15 @@ class CreateTestQuoteJob implements ShouldQueue $item->tax_rate1 = 5; } - $product = Product::all()->random(); + $product = Product::all()->random(); - $item->cost = (float)$product->cost; - $item->product_key = $product->product_key; - $item->notes = $product->notes; - $item->custom_value1 = $product->custom_value1; - $item->custom_value2 = $product->custom_value2; - $item->custom_value3 = $product->custom_value3; - $item->custom_value4 = $product->custom_value4; + $item->cost = (float)$product->cost; + $item->product_key = $product->product_key; + $item->notes = $product->notes; + $item->custom_value1 = $product->custom_value1; + $item->custom_value2 = $product->custom_value2; + $item->custom_value3 = $product->custom_value3; + $item->custom_value4 = $product->custom_value4; @@ -135,5 +132,4 @@ class CreateTestQuoteJob implements ShouldQueue return $line_items; } - } diff --git a/app/DataMapper/CompanySettings.php b/app/DataMapper/CompanySettings.php index a14576673f..e3615847c3 100644 --- a/app/DataMapper/CompanySettings.php +++ b/app/DataMapper/CompanySettings.php @@ -18,519 +18,521 @@ use App\Utils\Traits\MakesHash; * CompanySettings */ -class CompanySettings extends BaseSettings { +class CompanySettings extends BaseSettings +{ + use MakesHash; + /*Group settings based on functionality*/ - use MakesHash; - /*Group settings based on functionality*/ + /*Invoice*/ + public $auto_archive_invoice = false; + public $lock_sent_invoices = false; - /*Invoice*/ - public $auto_archive_invoice = false; - public $lock_sent_invoices = 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 $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 = -1; + public $send_reminders = false; - public $payment_terms = -1; - public $send_reminders = false; + 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 $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 $inclusive_taxes = false; + public $quote_footer = ''; - public $inclusive_taxes = false; - public $quote_footer = ''; + public $translations; - public $translations; + public $counter_number_applied = 'when_saved';// when_saved , when_sent , when_paid + public $quote_number_applied = 'when_saved';// when_saved , when_sent - public $counter_number_applied = 'when_saved';// when_saved , when_sent , when_paid - public $quote_number_applied = 'when_saved';// when_saved , when_sent + /* Counters */ + public $invoice_number_pattern = ''; + public $invoice_number_counter = 1; - /* Counters */ - public $invoice_number_pattern = ''; - public $invoice_number_counter = 1; + public $quote_number_pattern = ''; + public $quote_number_counter = 1; - public $quote_number_pattern = ''; - public $quote_number_counter = 1; + public $client_number_pattern = ''; + public $client_number_counter = 1; - public $client_number_pattern = ''; - public $client_number_counter = 1; + public $credit_number_pattern = ''; + public $credit_number_counter = 1; - public $credit_number_pattern = ''; - public $credit_number_counter = 1; + public $task_number_pattern = ''; + public $task_number_counter = 1; - public $task_number_pattern = ''; - public $task_number_counter = 1; + public $expense_number_pattern = ''; + public $expense_number_counter = 1; - public $expense_number_pattern = ''; - public $expense_number_counter = 1; + public $vendor_number_pattern = ''; + public $vendor_number_counter = 1; - public $vendor_number_pattern = ''; - public $vendor_number_counter = 1; + public $ticket_number_pattern = ''; + public $ticket_number_counter = 1; - public $ticket_number_pattern = ''; - public $ticket_number_counter = 1; + public $payment_number_pattern = ''; + public $payment_number_counter = 1; - public $payment_number_pattern = ''; - 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 $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 $design = 'views/pdf/design1.blade.php'; - 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 $require_invoice_signature = false; + public $require_quote_signature = false; - public $show_accept_invoice_terms = false; - public $show_accept_quote_terms = false; - public $require_invoice_signature = false; - public $require_quote_signature = false; + //email settings + public $email_sending_method = 'default';//enum 'default','gmail' + public $gmail_sending_user_id = '0'; - //email settings - public $email_sending_method = 'default';//enum 'default','gmail' - public $gmail_sending_user_id = '0'; + public $reply_to_email = ''; + public $bcc_email = ''; + public $pdf_email_attachment = false; + public $ubl_email_attachment = false; - public $reply_to_email = ''; - public $bcc_email = ''; - public $pdf_email_attachment = false; - public $ubl_email_attachment = false; + public $email_style = 'plain'; //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_style = 'plain';//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_subject_custom1 = ''; + public $email_subject_custom2 = ''; + public $email_subject_custom3 = ''; - public $email_subject_custom1 = ''; - public $email_subject_custom2 = ''; - public $email_subject_custom3 = ''; + public $email_template_custom1 = ''; + public $email_template_custom2 = ''; + public $email_template_custom3 = ''; - public $email_template_custom1 = ''; - public $email_template_custom2 = ''; - public $email_template_custom3 = ''; + public $enable_reminder1 = false; + public $enable_reminder2 = false; + public $enable_reminder3 = false; - public $enable_reminder1 = false; - public $enable_reminder2 = false; - public $enable_reminder3 = false; + public $num_days_reminder1 = 0; + public $num_days_reminder2 = 0; + public $num_days_reminder3 = 0; - public $num_days_reminder1 = 0; - 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 $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 $endless_reminder_frequency_id = '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 - 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*/ - /* Company Meta data that we can use to build sub companies*/ + public $name = ''; + public $company_logo = ''; + 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 $name = ''; - public $company_logo = ''; - 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 $page_size = 'A4'; + 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 $pdf_variables = ''; - public $page_size = 'A4'; - 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 $pdf_variables = ''; + public static $casts = [ + 'portal_design_id' => 'string', + 'late_fee_endless_percent' => 'float', + 'late_fee_endless_amount' => 'float', + 'auto_email_invoice' => 'bool', + 'reminder_send_time' => 'int', + 'email_sending_method' => 'string', + 'gmail_sending_user_id' => 'string', + 'currency_id' => 'string', + 'counter_number_applied' => 'string', + 'quote_number_applied' => 'string', + 'email_subject_custom1' => 'string', + 'email_subject_custom2' => 'string', + 'email_subject_custom3' => 'string', + 'email_template_custom1' => 'string', + 'email_template_custom2' => 'string', + 'email_template_custom3' => 'string', + 'enable_reminder1' => 'bool', + 'enable_reminder2' => 'bool', + 'enable_reminder3' => 'bool', + 'num_days_reminder1' => 'int', + 'num_days_reminder2' => 'int', + 'num_days_reminder3' => 'int', + 'schedule_reminder1' => 'string', // (enum: after_invoice_date, before_due_date, after_due_date) + 'schedule_reminder2' => 'string', // (enum: after_invoice_date, before_due_date, after_due_date) + 'schedule_reminder3' => 'string', // (enum: after_invoice_date, before_due_date, after_due_date) + 'late_fee_amount1' => 'float', + 'late_fee_amount2' => 'float', + 'late_fee_amount3' => 'float', + 'endless_reminder_frequency_id' => 'integer', + 'client_online_payment_notification' => 'bool', + 'client_manual_payment_notification' => 'bool', + 'document_email_attachment' => 'bool', + 'enable_client_portal_password' => 'bool', + 'enable_email_markup' => 'bool', + 'enable_client_portal_dashboard' => 'bool', + 'enable_client_portal' => 'bool', + 'email_template_statement' => 'string', + 'email_subject_statement' => 'string', + 'signature_on_pdf' => 'bool', + 'send_portal_password' => 'bool', + 'quote_footer' => 'string', + 'page_size' => 'string', + 'font_size' => 'int', + 'primary_font' => 'string', + 'secondary_font' => 'string', + 'hide_paid_to_date' => 'bool', + 'embed_documents' => 'bool', + 'all_pages_header' => 'bool', + 'all_pages_footer' => 'bool', + 'task_number_pattern' => 'string', + 'task_number_counter' => 'int', + 'expense_number_pattern' => 'string', + 'expense_number_counter' => 'int', + 'vendor_number_pattern' => 'string', + 'vendor_number_counter' => 'int', + 'ticket_number_pattern' => 'string', + 'ticket_number_counter' => 'int', + 'payment_number_pattern' => 'string', + 'payment_number_counter' => 'int', + 'reply_to_email' => 'string', + 'bcc_email' => 'string', + 'pdf_email_attachment' => 'bool', + 'ubl_email_attachment' => 'bool', + 'email_style' => 'string', + 'email_style_custom' => 'string', + 'company_gateway_ids' => 'string', + 'address1' => 'string', + 'address2' => 'string', + 'city' => 'string', + 'company_logo' => 'string', + 'country_id' => 'string', + 'client_number_pattern' => 'string', + 'client_number_counter' => 'integer', + 'credit_number_pattern' => 'string', + 'credit_number_counter' => 'integer', + 'currency_id' => 'string', + 'custom_value1' => 'string', + 'custom_value2' => 'string', + 'custom_value3' => 'string', + 'custom_value4' => 'string', + 'custom_message_dashboard' => 'string', + 'custom_message_unpaid_invoice' => 'string', + 'custom_message_paid_invoice' => 'string', + 'custom_message_unapproved_quote' => 'string', + 'default_task_rate' => 'float', + 'email_signature' => 'string', + 'email_subject_invoice' => 'string', + 'email_subject_quote' => 'string', + 'email_subject_payment' => 'string', + 'email_subject_payment_partial' => 'string', + 'email_template_invoice' => 'string', + 'email_template_quote' => 'string', + 'email_template_payment' => 'string', + 'email_template_payment_partial' => 'string', + 'email_subject_reminder1' => 'string', + 'email_subject_reminder2' => 'string', + 'email_subject_reminder3' => 'string', + 'email_subject_reminder_endless' => 'string', + 'email_template_reminder1' => 'string', + 'email_template_reminder2' => 'string', + 'email_template_reminder3' => 'string', + 'email_template_reminder_endless' => 'string', + 'enable_client_portal_password' => 'bool', + 'inclusive_taxes' => 'bool', + 'invoice_number_pattern' => 'string', + 'invoice_number_counter' => 'integer', + 'invoice_design_id' => 'string', + 'invoice_fields' => 'string', + 'invoice_taxes' => 'int', + 'enabled_item_tax_rates' => 'int', + 'invoice_footer' => 'string', + 'invoice_labels' => 'string', + 'invoice_terms' => 'string', + 'credit_footer' => 'string', + 'credit_terms' => 'string', + 'name' => 'string', + 'payment_terms' => 'integer', + 'payment_type_id' => 'string', + 'phone' => 'string', + 'postal_code' => 'string', + 'quote_design_id' => 'string', + 'credit_design_id' => 'string', + 'quote_number_pattern' => 'string', + 'quote_number_counter' => 'integer', + 'quote_terms' => 'string', + 'recurring_number_prefix' => 'string', + 'reset_counter_frequency_id' => 'integer', + 'reset_counter_date' => 'string', + 'require_invoice_signature' => 'bool', + 'require_quote_signature' => 'bool', + 'state' => 'string', + 'email' => 'string', + 'vat_number' => 'string', + 'id_number' => 'string', + 'tax_name1' => 'string', + 'tax_name2' => 'string', + 'tax_name3' => 'string', + 'tax_rate1' => 'float', + 'tax_rate2' => 'float', + 'tax_rate3' => 'float', + 'show_accept_quote_terms' => 'bool', + 'show_accept_invoice_terms' => 'bool', + 'timezone_id' => 'string', + 'date_format_id' => 'string', + 'military_time' => 'bool', + 'language_id' => 'string', + 'show_currency_code' => 'bool', + 'send_reminders' => 'bool', + 'enable_client_portal_tasks' => 'bool', + 'lock_sent_invoices' => 'bool', + 'auto_archive_invoice' => 'bool', + 'auto_archive_quote' => 'bool', + 'auto_convert_quote' => 'bool', + 'shared_invoice_quote_counter' => 'bool', + 'counter_padding' => 'integer', + 'design' => 'string', + 'website' => 'string', + 'pdf_variables' => 'object', + ]; - public static $casts = [ - 'portal_design_id' => 'string', - 'late_fee_endless_percent' => 'float', - 'late_fee_endless_amount' => 'float', - 'auto_email_invoice' => 'bool', - 'reminder_send_time' => 'int', - 'email_sending_method' => 'string', - 'gmail_sending_user_id' => 'string', - 'currency_id' => 'string', - 'counter_number_applied' => 'string', - 'quote_number_applied' => 'string', - 'email_subject_custom1' => 'string', - 'email_subject_custom2' => 'string', - 'email_subject_custom3' => 'string', - 'email_template_custom1' => 'string', - 'email_template_custom2' => 'string', - 'email_template_custom3' => 'string', - 'enable_reminder1' => 'bool', - 'enable_reminder2' => 'bool', - 'enable_reminder3' => 'bool', - 'num_days_reminder1' => 'int', - 'num_days_reminder2' => 'int', - 'num_days_reminder3' => 'int', - 'schedule_reminder1' => 'string', // (enum: after_invoice_date, before_due_date, after_due_date) - 'schedule_reminder2' => 'string', // (enum: after_invoice_date, before_due_date, after_due_date) - 'schedule_reminder3' => 'string', // (enum: after_invoice_date, before_due_date, after_due_date) - 'late_fee_amount1' => 'float', - 'late_fee_amount2' => 'float', - 'late_fee_amount3' => 'float', - 'endless_reminder_frequency_id' => 'integer', - 'client_online_payment_notification' => 'bool', - 'client_manual_payment_notification' => 'bool', - 'document_email_attachment' => 'bool', - 'enable_client_portal_password' => 'bool', - 'enable_email_markup' => 'bool', - 'enable_client_portal_dashboard' => 'bool', - 'enable_client_portal' => 'bool', - 'email_template_statement' => 'string', - 'email_subject_statement' => 'string', - 'signature_on_pdf' => 'bool', - 'send_portal_password' => 'bool', - 'quote_footer' => 'string', - 'page_size' => 'string', - 'font_size' => 'int', - 'primary_font' => 'string', - 'secondary_font' => 'string', - 'hide_paid_to_date' => 'bool', - 'embed_documents' => 'bool', - 'all_pages_header' => 'bool', - 'all_pages_footer' => 'bool', - 'task_number_pattern' => 'string', - 'task_number_counter' => 'int', - 'expense_number_pattern' => 'string', - 'expense_number_counter' => 'int', - 'vendor_number_pattern' => 'string', - 'vendor_number_counter' => 'int', - 'ticket_number_pattern' => 'string', - 'ticket_number_counter' => 'int', - 'payment_number_pattern' => 'string', - 'payment_number_counter' => 'int', - 'reply_to_email' => 'string', - 'bcc_email' => 'string', - 'pdf_email_attachment' => 'bool', - 'ubl_email_attachment' => 'bool', - 'email_style' => 'string', - 'email_style_custom' => 'string', - 'company_gateway_ids' => 'string', - 'address1' => 'string', - 'address2' => 'string', - 'city' => 'string', - 'company_logo' => 'string', - 'country_id' => 'string', - 'client_number_pattern' => 'string', - 'client_number_counter' => 'integer', - 'credit_number_pattern' => 'string', - 'credit_number_counter' => 'integer', - 'currency_id' => 'string', - 'custom_value1' => 'string', - 'custom_value2' => 'string', - 'custom_value3' => 'string', - 'custom_value4' => 'string', - 'custom_message_dashboard' => 'string', - 'custom_message_unpaid_invoice' => 'string', - 'custom_message_paid_invoice' => 'string', - 'custom_message_unapproved_quote' => 'string', - 'default_task_rate' => 'float', - 'email_signature' => 'string', - 'email_subject_invoice' => 'string', - 'email_subject_quote' => 'string', - 'email_subject_payment' => 'string', - 'email_subject_payment_partial' => 'string', - 'email_template_invoice' => 'string', - 'email_template_quote' => 'string', - 'email_template_payment' => 'string', - 'email_template_payment_partial' => 'string', - 'email_subject_reminder1' => 'string', - 'email_subject_reminder2' => 'string', - 'email_subject_reminder3' => 'string', - 'email_subject_reminder_endless' => 'string', - 'email_template_reminder1' => 'string', - 'email_template_reminder2' => 'string', - 'email_template_reminder3' => 'string', - 'email_template_reminder_endless' => 'string', - 'enable_client_portal_password' => 'bool', - 'inclusive_taxes' => 'bool', - 'invoice_number_pattern' => 'string', - 'invoice_number_counter' => 'integer', - 'invoice_design_id' => 'string', - 'invoice_fields' => 'string', - 'invoice_taxes' => 'int', - 'enabled_item_tax_rates' => 'int', - 'invoice_footer' => 'string', - 'invoice_labels' => 'string', - 'invoice_terms' => 'string', - 'credit_footer' => 'string', - 'credit_terms' => 'string', - 'name' => 'string', - 'payment_terms' => 'integer', - 'payment_type_id' => 'string', - 'phone' => 'string', - 'postal_code' => 'string', - 'quote_design_id' => 'string', - 'credit_design_id' => 'string', - 'quote_number_pattern' => 'string', - 'quote_number_counter' => 'integer', - 'quote_terms' => 'string', - 'recurring_number_prefix' => 'string', - 'reset_counter_frequency_id' => 'integer', - 'reset_counter_date' => 'string', - 'require_invoice_signature' => 'bool', - 'require_quote_signature' => 'bool', - 'state' => 'string', - 'email' => 'string', - 'vat_number' => 'string', - 'id_number' => 'string', - 'tax_name1' => 'string', - 'tax_name2' => 'string', - 'tax_name3' => 'string', - 'tax_rate1' => 'float', - 'tax_rate2' => 'float', - 'tax_rate3' => 'float', - 'show_accept_quote_terms' => 'bool', - 'show_accept_invoice_terms' => 'bool', - 'timezone_id' => 'string', - 'date_format_id' => 'string', - 'military_time' => 'bool', - 'language_id' => 'string', - 'show_currency_code' => 'bool', - 'send_reminders' => 'bool', - 'enable_client_portal_tasks' => 'bool', - 'lock_sent_invoices' => 'bool', - 'auto_archive_invoice' => 'bool', - 'auto_archive_quote' => 'bool', - 'auto_convert_quote' => 'bool', - 'shared_invoice_quote_counter' => 'bool', - 'counter_padding' => 'integer', - 'design' => 'string', - 'website' => 'string', - 'pdf_variables' => 'object', - ]; + /** + * Array of variables which + * cannot be modified client side + */ + public static $protected_fields = [ + // 'credit_number_counter', + // 'invoice_number_counter', + // 'quote_number_counter', + ]; - /** - * Array of variables which - * cannot be modified client side - */ - public static $protected_fields = [ - // 'credit_number_counter', - // 'invoice_number_counter', - // 'quote_number_counter', - ]; + /** + * Cast object values and return entire class + * prevents missing properties from not being returned + * and always ensure an up to date class is returned + * + * @return \stdClass + */ + public function __construct($obj) + { + // parent::__construct($obj); + } - /** - * Cast object values and return entire class - * prevents missing properties from not being returned - * and always ensure an up to date class is returned - * - * @return \stdClass - */ - public function __construct($obj) { - // parent::__construct($obj); - } + /** + * Provides class defaults on init + * @return object + */ + public static function defaults():\stdClass + { + $config = json_decode(config('ninja.settings')); - /** - * Provides class defaults on init - * @return object - */ - public static function defaults():\stdClass { + $data = (object) get_class_vars(CompanySettings::class); - $config = json_decode(config('ninja.settings')); + unset($data->casts); + unset($data->protected_fields); - $data = (object) get_class_vars(CompanySettings::class ); + $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(); - unset($data->casts); - unset($data->protected_fields); + return self::setCasts($data, self::$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 = (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(); + /** + * In case we update the settings object in the future we + * need to provide a fallback catch on old settings objects which will + * set new properties to the object prior to being returned. + * + * @param object $data The settings object to be checked + */ + public static function setProperties($settings):\stdClass + { + $company_settings = (object) get_class_vars(CompanySettings::class); - return self::setCasts($data, self::$casts); - } + foreach ($company_settings as $key => $value) { + if (!property_exists($settings, $key)) { + $settings->{ $key} = self::castAttribute($key, $company_settings->{ $key}); + } + } - /** - * In case we update the settings object in the future we - * need to provide a fallback catch on old settings objects which will - * set new properties to the object prior to being returned. - * - * @param object $data The settings object to be checked - */ - public static function setProperties($settings):\stdClass { - $company_settings = (object) get_class_vars(CompanySettings::class ); + return $settings; + } - foreach ($company_settings as $key => $value) { - if (!property_exists($settings, $key)) { - $settings->{ $key} = self::castAttribute($key, $company_settings->{ $key}); - } - } + public static function notificationDefaults() + { + $notification = new \stdClass; + $notification->email = ['all_notifications']; - return $settings; - } + return $notification; + } - public static function notificationDefaults() { - - $notification = new \stdClass; - $notification->email = ['all_notifications']; - - return $notification; - } - - private static function getEntityVariableDefaults() { - - $variables = [ - 'client_details' => [ - '$client.name' => ctrans('texts.client_name'), - '$client.id_number' => ctrans('texts.id_number'), - '$client.vat_number' => ctrans('texts.vat_number'), - '$client.address1' => ctrans('texts.address1'), - '$client.address2' => ctrans('texts.address2'), - '$client.city_state_postal' => ctrans('texts.city_state_postal'), - '$client.country' => ctrans('texts.country'), - '$client.email' => ctrans('texts.email'), - ], - 'company_details' => [ - '$company.company_name' => ctrans('texts.company_name'), - '$company.id_number' => ctrans('texts.id_number'), - '$company.vat_number' => ctrans('texts.vat_number'), - '$company.website' => ctrans('texts.website'), - '$company.email' => ctrans('texts.email'), - '$company.phone' => ctrans('texts.phone'), - ], - 'company_address' => [ - '$company.address1' => ctrans('texts.address1'), - '$company.address2' => ctrans('texts.address2'), - '$company.city_state_postal' => ctrans('texts.city_state_postal'), - '$company.country' => ctrans('texts.country'), - ], - 'invoice_details' => [ - '$invoice.invoice_number' => ctrans('texts.invoice_number'), - '$invoice.po_number' => ctrans('texts.po_number'), - '$invoice.invoice_date' => ctrans('texts.invoice_date'), - '$invoice.due_date' => ctrans('texts.due_date'), - '$invoice.balance_due' => ctrans('texts.balance_due'), - '$invoice.invoice_total' => ctrans('texts.invoice_total'), - ], - 'quote_details' => [ - '$quote.quote_number' => ctrans('texts.quote_number'), - '$quote.po_number' => ctrans('texts.po_number'), - '$quote.quote_date' => ctrans('texts.quote_date'), - '$quote.valid_until' => ctrans('texts.valid_until'), - '$quote.balance_due' => ctrans('texts.balance_due'), - '$quote.quote_total' => ctrans('texts.quote_total'), - ], - 'credit_details' => [ - '$credit.credit_number' => ctrans('texts.credit_number'), - '$credit.po_number' => ctrans('texts.po_number'), - '$credit.credit_date' => ctrans('texts.credit_date'), - '$credit.credit_balance' => ctrans('texts.credit_balance'), - '$credit.credit_amount' => ctrans('texts.credit_amount'), - ], - 'product_columns' => [ - '$product.product_key' => ctrans('texts.product_key'), - '$product.notes' => ctrans('texts.notes'), - '$product.cost' => ctrans('texts.cost'), - '$product.quantity' => ctrans('texts.quantity'), - '$product.discount' => ctrans('texts.discount'), - '$product.tax_name1' => ctrans('texts.tax_name1'), - '$product.line_total' => ctrans('texts.line_total'), - ], - 'task_columns' => [ - '$task.product_key' => ctrans('texts.product_key'), - '$task.notes' => ctrans('texts.notes'), - '$task.cost' => ctrans('texts.cost'), - '$task.quantity' => ctrans('texts.quantity'), - '$task.discount' => ctrans('texts.discount'), - '$task.tax_name1' => ctrans('texts.tax_name1'), - '$task.line_total' => ctrans('texts.line_total'), - ], - ]; - - return json_decode(json_encode($variables)); - } + private static function getEntityVariableDefaults() + { + $variables = [ + 'client_details' => [ + '$client.name' => ctrans('texts.client_name'), + '$client.id_number' => ctrans('texts.id_number'), + '$client.vat_number' => ctrans('texts.vat_number'), + '$client.address1' => ctrans('texts.address1'), + '$client.address2' => ctrans('texts.address2'), + '$client.city_state_postal' => ctrans('texts.city_state_postal'), + '$client.country' => ctrans('texts.country'), + '$client.email' => ctrans('texts.email'), + ], + 'company_details' => [ + '$company.company_name' => ctrans('texts.company_name'), + '$company.id_number' => ctrans('texts.id_number'), + '$company.vat_number' => ctrans('texts.vat_number'), + '$company.website' => ctrans('texts.website'), + '$company.email' => ctrans('texts.email'), + '$company.phone' => ctrans('texts.phone'), + ], + 'company_address' => [ + '$company.address1' => ctrans('texts.address1'), + '$company.address2' => ctrans('texts.address2'), + '$company.city_state_postal' => ctrans('texts.city_state_postal'), + '$company.country' => ctrans('texts.country'), + ], + 'invoice_details' => [ + '$invoice.invoice_number' => ctrans('texts.invoice_number'), + '$invoice.po_number' => ctrans('texts.po_number'), + '$invoice.invoice_date' => ctrans('texts.invoice_date'), + '$invoice.due_date' => ctrans('texts.due_date'), + '$invoice.balance_due' => ctrans('texts.balance_due'), + '$invoice.invoice_total' => ctrans('texts.invoice_total'), + ], + 'quote_details' => [ + '$quote.quote_number' => ctrans('texts.quote_number'), + '$quote.po_number' => ctrans('texts.po_number'), + '$quote.quote_date' => ctrans('texts.quote_date'), + '$quote.valid_until' => ctrans('texts.valid_until'), + '$quote.balance_due' => ctrans('texts.balance_due'), + '$quote.quote_total' => ctrans('texts.quote_total'), + ], + 'credit_details' => [ + '$credit.credit_number' => ctrans('texts.credit_number'), + '$credit.po_number' => ctrans('texts.po_number'), + '$credit.credit_date' => ctrans('texts.credit_date'), + '$credit.credit_balance' => ctrans('texts.credit_balance'), + '$credit.credit_amount' => ctrans('texts.credit_amount'), + ], + 'product_columns' => [ + '$product.product_key' => ctrans('texts.product_key'), + '$product.notes' => ctrans('texts.notes'), + '$product.cost' => ctrans('texts.cost'), + '$product.quantity' => ctrans('texts.quantity'), + '$product.discount' => ctrans('texts.discount'), + '$product.tax_name1' => ctrans('texts.tax_name1'), + '$product.line_total' => ctrans('texts.line_total'), + ], + 'task_columns' => [ + '$task.product_key' => ctrans('texts.product_key'), + '$task.notes' => ctrans('texts.notes'), + '$task.cost' => ctrans('texts.cost'), + '$task.quantity' => ctrans('texts.quantity'), + '$task.discount' => ctrans('texts.discount'), + '$task.tax_name1' => ctrans('texts.tax_name1'), + '$task.line_total' => ctrans('texts.line_total'), + ], + ]; + + return json_decode(json_encode($variables)); + } } diff --git a/app/DataMapper/EmailTemplateDefaults.php b/app/DataMapper/EmailTemplateDefaults.php index 1e830a3382..2ad747375d 100644 --- a/app/DataMapper/EmailTemplateDefaults.php +++ b/app/DataMapper/EmailTemplateDefaults.php @@ -69,7 +69,7 @@ class EmailTemplateDefaults public static function emailReminder1Template() { - // return Parsedown::instance()->line('First Email Reminder Text'); + // return Parsedown::instance()->line('First Email Reminder Text'); } public static function emailReminder2Subject() @@ -80,7 +80,7 @@ class EmailTemplateDefaults public static function emailReminder2Template() { - // return Parsedown::instance()->line('Second Email Reminder Text'); + // return Parsedown::instance()->line('Second Email Reminder Text'); } public static function emailReminder3Subject() @@ -91,7 +91,7 @@ class EmailTemplateDefaults public static function emailReminder3Template() { - // return Parsedown::instance()->line('Third Email Reminder Text'); + // return Parsedown::instance()->line('Third Email Reminder Text'); } public static function emailReminderEndlessSubject() diff --git a/app/Designs/AbstractDesign.php b/app/Designs/AbstractDesign.php index 31f6b683cd..4bb3ff34ff 100644 --- a/app/Designs/AbstractDesign.php +++ b/app/Designs/AbstractDesign.php @@ -13,15 +13,15 @@ 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 includes(); + + abstract public function header(); + + abstract public function body(); + + abstract public function product(); - abstract public function task(); - - abstract public function footer(); -} \ No newline at end of file + abstract public function task(); + + abstract public function footer(); +} diff --git a/app/Designs/Bold.php b/app/Designs/Bold.php index 00e692d75a..774af5cbba 100644 --- a/app/Designs/Bold.php +++ b/app/Designs/Bold.php @@ -13,9 +13,9 @@ namespace App\Designs; class Bold extends AbstractDesign { - - public function __construct() { - } + public function __construct() + { + } public function includes() { @@ -33,9 +33,9 @@ class Bold extends AbstractDesign '; } - public function header() { - - return '