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 '
+ public function header() + { + return '
$company_logo @@ -50,11 +50,10 @@ class Bold extends AbstractDesign
'; + } - } - - public function body() { - + public function body() + { return '

$entity_label

$client_details @@ -86,19 +85,20 @@ class Bold extends AbstractDesign $task_table_body '; + } - } - - public function task() { + public function task() + { return ''; } - public function product() { + public function product() + { return ''; - } - - public function footer() { + } + public function footer() + { return '
$entity.public_notes @@ -127,7 +127,5 @@ class Bold extends AbstractDesign
'; - - } - + } } diff --git a/app/Designs/Business.php b/app/Designs/Business.php index 30ea62366a..c6f9cbd95e 100644 --- a/app/Designs/Business.php +++ b/app/Designs/Business.php @@ -13,7 +13,6 @@ namespace App\Designs; class Business extends AbstractDesign { - public function __construct() { } @@ -48,7 +47,6 @@ class Business extends AbstractDesign public function header() { - return '
@@ -63,12 +61,10 @@ class Business extends AbstractDesign
'; - } public function body() { - return '
$entity_label @@ -103,7 +99,6 @@ class Business extends AbstractDesign $task_table_body '; - } public function task() @@ -118,7 +113,6 @@ class Business extends AbstractDesign public function footer() { - return '
@@ -157,7 +151,5 @@ class Business extends AbstractDesign
'; - } - } diff --git a/app/Designs/Clean.php b/app/Designs/Clean.php index 585923e8e6..5bb945f2dc 100644 --- a/app/Designs/Clean.php +++ b/app/Designs/Clean.php @@ -13,9 +13,9 @@ namespace App\Designs; class Clean extends AbstractDesign { - - public function __construct() { - } + public function __construct() + { + } public function includes() @@ -39,9 +39,9 @@ class Clean extends AbstractDesign } - public function header() { - - return '
+ public function header() + { + return '
$company_logo
@@ -55,10 +55,10 @@ class Clean extends AbstractDesign
'; - } - - public function body() { + } + public function body() + { return '

$entity_label

@@ -95,8 +95,7 @@ class Clean extends AbstractDesign $task_table_body '; - - } + } public function task() { @@ -108,8 +107,8 @@ class Clean extends AbstractDesign return ''; } - public function footer() { - + public function footer() + { return '
$entity.public_notes @@ -145,7 +144,5 @@ class Clean extends AbstractDesign
'; - - } - + } } diff --git a/app/Designs/Creative.php b/app/Designs/Creative.php index 4472f7483f..2dbd0a2bcb 100644 --- a/app/Designs/Creative.php +++ b/app/Designs/Creative.php @@ -16,9 +16,9 @@ namespace App\Designs; */ class Creative extends AbstractDesign { - - public function __construct() { - } + public function __construct() + { + } public function includes() @@ -42,9 +42,9 @@ margin-top: 6mm; } - public function header() { - - return '
+ public function header() + { + return '
@@ -59,11 +59,10 @@ margin-top: 6mm;
$company_logo
'; + } - } - - public function body() { - + public function body() + { return '

$entity_label

@@ -94,9 +93,10 @@ margin-top: 6mm; $task_table_body '; - } + } - public function task() { + public function task() + { return ''; } @@ -106,8 +106,8 @@ margin-top: 6mm; return ''; } - public function footer() { - + public function footer() + { return '
@@ -146,7 +146,5 @@ margin-top: 6mm;
'; - - } - + } } diff --git a/app/Designs/Custom.php b/app/Designs/Custom.php index 97dc123d60..317021b0dd 100644 --- a/app/Designs/Custom.php +++ b/app/Designs/Custom.php @@ -13,35 +13,34 @@ namespace App\Designs; class Custom extends AbstractDesign { - public $includes; + public $includes; - public $header; + public $header; - public $body; - - public $product; - - public $task; + public $body; + + public $product; + + public $task; - public $footer; - - public $name; + public $footer; + + public $name; - public function __construct($design) - { - $this->name = $design->name; + public function __construct($design) + { + $this->name = $design->name; - $this->includes = $design->design->includes; + $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->header = $design->design->header; + + $this->body = $design->design->body; + + $this->product = $design->design->product; + + $this->task = $design->design->task; - $this->footer = $design->design->footer; - } - -} \ No newline at end of file + $this->footer = $design->design->footer; + } +} diff --git a/app/Designs/Designer.php b/app/Designs/Designer.php index 8a32158cbc..69d27c51de 100644 --- a/app/Designs/Designer.php +++ b/app/Designs/Designer.php @@ -14,394 +14,365 @@ namespace App\Designs; use App\Models\Company; use App\Models\Invoice; -class Designer { +class Designer +{ + public $design; - public $design; + protected $input_variables; - protected $input_variables; + protected $exported_variables; - protected $exported_variables; + protected $html; - protected $html; + protected $entity_string; - protected $entity_string; + protected $entity; - protected $entity; + private static $custom_fields = [ + 'invoice1', + 'invoice2', + 'invoice3', + 'invoice4', + 'surcharge1', + 'surcharge2', + 'surcharge3', + 'surcharge4', + 'client1', + 'client2', + 'client3', + 'client4', + 'contact1', + 'contact2', + 'contact3', + 'contact4', + 'company1', + 'company2', + 'company3', + 'company4', + ]; - private static $custom_fields = [ - 'invoice1', - 'invoice2', - 'invoice3', - 'invoice4', - 'surcharge1', - 'surcharge2', - 'surcharge3', - 'surcharge4', - 'client1', - 'client2', - 'client3', - 'client4', - 'contact1', - 'contact2', - 'contact3', - 'contact4', - 'company1', - 'company2', - 'company3', - 'company4', - ]; + public function __construct($entity, $design, $input_variables, $entity_string) + { + $this->entity = $entity; - public function __construct($entity, $design, $input_variables, $entity_string) - { - $this->entity = $entity; + $this->design = $design->design; - $this->design = $design->design; + $this->input_variables = json_decode(json_encode($input_variables), 1); - $this->input_variables = json_decode(json_encode($input_variables),1); + $this->entity_string = $entity_string; + } - $this->entity_string = $entity_string; + /** + * Returns the design + * formatted HTML + * @return string The HTML design built + */ + public function build():Designer + { + $this->setHtml() + ->exportVariables() + ->setDesign($this->getSection('includes')) + ->setDesign($this->getSection('header')) + ->setDesign($this->getSection('body')) + ->setDesign($this->getSection('footer')); - } + return $this; + } - /** - * Returns the design - * formatted HTML - * @return string The HTML design built - */ - public function build():Designer - { + public function init() + { + $this->setHtml() + ->exportVariables(); - $this->setHtml() - ->exportVariables() - ->setDesign($this->getSection('includes')) - ->setDesign($this->getSection('header')) - ->setDesign($this->getSection('body')) - ->setDesign($this->getSection('footer')); + return $this; + } - return $this; + public function getIncludes() + { + $this->setDesign($this->getSection('includes')); - } + return $this; + } - public function init() - { - $this->setHtml() - ->exportVariables(); + public function getHeader() + { + $this->setDesign($this->getSection('header')); - return $this; - } + return $this; + } - public function getIncludes() - { - $this->setDesign($this->getSection('includes')); + public function getFooter() + { + $this->setDesign($this->getSection('footer')); - return $this; - } + return $this; + } - public function getHeader() - { + public function getBody() + { + $this->setDesign($this->getSection('body')); + + return $this; + } - $this->setDesign($this->getSection('header')); + public function getHtml():string + { + return $this->html; + } - return $this; - } + public function setHtml() + { + $this->html = ''; - public function getFooter() - { + return $this; + } - $this->setDesign($this->getSection('footer')); + private function setDesign($section) + { + $this->html .= $section; - return $this; - } + return $this; + } - public function getBody() - { + /** + * Returns the template section on with the + * stacked variables replaced with single variables. + * + * @param string $section the method name to be executed ie header/body/table/footer + * @return string The HTML of the template section + */ + public function getSection($section):string + { + return str_replace(array_keys($this->exported_variables), array_values($this->exported_variables), $this->design->{$section}); + } - $this->setDesign($this->getSection('body')); - - return $this; - } + private function exportVariables() + { + $company = $this->entity->company; + + $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)); - public function getHtml():string - { - return $this->html; - } - - public function setHtml() - { - $this->html = ''; - - return $this; - } - - private function setDesign($section) - { - - $this->html .= $section; - - return $this; - } - - /** - * Returns the template section on with the - * stacked variables replaced with single variables. - * - * @param string $section the method name to be executed ie header/body/table/footer - * @return string The HTML of the template section - */ - public function getSection($section):string - { - return str_replace(array_keys($this->exported_variables), array_values($this->exported_variables), $this->design->{$section}); - } - - private function exportVariables() - { - - $company = $this->entity->company; - - $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)); - $this->exported_variables['$entity_details'] = $this->processVariables($this->input_variables['invoice_details'], $this->invoiceDetails($company)); - } - elseif($this->entity_string == 'credit') - { - $this->exported_variables['$entity_labels'] = $this->processLabels($this->input_variables['credit_details'], $this->creditDetails($company)); - $this->exported_variables['$entity_details'] = $this->processVariables($this->input_variables['credit_details'], $this->creditDetails($company)); - } - elseif($this->entity_string == 'quote') - { - $this->exported_variables['$entity_labels'] = $this->processLabels($this->input_variables['quote_details'], $this->quoteDetails($company)); - $this->exported_variables['$entity_details'] = $this->processVariables($this->input_variables['quote_details'], $this->quoteDetails($company)); - } + if ($this->entity_string == 'invoice') { + $this->exported_variables['$entity_labels'] = $this->processLabels($this->input_variables['invoice_details'], $this->invoiceDetails($company)); + $this->exported_variables['$entity_details'] = $this->processVariables($this->input_variables['invoice_details'], $this->invoiceDetails($company)); + } elseif ($this->entity_string == 'credit') { + $this->exported_variables['$entity_labels'] = $this->processLabels($this->input_variables['credit_details'], $this->creditDetails($company)); + $this->exported_variables['$entity_details'] = $this->processVariables($this->input_variables['credit_details'], $this->creditDetails($company)); + } elseif ($this->entity_string == 'quote') { + $this->exported_variables['$entity_labels'] = $this->processLabels($this->input_variables['quote_details'], $this->quoteDetails($company)); + $this->exported_variables['$entity_details'] = $this->processVariables($this->input_variables['quote_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'); - if(strlen($this->exported_variables['$task_table_body']) == 0) - $this->exported_variables['$task_table_header'] = ''; + if (strlen($this->exported_variables['$task_table_body']) == 0) { + $this->exported_variables['$task_table_header'] = ''; + } - if(strlen($this->exported_variables['$product_table_body']) == 0) - $this->exported_variables['$product_table_header'] = ''; + if (strlen($this->exported_variables['$product_table_body']) == 0) { + $this->exported_variables['$product_table_header'] = ''; + } - return $this; - } + return $this; + } - private function processVariables($input_variables, $variables):string - { - $output = ''; + private function processVariables($input_variables, $variables):string + { + $output = ''; - foreach (array_keys($input_variables) as $value) - $output .= $variables[$value]; + foreach (array_keys($input_variables) as $value) { + $output .= $variables[$value]; + } - return $output; + return $output; + } - } + private function processLabels($input_variables, $variables):string + { + $output = ''; - private function processLabels($input_variables, $variables):string - { + foreach (array_keys($input_variables) as $value) { + $tmp = str_replace("", "_label", $variables[$value]); + //$output .= $variables[$value]; + $output .= $tmp; + } - $output = ''; + return $output; + } - foreach (array_keys($input_variables) as $value) { + private function clientDetails(Company $company) + { + $data = [ + '$client.name' => '

$client.name

', + '$client.id_number' => '

$client.id_number

', + '$client.vat_number' => '

$client.vat_number

', + '$client.address1' => '

$client.address1

', + '$client.address2' => '

$client.address2

', + '$client.city_state_postal' => '

$client.city_state_postal

', + '$client.postal_city_state' => '

$client.postal_city_state

', + '$client.country' => '

$client.country

', + '$client.email' => '

$client.email

', + '$client.client1' => '

$client1

', + '$client.client2' => '

$client2

', + '$client.client3' => '

$client3

', + '$client.client4' => '

$client4

', + '$client.contact1' => '

$contact1

', + '$client.contact2' => '

$contact2

', + '$client.contact3' => '

$contact3

', + '$client.contact4' => '

$contact4

', + ]; - $tmp = str_replace("", "_label", $variables[$value]); - //$output .= $variables[$value]; - $output .= $tmp; - } + return $this->processCustomFields($company, $data); + } - return $output; - } + private function companyDetails(Company $company) + { + $data = [ + '$company.company_name' => '$company.company_name', + '$company.id_number' => '$company.id_number', + '$company.vat_number' => '$company.vat_number', + '$company.website' => '$company.website', + '$company.email' => '$company.email', + '$company.phone' => '$company.phone', + '$company.company1' => '$company1', + '$company.company2' => '$company2', + '$company.company3' => '$company3', + '$company.company4' => '$company4', + ]; - private function clientDetails(Company $company) - { + return $this->processCustomFields($company, $data); + } - $data = [ - '$client.name' => '

$client.name

', - '$client.id_number' => '

$client.id_number

', - '$client.vat_number' => '

$client.vat_number

', - '$client.address1' => '

$client.address1

', - '$client.address2' => '

$client.address2

', - '$client.city_state_postal' => '

$client.city_state_postal

', - '$client.postal_city_state' => '

$client.postal_city_state

', - '$client.country' => '

$client.country

', - '$client.email' => '

$client.email

', - '$client.client1' => '

$client1

', - '$client.client2' => '

$client2

', - '$client.client3' => '

$client3

', - '$client.client4' => '

$client4

', - '$client.contact1' => '

$contact1

', - '$client.contact2' => '

$contact2

', - '$client.contact3' => '

$contact3

', - '$client.contact4' => '

$contact4

', - ]; + private function companyAddress(Company $company) + { + $data = [ + '$company.address1' => '$company.address1', + '$company.address2' => '$company.address2', + '$company.city_state_postal' => '$company.city_state_postal', + '$company.postal_city_state' => '$company.postal_city_state', + '$company.country' => '$company.country', + '$company.company1' => '$company1', + '$company.company2' => '$company2', + '$company.company3' => '$company3', + '$company.company4' => '$company4', + ]; - return $this->processCustomFields($company, $data); - } + return $this->processCustomFields($company, $data); + } - private function companyDetails(Company $company) - { + private function invoiceDetails(Company $company) + { + $data = [ + '$invoice.invoice_number' => '$invoice_number_label$invoice_number', + '$invoice.po_number' => '$po_number_label$po_number', + '$invoice.invoice_date' => '$invoice_date_label$invoice_date', + '$invoice.due_date' => '$due_date_label$due_date', + '$invoice.balance_due' => '$balance_due_label$balance_due', + '$invoice.invoice_total' => '$invoice_total_label$invoice_total', + '$invoice.partial_due' => '$partial_due_label$partial_due', + '$invoice.invoice1' => '$invoice1_label$invoice1', + '$invoice.invoice2' => '$invoice2_label$invoice2', + '$invoice.invoice3' => '$invoice3_label$invoice3', + '$invoice.invoice4' => '$invoice4_label$invoice4', + '$invoice.surcharge1' => '$surcharge1_label$surcharge1', + '$invoice.surcharge2' => '$surcharge2_label$surcharge2', + '$invoice.surcharge3' => '$surcharge3_label$surcharge3', + '$invoice.surcharge4' => '$surcharge4_label$surcharge4', + ]; - $data = [ - '$company.company_name' => '$company.company_name', - '$company.id_number' => '$company.id_number', - '$company.vat_number' => '$company.vat_number', - '$company.website' => '$company.website', - '$company.email' => '$company.email', - '$company.phone' => '$company.phone', - '$company.company1' => '$company1', - '$company.company2' => '$company2', - '$company.company3' => '$company3', - '$company.company4' => '$company4', - ]; + return $this->processCustomFields($company, $data); + } - return $this->processCustomFields($company, $data); + private function quoteDetails(Company $company) + { + $data = [ + '$quote.quote_number' => '$quote_number', + '$quote.po_number' => '$po_number', + '$quote.quote_date' => '$date', + '$quote.valid_until' => '$valid_until', + '$quote.balance_due' => '$balance_due', + '$quote.quote_total' => '$quote_total', + '$quote.partial_due' => '$partial_due', + '$quote.quote1' => '$quote1', + '$quote.quote2' => '$quote2', + '$quote.quote3' => '$quote3', + '$quote.quote4' => '$quote4', + '$quote.surcharge1' => '$surcharge1', + '$quote.surcharge2' => '$surcharge2', + '$quote.surcharge3' => '$surcharge3', + '$quote.surcharge4' => '$surcharge4', + ]; - } + return $this->processCustomFields($company, $data); + } - private function companyAddress(Company $company) - { + private function creditDetails(Company $company) + { + $data = [ + '$credit.credit_number' => '$credit_number', + '$credit.po_number' => '$po_number', + '$credit.credit_date' => '$date', + '$credit.credit_balance' => '$credit_balance', + '$credit.credit_amount' => '$credit_amount', + '$credit.partial_due' => '$partial_due', + '$credit.invoice1' => '$invoice1', + '$credit.invoice2' => '$invoice2', + '$credit.invoice3' => '$invoice3', + '$credit.invoice4' => '$invoice4', + '$credit.surcharge1' => '$surcharge1', + '$credit.surcharge2' => '$surcharge2', + '$credit.surcharge3' => '$surcharge3', + '$credit.surcharge4' => '$surcharge4', + ]; - $data = [ - '$company.address1' => '$company.address1', - '$company.address2' => '$company.address2', - '$company.city_state_postal' => '$company.city_state_postal', - '$company.postal_city_state' => '$company.postal_city_state', - '$company.country' => '$company.country', - '$company.company1' => '$company1', - '$company.company2' => '$company2', - '$company.company3' => '$company3', - '$company.company4' => '$company4', - ]; + return $this->processCustomFields($company, $data); + } - return $this->processCustomFields($company, $data); + private function processCustomFields(Company $company, $data) + { + $custom_fields = $company->custom_fields; - } + if (!$custom_fields) { + return $data; + } - private function invoiceDetails(Company $company) - { + foreach (self::$custom_fields as $cf) { + if (!property_exists($custom_fields, $cf) || (strlen($custom_fields->{$cf}) == 0)) { + unset($data[$cf]); + } + } - $data = [ - '$invoice.invoice_number' => '$invoice_number_label$invoice_number', - '$invoice.po_number' => '$po_number_label$po_number', - '$invoice.invoice_date' => '$invoice_date_label$invoice_date', - '$invoice.due_date' => '$due_date_label$due_date', - '$invoice.balance_due' => '$balance_due_label$balance_due', - '$invoice.invoice_total' => '$invoice_total_label$invoice_total', - '$invoice.partial_due' => '$partial_due_label$partial_due', - '$invoice.invoice1' => '$invoice1_label$invoice1', - '$invoice.invoice2' => '$invoice2_label$invoice2', - '$invoice.invoice3' => '$invoice3_label$invoice3', - '$invoice.invoice4' => '$invoice4_label$invoice4', - '$invoice.surcharge1' => '$surcharge1_label$surcharge1', - '$invoice.surcharge2' => '$surcharge2_label$surcharge2', - '$invoice.surcharge3' => '$surcharge3_label$surcharge3', - '$invoice.surcharge4' => '$surcharge4_label$surcharge4', - ]; + return $data; + } - return $this->processCustomFields($company, $data); + // private function processInputVariables($company, $variables) + // { + // if(is_object($variables)) + // $variables = json_decode(json_encode($variables),true); - } + // $custom_fields = $company->custom_fields; - private function quoteDetails(Company $company) - { - - $data = [ - '$quote.quote_number' => '$quote_number', - '$quote.po_number' => '$po_number', - '$quote.quote_date' => '$date', - '$quote.valid_until' => '$valid_until', - '$quote.balance_due' => '$balance_due', - '$quote.quote_total' => '$quote_total', - '$quote.partial_due' => '$partial_due', - '$quote.quote1' => '$quote1', - '$quote.quote2' => '$quote2', - '$quote.quote3' => '$quote3', - '$quote.quote4' => '$quote4', - '$quote.surcharge1' => '$surcharge1', - '$quote.surcharge2' => '$surcharge2', - '$quote.surcharge3' => '$surcharge3', - '$quote.surcharge4' => '$surcharge4', - ]; + // $matches = array_intersect(self::$custom_fields, $variables); - return $this->processCustomFields($company, $data); + // foreach ($matches as $match) { - } + // if (!property_exists($custom_fields, $match) || (strlen($custom_fields->{$match}) == 0)) { + // foreach ($variables as $key => $value) { + // if ($value == $match) { + // unset($variables[$key]); + // } + // } + // } - private function creditDetails(Company $company) - { + // } - $data = [ - '$credit.credit_number' => '$credit_number', - '$credit.po_number' => '$po_number', - '$credit.credit_date' => '$date', - '$credit.credit_balance' => '$credit_balance', - '$credit.credit_amount' => '$credit_amount', - '$credit.partial_due' => '$partial_due', - '$credit.invoice1' => '$invoice1', - '$credit.invoice2' => '$invoice2', - '$credit.invoice3' => '$invoice3', - '$credit.invoice4' => '$invoice4', - '$credit.surcharge1' => '$surcharge1', - '$credit.surcharge2' => '$surcharge2', - '$credit.surcharge3' => '$surcharge3', - '$credit.surcharge4' => '$surcharge4', - ]; + // return $variables; - return $this->processCustomFields($company, $data); - - } - - private function processCustomFields(Company $company, $data) - { - - $custom_fields = $company->custom_fields; - - if (!$custom_fields) { - return $data; - } - - foreach (self::$custom_fields as $cf) { - - if (!property_exists($custom_fields, $cf) || (strlen($custom_fields->{$cf}) == 0)) { - unset($data[$cf]); - - } - } - - return $data; - - } - - // private function processInputVariables($company, $variables) - // { - // if(is_object($variables)) - // $variables = json_decode(json_encode($variables),true); - - // $custom_fields = $company->custom_fields; - - // $matches = array_intersect(self::$custom_fields, $variables); - - // foreach ($matches as $match) { - - // if (!property_exists($custom_fields, $match) || (strlen($custom_fields->{$match}) == 0)) { - // foreach ($variables as $key => $value) { - // if ($value == $match) { - // unset($variables[$key]); - // } - // } - // } - - // } - - // return $variables; - - // } - -} \ No newline at end of file + // } +} diff --git a/app/Designs/Elegant.php b/app/Designs/Elegant.php index c27acfd389..41b5026032 100644 --- a/app/Designs/Elegant.php +++ b/app/Designs/Elegant.php @@ -13,9 +13,9 @@ namespace App\Designs; class Elegant extends AbstractDesign { - - public function __construct() { - } + public function __construct() + { + } public function includes() @@ -39,9 +39,9 @@ class Elegant extends AbstractDesign } - public function header() { - - return '
+ public function header() + { + return '
$company_logo @@ -56,11 +56,10 @@ class Elegant extends AbstractDesign
'; + } - } - - public function body() { - + public function body() + { return '
$client_details @@ -88,11 +87,11 @@ class Elegant extends AbstractDesign $product_table_body '; + } - } - - public function task() { - return ''; + public function task() + { + return ''; } public function product() @@ -100,8 +99,8 @@ class Elegant extends AbstractDesign return ''; } - public function footer() { - + public function footer() + { return '
@@ -142,7 +141,5 @@ class Elegant extends AbstractDesign
'; - - } - + } } diff --git a/app/Designs/Hipster.php b/app/Designs/Hipster.php index 174d753bb7..3e6397b460 100644 --- a/app/Designs/Hipster.php +++ b/app/Designs/Hipster.php @@ -13,9 +13,9 @@ namespace App\Designs; class Hipster extends AbstractDesign { - - public function __construct() { - } + public function __construct() + { + } public function includes() @@ -40,9 +40,9 @@ body {font-size:90%} } - public function header() { - - return '
+ public function header() + { + return '

From:

@@ -63,11 +63,10 @@ body {font-size:90%} $company_logo
'; + } - } - - public function body() { - + public function body() + { return '

$entity_label

@@ -102,20 +101,20 @@ body {font-size:90%} $task_table_body '; + } - } - - public function task() { - return ''; + public function task() + { + return ''; } public function product() { - return ''; + return ''; } - public function footer() { - + public function footer() + { return '
@@ -148,7 +147,5 @@ body {font-size:90%}
'; - - } - + } } diff --git a/app/Designs/Modern.php b/app/Designs/Modern.php index cc31780934..a2b333b876 100644 --- a/app/Designs/Modern.php +++ b/app/Designs/Modern.php @@ -13,9 +13,9 @@ namespace App\Designs; class Modern extends AbstractDesign { - - public function __construct() { - } + public function __construct() + { + } public function includes() @@ -61,9 +61,9 @@ class Modern extends AbstractDesign } - public function header() { - - return '
+ public function header() + { + return '

$company.name

@@ -76,12 +76,11 @@ class Modern extends AbstractDesign
'; + } - } - - public function body() { - - return '
+ public function body() + { + return '
$company_logo @@ -112,11 +111,11 @@ class Modern extends AbstractDesign $task_table_body '; + } - } - - public function task() { - return ''; + public function task() + { + return ''; } public function product() @@ -124,9 +123,9 @@ class Modern extends AbstractDesign return ''; } - public function footer() { - - return ' + public function footer() + { + return '
$entity.public_notes @@ -181,7 +180,5 @@ class Modern extends AbstractDesign '; - - } - + } } diff --git a/app/Designs/Photo.php b/app/Designs/Photo.php index 87b6b42dc0..4a0ae7baff 100644 --- a/app/Designs/Photo.php +++ b/app/Designs/Photo.php @@ -13,9 +13,9 @@ namespace App\Designs; class Photo extends AbstractDesign { - - public function __construct() { - } + public function __construct() + { + } public function includes() @@ -44,9 +44,9 @@ body {font-size:90%} - public function header() { - - return '
+ public function header() + { + return '
$company_logo @@ -61,11 +61,10 @@ body {font-size:90%}
'; + } - } - - public function body() { - + public function body() + { return '
@@ -99,10 +98,10 @@ body {font-size:90%} $task_table_body '; + } - } - - public function task() { + public function task() + { return ''; } @@ -111,8 +110,8 @@ body {font-size:90%} return ''; } - public function footer() { - + public function footer() + { return '
@@ -153,7 +152,5 @@ body {font-size:90%}
'; - - } - + } } diff --git a/app/Designs/Plain.php b/app/Designs/Plain.php index cedee09a17..fd46495e87 100644 --- a/app/Designs/Plain.php +++ b/app/Designs/Plain.php @@ -13,9 +13,9 @@ namespace App\Designs; class Plain extends AbstractDesign { - - public function __construct() { - } + public function __construct() + { + } public function includes() @@ -38,9 +38,9 @@ body {font-size:90%} } - public function header() { - - return '
+ public function header() + { + return '
$company_logo
@@ -58,11 +58,10 @@ body {font-size:90%}
'; + } - } - - public function body() { - + public function body() + { return '
$client_details
@@ -81,22 +80,8 @@ body {font-size:90%} $task_table_body -'; - - } - - public function task() { - return ''; - } - - public function product() - { - return ''; - } - - public function footer() { - - return '
+ +

$entity.public_notes

@@ -124,11 +109,21 @@ body {font-size:90%}

$balance_due

+
'; + } -
- -'; + public function task() + { + return ''; + } - } + public function product() + { + return ''; + } + public function footer() + { + return ''; + } } diff --git a/app/Designs/Playful.php b/app/Designs/Playful.php index 39c41fa392..27032f2f1a 100644 --- a/app/Designs/Playful.php +++ b/app/Designs/Playful.php @@ -13,9 +13,9 @@ namespace App\Designs; class Playful extends AbstractDesign { - - public function __construct() { - } + public function __construct() + { + } public function includes() @@ -39,9 +39,9 @@ body {font-size:90%} } - public function header() { - - return '
+ public function header() + { + return '
$company_logo @@ -57,11 +57,10 @@ body {font-size:90%}
'; + } - } - - public function body() { - + public function body() + { return '
@@ -99,22 +98,8 @@ body {font-size:90%} $task_table_body -'; - - } - - public function task() { - return ''; - } - - public function product() - { - return ''; - } - - public function footer() { - - return '
+ +

$entity.public_notes

@@ -134,7 +119,6 @@ body {font-size:90%}
-
@@ -147,14 +131,21 @@ body {font-size:90%}

$balance_due_label

$balance_due

-
-
-
+
'; + } -
- -'; + public function task() + { + return ''; + } - } + public function product() + { + return ''; + } + public function footer() + { + return ''; + } } diff --git a/app/Factory/CloneQuoteToInvoiceFactory.php b/app/Factory/CloneQuoteToInvoiceFactory.php index e06b92ee92..fa14c448d9 100644 --- a/app/Factory/CloneQuoteToInvoiceFactory.php +++ b/app/Factory/CloneQuoteToInvoiceFactory.php @@ -7,13 +7,13 @@ use App\Models\Quote; class CloneQuoteToInvoiceFactory { public static function create(Quote $quote, $user_id) : ?Invoice - { - $invoice = new Invoice(); - $invoice->user_id = $user_id; - $invoice->po_number = $quote->po_number; - $invoice->footer = $quote->footer; - $invoice->line_items = $quote->line_items; - - return $invoice; - } + { + $invoice = new Invoice(); + $invoice->user_id = $user_id; + $invoice->po_number = $quote->po_number; + $invoice->footer = $quote->footer; + $invoice->line_items = $quote->line_items; + + return $invoice; + } } diff --git a/app/Filters/CreditFilters.php b/app/Filters/CreditFilters.php index 1c5a69db00..caf946a069 100644 --- a/app/Filters/CreditFilters.php +++ b/app/Filters/CreditFilters.php @@ -57,7 +57,7 @@ class CreditFilters extends QueryFilters $this->builder->where('status_id', Credit::STAUTS_PARTIAL); } - if(in_array('applied', $status_parameters)) { + if (in_array('applied', $status_parameters)) { $this->builder->where('status_id', Credit::STATUS_APPLIED); } diff --git a/app/Filters/DesignFilters.php b/app/Filters/DesignFilters.php index e3e83f3adc..01f90182dc 100644 --- a/app/Filters/DesignFilters.php +++ b/app/Filters/DesignFilters.php @@ -138,6 +138,6 @@ class DesignFilters extends QueryFilters public function entityFilter() { //return $this->builder->whereCompanyId(auth()->user()->company()->id); - return $this->builder->whereCompanyId(auth()->user()->company()->id)->orWhere('company_id',null); + return $this->builder->whereCompanyId(auth()->user()->company()->id)->orWhere('company_id', null); } } diff --git a/app/Helpers/Email/InvoiceEmail.php b/app/Helpers/Email/InvoiceEmail.php index 21f5c2434f..dbef09ff99 100644 --- a/app/Helpers/Email/InvoiceEmail.php +++ b/app/Helpers/Email/InvoiceEmail.php @@ -8,55 +8,62 @@ namespace App\Helpers\Email; - use App\Models\Invoice; use App\Models\InvoiceInvitation; use App\Utils\Number; class InvoiceEmail extends EmailBuilder { - public function build(InvoiceInvitation $invitation, $reminder_template) { $client = $invitation->contact->client; $invoice = $invitation->invoice; $contact = $invitation->contact; - if(!$reminder_template) + if (!$reminder_template) { $reminder_template = $invoice->calculateTemplate(); + } $body_template = $client->getSetting('email_template_' . $reminder_template); /* Use default translations if a custom message has not been set*/ if (iconv_strlen($body_template) == 0) { - $body_template = trans('texts.invoice_message', + $body_template = trans( + 'texts.invoice_message', [ - 'invoice' => $invoice->number, + 'invoice' => $invoice->number, 'company' => $invoice->company->present()->name(), 'amount' => Number::formatMoney($invoice->balance, $invoice->client), - ], + ], null, - $invoice->client->locale()); + $invoice->client->locale() + ); } $subject_template = $client->getSetting('email_subject_' . $reminder_template); if (iconv_strlen($subject_template) == 0) { if ($reminder_template == 'quote') { - $subject_template = trans('texts.invoice_subject', + $subject_template = trans( + 'texts.invoice_subject', [ 'invoice' => $invoice->present()->invoice_number(), 'account' => $invoice->company->present()->name() ], - null, $invoice->client->locale()); + null, + $invoice->client->locale() + ); } else { - $subject_template = trans('texts.reminder_subject', + $subject_template = trans( + 'texts.reminder_subject', [ 'invoice' => $invoice->present()->invoice_number(), 'account' => $invoice->company->present()->name() ], - null, $invoice->client->locale()); + null, + $invoice->client->locale() + ); } } diff --git a/app/Helpers/Email/PaymentEmail.php b/app/Helpers/Email/PaymentEmail.php index 5535a9811e..63b83bedfa 100644 --- a/app/Helpers/Email/PaymentEmail.php +++ b/app/Helpers/Email/PaymentEmail.php @@ -10,28 +10,33 @@ namespace App\Helpers\Email; use App\Models\Payment; - class EmailPayment extends EmailBuilder { - public function build(Payment $payment, $contact = null) { + public function build(Payment $payment, $contact = null) + { $client = $payment->client; $body_template = $client->getSetting('email_template_payment'); /* Use default translations if a custom message has not been set*/ if (iconv_strlen($body_template) == 0) { - - $body_template = trans('texts.payment_message', - ['amount' => $payment->amount, 'company' => $payment->company->present()->name()], null, - $this->client->locale()); + $body_template = trans( + 'texts.payment_message', + ['amount' => $payment->amount, 'company' => $payment->company->present()->name()], + null, + $this->client->locale() + ); } $subject_template = $client->getSetting('email_subject_payment'); if (iconv_strlen($subject_template) == 0) { - $subject_template = trans('texts.payment_subject', - ['number' => $payment->number, 'company' => $payment->company->present()->name()], null, - $payment->client->locale()); + $subject_template = trans( + 'texts.payment_subject', + ['number' => $payment->number, 'company' => $payment->company->present()->name()], + null, + $payment->client->locale() + ); } $this->setTemplate($payment->client->getSetting('email_style')) diff --git a/app/Helpers/Email/QuoteEmail.php b/app/Helpers/Email/QuoteEmail.php index 17063e3abb..fc3302228e 100644 --- a/app/Helpers/Email/QuoteEmail.php +++ b/app/Helpers/Email/QuoteEmail.php @@ -11,10 +11,8 @@ namespace App\Helpers\Email; use App\Models\Quote; use App\Models\QuoteInvitation; - class QuoteEmail extends EmailBuilder { - public function build(QuoteInvitation $invitation, $reminder_template) { $client = $invitation->contact->client; @@ -27,22 +25,31 @@ class QuoteEmail extends EmailBuilder /* Use default translations if a custom message has not been set*/ if (iconv_strlen($body_template) == 0) { - $body_template = trans('texts.quote_message', - ['amount' => $quote->amount, 'company' => $quote->company->present()->name()], null, - $quote->client->locale()); + $body_template = trans( + 'texts.quote_message', + ['amount' => $quote->amount, 'company' => $quote->company->present()->name()], + null, + $quote->client->locale() + ); } $subject_template = $client->getSetting('email_subject_' . $reminder_template); if (iconv_strlen($subject_template) == 0) { if ($reminder_template == 'quote') { - $subject_template = trans('texts.quote_subject', + $subject_template = trans( + 'texts.quote_subject', ['number' => $quote->number, 'company' => $quote->company->present()->name()], - null, $quote->client->locale()); + null, + $quote->client->locale() + ); } else { - $subject_template = trans('texts.reminder_subject', + $subject_template = trans( + 'texts.reminder_subject', ['number' => $quote->number, 'company' => $quote->company->present()->name()], - null, $quote->client->locale()); + null, + $quote->client->locale() + ); } } diff --git a/app/Helpers/GenerateUrl.php b/app/Helpers/GenerateUrl.php index 82c05b0a09..a88c855b7d 100644 --- a/app/Helpers/GenerateUrl.php +++ b/app/Helpers/GenerateUrl.php @@ -1,8 +1,4 @@ disk)->url($document->path); - if($url && $absolute) return url($url); + if ($url && $absolute) { + return url($url); + } - if ($url) return $url; + if ($url) { + return $url; + } return null; -} \ No newline at end of file +} diff --git a/app/Helpers/Invoice/InvoiceSum.php b/app/Helpers/Invoice/InvoiceSum.php index 57c638470d..5c38091830 100644 --- a/app/Helpers/Invoice/InvoiceSum.php +++ b/app/Helpers/Invoice/InvoiceSum.php @@ -173,22 +173,18 @@ class InvoiceSum public function getQuote() { - $this->setCalculatedAttributes(); $this->invoice->save(); return $this->invoice; - } public function getCredit() { - $this->setCalculatedAttributes(); $this->invoice->save(); return $this->invoice; - } /** diff --git a/app/Http/Controllers/AccountController.php b/app/Http/Controllers/AccountController.php index d17c04c748..5c13f74a0a 100644 --- a/app/Http/Controllers/AccountController.php +++ b/app/Http/Controllers/AccountController.php @@ -147,8 +147,9 @@ class AccountController extends BaseController { $account = CreateAccount::dispatchNow($request->all()); - if(!($account instanceof Account)) + if (!($account instanceof Account)) { return $account; + } $ct = CompanyUser::whereUserId(auth()->user()->id); diff --git a/app/Http/Controllers/Auth/LoginController.php b/app/Http/Controllers/Auth/LoginController.php index a05f959d70..46d92e6f95 100644 --- a/app/Http/Controllers/Auth/LoginController.php +++ b/app/Http/Controllers/Auth/LoginController.php @@ -175,9 +175,7 @@ class LoginController extends BaseController $ct = CompanyUser::whereUserId($user->id)->with('company'); return $this->listResponse($ct); - } else { - $this->incrementLoginAttempts($request); return response() diff --git a/app/Http/Controllers/Auth/ResetPasswordController.php b/app/Http/Controllers/Auth/ResetPasswordController.php index 04041c28a0..e102c64ec0 100644 --- a/app/Http/Controllers/Auth/ResetPasswordController.php +++ b/app/Http/Controllers/Auth/ResetPasswordController.php @@ -67,9 +67,10 @@ class ResetPasswordController extends Controller // will update the password on an actual user model and persist it to the // database. Otherwise we will parse the error and return the response. $response = $this->broker()->reset( - $this->credentials($request), function ($user, $password) { - $this->resetPassword($user, $password); - } + $this->credentials($request), + function ($user, $password) { + $this->resetPassword($user, $password); + } ); // Added this because it collides the session between diff --git a/app/Http/Controllers/BaseController.php b/app/Http/Controllers/BaseController.php index 4f04a25eb9..18f4cf3ee4 100644 --- a/app/Http/Controllers/BaseController.php +++ b/app/Http/Controllers/BaseController.php @@ -32,7 +32,7 @@ use League\Fractal\Serializer\JsonApiSerializer; */ class BaseController extends Controller { - use AppSetup; + use AppSetup; /** * Passed from the parent when we need to force * includes internally rather than externally via @@ -58,35 +58,25 @@ class BaseController extends Controller public function __construct() { - $this->manager = new Manager(); $this->forced_includes = []; $this->forced_index = 'data'; - } private function buildManager() { - $include = ''; - if(request()->has('first_load') && request()->input('first_load') == 'true') { - - $include = implode("," , array_merge($this->forced_includes, $this->getRequestIncludes([]))); - - } - else if (request()->input('include') !== null) { - + if (request()->has('first_load') && request()->input('first_load') == 'true') { + $include = implode(",", array_merge($this->forced_includes, $this->getRequestIncludes([]))); + } elseif (request()->input('include') !== null) { $include = array_merge($this->forced_includes, explode(",", request()->input('include'))); $include = implode(",", $include); - } elseif (count($this->forced_includes) >= 1) { - $include = implode(",", $this->forced_includes); - } $this->manager->parseIncludes($include); @@ -94,15 +84,10 @@ class BaseController extends Controller $this->serializer = request()->input('serializer') ?: EntityTransformer::API_SERIALIZER_ARRAY; if ($this->serializer === EntityTransformer::API_SERIALIZER_JSON) { - $this->manager->setSerializer(new JsonApiSerializer()); - } else { - $this->manager->setSerializer(new ArraySerializer()); - } - } /** @@ -111,23 +96,18 @@ class BaseController extends Controller */ public function notFound() { - return response()->json(['message' => '404 | Nothing to see here!'], 404) ->header('X-API-VERSION', config('ninja.api_version')) ->header('X-APP-VERSION', config('ninja.app_version')); - } public function notFoundClient() { - return abort(404); - } protected function errorResponse($response, $httpErrorCode = 400) { - $error['error'] = $response; $error = json_encode($error, JSON_PRETTY_PRINT); @@ -135,12 +115,10 @@ class BaseController extends Controller $headers = self::getApiHeaders(); return response()->make($error, $httpErrorCode, $headers); - } protected function listResponse($query) { - $this->buildManager(); $transformer = new $this->entity_transformer(Input::get('serializer')); @@ -152,7 +130,7 @@ class BaseController extends Controller $query->with($includes); if (auth()->user()->cannot('view_'.$this->entity_type)) { - if ($this->entity_type == Company::class || $this->entity_type == Design::class ) { + if ($this->entity_type == Company::class || $this->entity_type == Design::class) { //no user keys exist on the company table, so we need to skip } elseif ($this->entity_type == User::class) { //$query->where('id', '=', auth()->user()->id); @todo why? @@ -162,47 +140,40 @@ class BaseController extends Controller } if (request()->has('updated_at') && request()->input('updated_at') > 0) { - $updated_at = intval(request()->input('updated_at')); - $query->where('updated_at', '>=', date('Y-m-d H:i:s', $updated_at)); + $updated_at = intval(request()->input('updated_at')); + $query->where('updated_at', '>=', date('Y-m-d H:i:s', $updated_at)); } $data = $this->createCollection($query, $transformer, $this->entity_type); return $this->response($data); - } protected function createCollection($query, $transformer, $entity_type) { - $this->buildManager(); - if ($this->serializer && $this->serializer != EntityTransformer::API_SERIALIZER_JSON) + if ($this->serializer && $this->serializer != EntityTransformer::API_SERIALIZER_JSON) { $entity_type = null; + } if (is_a($query, "Illuminate\Database\Eloquent\Builder")) { - $limit = Input::get('per_page', 20); $paginator = $query->paginate($limit); $query = $paginator->getCollection(); $resource = new Collection($query, $transformer, $entity_type); $resource->setPaginator(new IlluminatePaginatorAdapter($paginator)); - } else { - $resource = new Collection($query, $transformer, $entity_type); - } return $this->manager->createData($resource)->toArray(); - } protected function response($response) { - $index = request()->input('index') ?: $this->forced_index; if ($index == 'none') { @@ -230,52 +201,46 @@ class BaseController extends Controller $headers = self::getApiHeaders(); return response()->make($response, 200, $headers); - } protected function itemResponse($item) { - $this->buildManager(); $transformer = new $this->entity_transformer(Input::get('serializer')); $data = $this->createItem($item, $transformer, $this->entity_type); - if (request()->include_static) + if (request()->include_static) { $data['static'] = Statics::company(auth()->user()->getCompany()->getLocale()); + } return $this->response($data); - } protected function createItem($data, $transformer, $entity_type) { - - if ($this->serializer && $this->serializer != EntityTransformer::API_SERIALIZER_JSON) + if ($this->serializer && $this->serializer != EntityTransformer::API_SERIALIZER_JSON) { $entity_type = null; + } $resource = new Item($data, $transformer, $entity_type); return $this->manager->createData($resource)->toArray(); - } public static function getApiHeaders($count = 0) { - return [ 'Content-Type' => 'application/json', 'X-Api-Version' => config('ninja.api_version'), 'X-App-Version' => config('ninja.app_version'), ]; - } protected function getRequestIncludes($data) { - $first_load = [ 'account', 'user.company_user', @@ -311,49 +276,33 @@ class BaseController extends Controller /** * Thresholds for displaying large account on first load */ - if (request()->has('first_load') && request()->input('first_load') == 'true') - { - - if (auth()->user()->getCompany()->invoices->count() > 1000) - { - - $data = $mini_load; - - } - else - { - - $data = $first_load; - - } - } - else - { - - $included = request()->input('include'); - $included = explode(',', $included); - - foreach ($included as $include) { - if ($include == 'clients') { - $data[] = 'clients.contacts'; - } elseif ($include) { - $data[] = $include; - } - } + if (request()->has('first_load') && request()->input('first_load') == 'true') { + if (auth()->user()->getCompany()->invoices->count() > 1000) { + $data = $mini_load; + } else { + $data = $first_load; + } + } else { + $included = request()->input('include'); + $included = explode(',', $included); + foreach ($included as $include) { + if ($include == 'clients') { + $data[] = 'clients.contacts'; + } elseif ($include) { + $data[] = $include; + } + } } return $data; - } public function flutterRoute() { - - if(!$this->checkAppSetup()); + if (!$this->checkAppSetup()); return redirect('/setup'); - return view('index.index'); - + return view('index.index'); } } diff --git a/app/Http/Controllers/ClientController.php b/app/Http/Controllers/ClientController.php index cb61ddb3d6..d9f8c43b04 100644 --- a/app/Http/Controllers/ClientController.php +++ b/app/Http/Controllers/ClientController.php @@ -279,8 +279,9 @@ class ClientController extends BaseController */ public function update(UpdateClientRequest $request, Client $client) { - if($request->entityIsDeleted($client)) + if ($request->entityIsDeleted($client)) { return $request->disallowUpdate(); + } $client = $this->client_repo->save($request->all(), $client); diff --git a/app/Http/Controllers/ClientPortal/InvitationController.php b/app/Http/Controllers/ClientPortal/InvitationController.php index 5e3e2ed2c9..08f8616896 100644 --- a/app/Http/Controllers/ClientPortal/InvitationController.php +++ b/app/Http/Controllers/ClientPortal/InvitationController.php @@ -38,26 +38,22 @@ class InvitationController extends Controller $invitation = $entity_obj::whereRaw("BINARY `key`= ?", [$invitation_key])->first(); if ($invitation) { - if ((bool)$invitation->contact->client->getSetting('enable_client_portal_password') !== false) { $this->middleware('auth:contact'); } else { auth()->guard('contact')->login($invitation->contact, false); } - if(!request()->has('silent')){ - + if (!request()->has('silent')) { $invitation->markViewed(); event(new InvitationWasViewed($entity, $invitation)); - } return redirect()->route('client.'.$entity.'.show', [$entity => $this->encodePrimaryKey($invitation->{$key})]); - - } else + } else { abort(404); - + } } public function routerForDownload(string $entity, string $invitation_key) diff --git a/app/Http/Controllers/CompanyController.php b/app/Http/Controllers/CompanyController.php index 750564f72c..51b5d6814f 100644 --- a/app/Http/Controllers/CompanyController.php +++ b/app/Http/Controllers/CompanyController.php @@ -461,41 +461,30 @@ class CompanyController extends BaseController { $company_count = $company->account->companies->count(); - if($company_count == 1){ - + if ($company_count == 1) { $company->company_users->each(function ($company_user) { - $company_user->user->forceDelete(); - }); $company->account->delete(); - - } - else { - + } else { $account = $company->account; $company_id = $company->id; $company->delete(); //If we are deleting the default companies, we'll need to make a new company the default. - if($account->default_company_id == $company_id){ - + if ($account->default_company_id == $company_id) { $new_default_company = Company::whereAccountId($account->id)->first(); $account->default_company_id = $new_default_company->id; $account->save(); - } - - } //@todo delete documents also!! //@todo in the hosted version deleting the last - //account will trigger an account refund. + //account will trigger an account refund. return response()->json(['message' => 'success'], 200); - } } diff --git a/app/Http/Controllers/CompanyUserController.php b/app/Http/Controllers/CompanyUserController.php index 2e8b53f36a..990b07a34f 100644 --- a/app/Http/Controllers/CompanyUserController.php +++ b/app/Http/Controllers/CompanyUserController.php @@ -20,7 +20,6 @@ use Illuminate\Http\Request; class CompanyUserController extends BaseController { - protected $entity_type = CompanyUser::class; protected $entity_transformer = CompanyUserTransformer::class; @@ -55,7 +54,6 @@ class CompanyUserController extends BaseController public function store(CreateAccountRequest $request) { - } /** @@ -127,27 +125,26 @@ class CompanyUserController extends BaseController */ public function update(UpdateCompanyUserRequest $request, User $user) { - $company = auth()->user()->company(); + $company = auth()->user()->company(); - $company_user = CompanyUser::whereUserId($user->id)->whereCompanyId($company->id)->first(); + $company_user = CompanyUser::whereUserId($user->id)->whereCompanyId($company->id)->first(); - if(!$company_user){ - throw new ModelNotFoundException("Company User record not found"); - return; - } + if (!$company_user) { + throw new ModelNotFoundException("Company User record not found"); + return; + } - if(auth()->user()->isAdmin()){ - $company_user->fill($request->input('company_user')); - } - else { - $company_user->fill($request->input('company_user')['settings']); - $company_user->fill($request->input('company_user')['notifications']); - } + if (auth()->user()->isAdmin()) { + $company_user->fill($request->input('company_user')); + } else { + $company_user->fill($request->input('company_user')['settings']); + $company_user->fill($request->input('company_user')['notifications']); + } - $company_user->save(); + $company_user->save(); - return $this->itemResponse($company_user->fresh()); + return $this->itemResponse($company_user->fresh()); } /** diff --git a/app/Http/Controllers/Controller.php b/app/Http/Controllers/Controller.php index 9cf98b905d..5a68ef46b3 100644 --- a/app/Http/Controllers/Controller.php +++ b/app/Http/Controllers/Controller.php @@ -33,8 +33,9 @@ class Controller extends BaseController if (array_key_exists('root', $options)) { return view( - sprintf('%s.%s.%s', $options['root'], $theme, $path) - , $options); + sprintf('%s.%s.%s', $options['root'], $theme, $path), + $options + ); } return view("portal.$theme.$path", $options); diff --git a/app/Http/Controllers/CreditController.php b/app/Http/Controllers/CreditController.php index 1edc569ff4..e7a702dc40 100644 --- a/app/Http/Controllers/CreditController.php +++ b/app/Http/Controllers/CreditController.php @@ -362,8 +362,9 @@ class CreditController extends BaseController */ public function update(UpdateCreditRequest $request, Credit $credit) { - if($request->entityIsDeleted($credit)) + if ($request->entityIsDeleted($credit)) { return $request->disallowUpdate(); + } $credit = $this->credit_repository->save($request->all(), $credit); @@ -572,16 +573,14 @@ class CreditController extends BaseController } } - public function downloadPdf($invitation_key) + public function downloadPdf($invitation_key) { - $invitation = $this->credit_repository->getInvitationByKey($invitation_key); $contact = $invitation->contact; $credit = $invitation->credit; - $file_path = $credit->service()->getCreditPdf($contact); + $file_path = $credit->service()->getCreditPdf($contact); return response()->download($file_path); - } } diff --git a/app/Http/Controllers/DesignController.php b/app/Http/Controllers/DesignController.php index 3881467892..388ce1d375 100644 --- a/app/Http/Controllers/DesignController.php +++ b/app/Http/Controllers/DesignController.php @@ -255,8 +255,9 @@ class DesignController extends BaseController */ public function update(UpdateDesignRequest $request, Design $design) { - if($request->entityIsDeleted($design)) + if ($request->entityIsDeleted($design)) { return $request->disallowUpdate(); + } $design->fill($request->all()); $design->save(); @@ -485,6 +486,4 @@ class DesignController extends BaseController return $this->listResponse(Design::withTrashed()->whereIn('id', $this->transformKeys($ids))); } - - } diff --git a/app/Http/Controllers/ExpenseController.php b/app/Http/Controllers/ExpenseController.php index 5baa771d2a..fa4e2fd6cd 100644 --- a/app/Http/Controllers/ExpenseController.php +++ b/app/Http/Controllers/ExpenseController.php @@ -267,8 +267,9 @@ class ExpenseController extends BaseController */ public function update(UpdateExpenseRequest $request, Expense $expense) { - if($request->entityIsDeleted($expense)) + if ($request->entityIsDeleted($expense)) { return $request->disallowUpdate(); + } $expense = $this->client_repo->save($request->all(), $expense); diff --git a/app/Http/Controllers/InvoiceController.php b/app/Http/Controllers/InvoiceController.php index 28483f901e..0671607026 100644 --- a/app/Http/Controllers/InvoiceController.php +++ b/app/Http/Controllers/InvoiceController.php @@ -45,717 +45,715 @@ use Illuminate\Support\Facades\Storage; * @package App\Http\Controllers\InvoiceController */ -class InvoiceController extends BaseController { +class InvoiceController extends BaseController +{ + use MakesHash; - use MakesHash; + protected $entity_type = Invoice::class ; - protected $entity_type = Invoice::class ; + protected $entity_transformer = InvoiceTransformer::class ; - protected $entity_transformer = InvoiceTransformer::class ; + /** + * @var InvoiceRepository + */ + protected $invoice_repo; - /** - * @var InvoiceRepository - */ - protected $invoice_repo; - - /** - * InvoiceController constructor. - * - * @param \App\Repositories\InvoiceRepository $invoice_repo The invoice repo - */ - public function __construct(InvoiceRepository $invoice_repo) { - - parent::__construct(); - - $this->invoice_repo = $invoice_repo; - - } - - /** - * Show the list of Invoices - * - * @param \App\Filters\InvoiceFilters $filters The filters - * - * @return \Illuminate\Http\Response - * - * @OA\Get( - * path="/api/v1/invoices", - * operationId="getInvoices", - * tags={"invoices"}, - * summary="Gets a list of invoices", - * description="Lists invoices, search and filters allow fine grained lists to be generated. - * - * Query parameters can be added to performed more fine grained filtering of the invoices, these are handled by the InvoiceFilters class which defines the methods available", - * @OA\Parameter(ref="#/components/parameters/X-Api-Secret"), - * @OA\Parameter(ref="#/components/parameters/X-Api-Token"), - * @OA\Parameter(ref="#/components/parameters/X-Requested-With"), - * @OA\Parameter(ref="#/components/parameters/include"), - * @OA\Response( - * response=200, - * description="A list of invoices", - * @OA\Header(header="X-API-Version", ref="#/components/headers/X-API-Version"), - * @OA\Header(header="X-RateLimit-Remaining", ref="#/components/headers/X-RateLimit-Remaining"), - * @OA\Header(header="X-RateLimit-Limit", ref="#/components/headers/X-RateLimit-Limit"), - * @OA\JsonContent(ref="#/components/schemas/Invoice"), - * ), - * @OA\Response( - * response=422, - * description="Validation error", - * @OA\JsonContent(ref="#/components/schemas/ValidationError"), - - * ), - * @OA\Response( - * response="default", - * description="Unexpected Error", - * @OA\JsonContent(ref="#/components/schemas/Error"), - * ), - * ) - * - */ - public function index(InvoiceFilters $filters) { - $invoices = Invoice::filter($filters); - - return $this->listResponse($invoices); - } - - /** - * Show the form for creating a new resource. - * - * @param \App\Http\Requests\Invoice\CreateInvoiceRequest $request The request - * - * @return \Illuminate\Http\Response - * - * - * @OA\Get( - * path="/api/v1/invoices/create", - * operationId="getInvoicesCreate", - * tags={"invoices"}, - * summary="Gets a new blank invoice object", - * description="Returns a blank object with default values", - * @OA\Parameter(ref="#/components/parameters/X-Api-Secret"), - * @OA\Parameter(ref="#/components/parameters/X-Api-Token"), - * @OA\Parameter(ref="#/components/parameters/X-Requested-With"), - * @OA\Parameter(ref="#/components/parameters/include"), - * @OA\Response( - * response=200, - * description="A blank invoice object", - * @OA\Header(header="X-API-Version", ref="#/components/headers/X-API-Version"), - * @OA\Header(header="X-RateLimit-Remaining", ref="#/components/headers/X-RateLimit-Remaining"), - * @OA\Header(header="X-RateLimit-Limit", ref="#/components/headers/X-RateLimit-Limit"), - * @OA\JsonContent(ref="#/components/schemas/Invoice"), - * ), - * @OA\Response( - * response=422, - * description="Validation error", - * @OA\JsonContent(ref="#/components/schemas/ValidationError"), - * - * ), - * @OA\Response( - * response="default", - * description="Unexpected Error", - * @OA\JsonContent(ref="#/components/schemas/Error"), - * ), - * ) - * - */ - public function create(CreateInvoiceRequest $request) { - - $invoice = InvoiceFactory::create(auth()->user()->company()->id, auth()->user()->id); - - return $this->itemResponse($invoice); - } - - /** - * Store a newly created resource in storage. - * - * @param \App\Http\Requests\Invoice\StoreInvoiceRequest $request The request - * - * @return \Illuminate\Http\Response - * - * - * @OA\Post( - * path="/api/v1/invoices", - * operationId="storeInvoice", - * tags={"invoices"}, - * summary="Adds a invoice", - * description="Adds an invoice to the system", - * @OA\Parameter(ref="#/components/parameters/X-Api-Secret"), - * @OA\Parameter(ref="#/components/parameters/X-Api-Token"), - * @OA\Parameter(ref="#/components/parameters/X-Requested-With"), - * @OA\Parameter(ref="#/components/parameters/include"), - * @OA\Response( - * response=200, - * description="Returns the saved invoice object", - * @OA\Header(header="X-API-Version", ref="#/components/headers/X-API-Version"), - * @OA\Header(header="X-RateLimit-Remaining", ref="#/components/headers/X-RateLimit-Remaining"), - * @OA\Header(header="X-RateLimit-Limit", ref="#/components/headers/X-RateLimit-Limit"), - * @OA\JsonContent(ref="#/components/schemas/Invoice"), - * ), - * @OA\Response( - * response=422, - * description="Validation error", - * @OA\JsonContent(ref="#/components/schemas/ValidationError"), - * - * ), - * @OA\Response( - * response="default", - * description="Unexpected Error", - * @OA\JsonContent(ref="#/components/schemas/Error"), - * ), - * ) - * - */ - public function store(StoreInvoiceRequest $request) { - - $client = Client::find($request->input('client_id')); - - $invoice = $this->invoice_repo->save($request->all(), InvoiceFactory::create(auth()->user()->company()->id, auth()->user()->id)); - - $invoice = StoreInvoice::dispatchNow($invoice, $request->all(), $invoice->company);//todo potentially this may return mixed ie PDF/$invoice... need to revisit when we implement UI - - event(new InvoiceWasCreated($invoice, $invoice->company)); - - return $this->itemResponse($invoice); - } - - /** - * Display the specified resource. - * - * @param \App\Http\Requests\Invoice\ShowInvoiceRequest $request The request - * @param \App\Models\Invoice $invoice The invoice - * - * @return \Illuminate\Http\Response - * - * - * @OA\Get( - * path="/api/v1/invoices/{id}", - * operationId="showInvoice", - * tags={"invoices"}, - * summary="Shows an invoice", - * description="Displays an invoice by id", - * @OA\Parameter(ref="#/components/parameters/X-Api-Secret"), - * @OA\Parameter(ref="#/components/parameters/X-Api-Token"), - * @OA\Parameter(ref="#/components/parameters/X-Requested-With"), - * @OA\Parameter(ref="#/components/parameters/include"), - * @OA\Parameter( - * name="id", - * in="path", - * description="The Invoice Hashed ID", - * example="D2J234DFA", - * required=true, - * @OA\Schema( - * type="string", - * format="string", - * ), - * ), - * @OA\Response( - * response=200, - * description="Returns the invoice object", - * @OA\Header(header="X-API-Version", ref="#/components/headers/X-API-Version"), - * @OA\Header(header="X-RateLimit-Remaining", ref="#/components/headers/X-RateLimit-Remaining"), - * @OA\Header(header="X-RateLimit-Limit", ref="#/components/headers/X-RateLimit-Limit"), - * @OA\JsonContent(ref="#/components/schemas/Invoice"), - * ), - * @OA\Response( - * response=422, - * description="Validation error", - * @OA\JsonContent(ref="#/components/schemas/ValidationError"), - * - * ), - * @OA\Response( - * response="default", - * description="Unexpected Error", - * @OA\JsonContent(ref="#/components/schemas/Error"), - * ), - * ) - * - */ - public function show(ShowInvoiceRequest $request, Invoice $invoice) { - return $this->itemResponse($invoice); - } - - /** - * Show the form for editing the specified resource. - * - * @param \App\Http\Requests\Invoice\EditInvoiceRequest $request The request - * @param \App\Models\Invoice $invoice The invoice - * - * @return \Illuminate\Http\Response - * - * @OA\Get( - * path="/api/v1/invoices/{id}/edit", - * operationId="editInvoice", - * tags={"invoices"}, - * summary="Shows an invoice for editting", - * description="Displays an invoice by id", - * @OA\Parameter(ref="#/components/parameters/X-Api-Secret"), - * @OA\Parameter(ref="#/components/parameters/X-Api-Token"), - * @OA\Parameter(ref="#/components/parameters/X-Requested-With"), - * @OA\Parameter(ref="#/components/parameters/include"), - * @OA\Parameter( - * name="id", - * in="path", - * description="The Invoice Hashed ID", - * example="D2J234DFA", - * required=true, - * @OA\Schema( - * type="string", - * format="string", - * ), - * ), - * @OA\Response( - * response=200, - * description="Returns the invoice object", - * @OA\Header(header="X-API-Version", ref="#/components/headers/X-API-Version"), - * @OA\Header(header="X-RateLimit-Remaining", ref="#/components/headers/X-RateLimit-Remaining"), - * @OA\Header(header="X-RateLimit-Limit", ref="#/components/headers/X-RateLimit-Limit"), - * @OA\JsonContent(ref="#/components/schemas/Invoice"), - * ), - * @OA\Response( - * response=422, - * description="Validation error", - * @OA\JsonContent(ref="#/components/schemas/ValidationError"), - * - * ), - * @OA\Response( - * response="default", - * description="Unexpected Error", - * @OA\JsonContent(ref="#/components/schemas/Error"), - * ), - * ) - * - */ - public function edit(EditInvoiceRequest $request, Invoice $invoice) { - return $this->itemResponse($invoice); - } - - /** - * Update the specified resource in storage. - * - * @param \App\Http\Requests\Invoice\UpdateInvoiceRequest $request The request - * @param \App\Models\Invoice $invoice The invoice - * - * @return \Illuminate\Http\Response - * - * - * @OA\Put( - * path="/api/v1/invoices/{id}", - * operationId="updateInvoice", - * tags={"invoices"}, - * summary="Updates an invoice", - * description="Handles the updating of an invoice by id", - * @OA\Parameter(ref="#/components/parameters/X-Api-Secret"), - * @OA\Parameter(ref="#/components/parameters/X-Api-Token"), - * @OA\Parameter(ref="#/components/parameters/X-Requested-With"), - * @OA\Parameter(ref="#/components/parameters/include"), - * @OA\Parameter( - * name="id", - * in="path", - * description="The Invoice Hashed ID", - * example="D2J234DFA", - * required=true, - * @OA\Schema( - * type="string", - * format="string", - * ), - * ), - * @OA\Response( - * response=200, - * description="Returns the invoice object", - * @OA\Header(header="X-API-Version", ref="#/components/headers/X-API-Version"), - * @OA\Header(header="X-RateLimit-Remaining", ref="#/components/headers/X-RateLimit-Remaining"), - * @OA\Header(header="X-RateLimit-Limit", ref="#/components/headers/X-RateLimit-Limit"), - * @OA\JsonContent(ref="#/components/schemas/Invoice"), - * ), - * @OA\Response( - * response=422, - * description="Validation error", - * @OA\JsonContent(ref="#/components/schemas/ValidationError"), - * - * ), - * @OA\Response( - * response="default", - * description="Unexpected Error", - * @OA\JsonContent(ref="#/components/schemas/Error"), - * ), - * ) - * - */ - public function update(UpdateInvoiceRequest $request, Invoice $invoice) { - if ($request->entityIsDeleted($invoice)) { - return $request->disallowUpdate(); - } - - $invoice = $this->invoice_repo->save($request->all(), $invoice); - - event(new InvoiceWasUpdated($invoice, $invoice->company)); - - return $this->itemResponse($invoice); - } - - /** - * Remove the specified resource from storage. - * - * @param \App\Http\Requests\Invoice\DestroyInvoiceRequest $request - * @param \App\Models\Invoice $invoice - * - * @return \Illuminate\Http\Response - * - * @OA\Delete( - * path="/api/v1/invoices/{id}", - * operationId="deleteInvoice", - * tags={"invoices"}, - * summary="Deletes a invoice", - * description="Handles the deletion of an invoice by id", - * @OA\Parameter(ref="#/components/parameters/X-Api-Secret"), - * @OA\Parameter(ref="#/components/parameters/X-Api-Token"), - * @OA\Parameter(ref="#/components/parameters/X-Requested-With"), - * @OA\Parameter(ref="#/components/parameters/include"), - * @OA\Parameter( - * name="id", - * in="path", - * description="The Invoice Hashed ID", - * example="D2J234DFA", - * required=true, - * @OA\Schema( - * type="string", - * format="string", - * ), - * ), - * @OA\Response( - * response=200, - * description="Returns a HTTP status", - * @OA\Header(header="X-API-Version", ref="#/components/headers/X-API-Version"), - * @OA\Header(header="X-RateLimit-Remaining", ref="#/components/headers/X-RateLimit-Remaining"), - * @OA\Header(header="X-RateLimit-Limit", ref="#/components/headers/X-RateLimit-Limit"), - * ), - * @OA\Response( - * response=422, - * description="Validation error", - * @OA\JsonContent(ref="#/components/schemas/ValidationError"), - * - * ), - * @OA\Response( - * response="default", - * description="Unexpected Error", - * @OA\JsonContent(ref="#/components/schemas/Error"), - * ), - * ) - * - */ - public function destroy(DestroyInvoiceRequest $request, Invoice $invoice) { - $invoice->delete(); - - return response()->json([], 200); - } - - /** - * Perform bulk actions on the list view - * - * @return Collection - * - * @OA\Post( - * path="/api/v1/invoices/bulk", - * operationId="bulkInvoices", - * tags={"invoices"}, - * summary="Performs bulk actions on an array of invoices", - * description="", - * @OA\Parameter(ref="#/components/parameters/X-Api-Secret"), - * @OA\Parameter(ref="#/components/parameters/X-Api-Token"), - * @OA\Parameter(ref="#/components/parameters/X-Requested-With"), - * @OA\Parameter(ref="#/components/parameters/index"), - * @OA\RequestBody( - * description="User credentials", - * required=true, - * @OA\MediaType( - * mediaType="application/json", - * @OA\Schema( - * type="array", - * @OA\Items( - * type="integer", - * description="Array of hashed IDs to be bulk 'actioned", - * example="[0,1,2,3]", - * ), - * ) - * ) - * ), - * @OA\Response( - * response=200, - * description="The Bulk Action response", - * @OA\Header(header="X-API-Version", ref="#/components/headers/X-API-Version"), - * @OA\Header(header="X-RateLimit-Remaining", ref="#/components/headers/X-RateLimit-Remaining"), - * @OA\Header(header="X-RateLimit-Limit", ref="#/components/headers/X-RateLimit-Limit"), - * ), - * @OA\Response( - * response=422, - * description="Validation error", - * @OA\JsonContent(ref="#/components/schemas/ValidationError"), - - * ), - * @OA\Response( - * response="default", - * description="Unexpected Error", - * @OA\JsonContent(ref="#/components/schemas/Error"), - * ), - * ) - * - */ - public function bulk() { - - /* - * WIP! - */ - $action = request()->input('action'); - - $ids = request()->input('ids'); - - $invoices = Invoice::withTrashed()->whereIn('id', $this->transformKeys($ids))->company()->get(); - - if (!$invoices) { - return response()->json(['message' => 'No Invoices Found']); - } - - /* - * Download Invoice/s - */ - - if($action == 'download' && $invoices->count() > 1) - { - - $invoices->each(function ($invoice) { - - if(auth()->user()->cannot('view', $invoice)){ - return response()->json(['message'=>'Insufficient privileges to access invoice '. $invoice->number]); - } - - }); - - ZipInvoices::dispatch($invoices, $invoices->first()->company, auth()->user()->email); - - return response()->json(['message' => 'Email Sent!'],200); - } - - /* - * Send the other actions to the switch - */ - $invoices->each(function ($invoice, $key) use ($action) { - - if (auth()->user()->can('edit', $invoice)) { - $this->performAction($invoice, $action, true); - } - - }); - - /* Need to understand which permission are required for the given bulk action ie. view / edit */ - - return $this->listResponse(Invoice::withTrashed()->whereIn('id', $this->transformKeys($ids))->company()); - } - - - /** - * - * @OA\Get( - * path="/api/v1/invoices/{id}/{action}", - * operationId="actionInvoice", - * tags={"invoices"}, - * summary="Performs a custom action on an invoice", - * description="Performs a custom action on an invoice. + /** + * InvoiceController constructor. * - * The current range of actions are as follows - * - clone_to_invoice - * - clone_to_quote - * - history - * - delivery_note - * - mark_paid - * - download - * - archive - * - delete - * - email", - * @OA\Parameter(ref="#/components/parameters/X-Api-Secret"), - * @OA\Parameter(ref="#/components/parameters/X-Api-Token"), - * @OA\Parameter(ref="#/components/parameters/X-Requested-With"), - * @OA\Parameter(ref="#/components/parameters/include"), - * @OA\Parameter( - * name="id", - * in="path", - * description="The Invoice Hashed ID", - * example="D2J234DFA", - * required=true, - * @OA\Schema( - * type="string", - * format="string", - * ), - * ), - * @OA\Parameter( - * name="action", - * in="path", - * description="The action string to be performed", - * example="clone_to_quote", - * required=true, - * @OA\Schema( - * type="string", - * format="string", - * ), - * ), - * @OA\Response( - * response=200, - * description="Returns the invoice object", - * @OA\Header(header="X-API-Version", ref="#/components/headers/X-API-Version"), - * @OA\Header(header="X-RateLimit-Remaining", ref="#/components/headers/X-RateLimit-Remaining"), - * @OA\Header(header="X-RateLimit-Limit", ref="#/components/headers/X-RateLimit-Limit"), - * @OA\JsonContent(ref="#/components/schemas/Invoice"), - * ), - * @OA\Response( - * response=422, - * description="Validation error", - * @OA\JsonContent(ref="#/components/schemas/ValidationError"), - * - * ), - * @OA\Response( - * response="default", - * description="Unexpected Error", - * @OA\JsonContent(ref="#/components/schemas/Error"), - * ), - * ) - * - */ - public function action(ActionInvoiceRequest $request, Invoice $invoice, $action) { - return $this->performAction($invoice, $action); - } + * @param \App\Repositories\InvoiceRepository $invoice_repo The invoice repo + */ + public function __construct(InvoiceRepository $invoice_repo) + { + parent::__construct(); - private function performAction(Invoice $invoice, $action, $bulk = false) { - /*If we are using bulk actions, we don't want to return anything */ - switch ($action) { - case 'clone_to_invoice': - $invoice = CloneInvoiceFactory::create($invoice, auth()->user()->id); - return $this->itemResponse($invoice); - break; - case 'clone_to_quote': - $quote = CloneInvoiceToQuoteFactory::create($invoice, auth()->user()->id); - // todo build the quote transformer and return response here - break; - case 'history': - # code... - break; - case 'delivery_note': - # code... - break; - case 'mark_paid': - if ($invoice->balance < 0 || $invoice->status_id == Invoice::STATUS_PAID || $invoice->is_deleted === true) { - return $this->errorResponse(['message' => 'Invoice cannot be marked as paid'], 400); - } + $this->invoice_repo = $invoice_repo; + } - $invoice = $invoice->service()->markPaid(); + /** + * Show the list of Invoices + * + * @param \App\Filters\InvoiceFilters $filters The filters + * + * @return \Illuminate\Http\Response + * + * @OA\Get( + * path="/api/v1/invoices", + * operationId="getInvoices", + * tags={"invoices"}, + * summary="Gets a list of invoices", + * description="Lists invoices, search and filters allow fine grained lists to be generated. + * + * Query parameters can be added to performed more fine grained filtering of the invoices, these are handled by the InvoiceFilters class which defines the methods available", + * @OA\Parameter(ref="#/components/parameters/X-Api-Secret"), + * @OA\Parameter(ref="#/components/parameters/X-Api-Token"), + * @OA\Parameter(ref="#/components/parameters/X-Requested-With"), + * @OA\Parameter(ref="#/components/parameters/include"), + * @OA\Response( + * response=200, + * description="A list of invoices", + * @OA\Header(header="X-API-Version", ref="#/components/headers/X-API-Version"), + * @OA\Header(header="X-RateLimit-Remaining", ref="#/components/headers/X-RateLimit-Remaining"), + * @OA\Header(header="X-RateLimit-Limit", ref="#/components/headers/X-RateLimit-Limit"), + * @OA\JsonContent(ref="#/components/schemas/Invoice"), + * ), + * @OA\Response( + * response=422, + * description="Validation error", + * @OA\JsonContent(ref="#/components/schemas/ValidationError"), - if (!$bulk) { - return $this->itemResponse($invoice); - } - break; - case 'mark_sent': - $invoice->service()->markSent()->save(); + * ), + * @OA\Response( + * response="default", + * description="Unexpected Error", + * @OA\JsonContent(ref="#/components/schemas/Error"), + * ), + * ) + * + */ + public function index(InvoiceFilters $filters) + { + $invoices = Invoice::filter($filters); - if (!$bulk) { - return $this->itemResponse($invoice); - } - break; - case 'download': - return response()->download(public_path($invoice->pdf_file_path())); - break; - case 'archive': - $this->invoice_repo->archive($invoice); + return $this->listResponse($invoices); + } - if (!$bulk) { - return $this->listResponse($invoice); - } - break; - case 'delete': - $this->invoice_repo->delete($invoice); + /** + * Show the form for creating a new resource. + * + * @param \App\Http\Requests\Invoice\CreateInvoiceRequest $request The request + * + * @return \Illuminate\Http\Response + * + * + * @OA\Get( + * path="/api/v1/invoices/create", + * operationId="getInvoicesCreate", + * tags={"invoices"}, + * summary="Gets a new blank invoice object", + * description="Returns a blank object with default values", + * @OA\Parameter(ref="#/components/parameters/X-Api-Secret"), + * @OA\Parameter(ref="#/components/parameters/X-Api-Token"), + * @OA\Parameter(ref="#/components/parameters/X-Requested-With"), + * @OA\Parameter(ref="#/components/parameters/include"), + * @OA\Response( + * response=200, + * description="A blank invoice object", + * @OA\Header(header="X-API-Version", ref="#/components/headers/X-API-Version"), + * @OA\Header(header="X-RateLimit-Remaining", ref="#/components/headers/X-RateLimit-Remaining"), + * @OA\Header(header="X-RateLimit-Limit", ref="#/components/headers/X-RateLimit-Limit"), + * @OA\JsonContent(ref="#/components/schemas/Invoice"), + * ), + * @OA\Response( + * response=422, + * description="Validation error", + * @OA\JsonContent(ref="#/components/schemas/ValidationError"), + * + * ), + * @OA\Response( + * response="default", + * description="Unexpected Error", + * @OA\JsonContent(ref="#/components/schemas/Error"), + * ), + * ) + * + */ + public function create(CreateInvoiceRequest $request) + { + $invoice = InvoiceFactory::create(auth()->user()->company()->id, auth()->user()->id); - if (!$bulk) { - return $this->listResponse($invoice); - } - break; - case 'email': + return $this->itemResponse($invoice); + } - $this->reminder_template = $invoice->calculateTemplate(); + /** + * Store a newly created resource in storage. + * + * @param \App\Http\Requests\Invoice\StoreInvoiceRequest $request The request + * + * @return \Illuminate\Http\Response + * + * + * @OA\Post( + * path="/api/v1/invoices", + * operationId="storeInvoice", + * tags={"invoices"}, + * summary="Adds a invoice", + * description="Adds an invoice to the system", + * @OA\Parameter(ref="#/components/parameters/X-Api-Secret"), + * @OA\Parameter(ref="#/components/parameters/X-Api-Token"), + * @OA\Parameter(ref="#/components/parameters/X-Requested-With"), + * @OA\Parameter(ref="#/components/parameters/include"), + * @OA\Response( + * response=200, + * description="Returns the saved invoice object", + * @OA\Header(header="X-API-Version", ref="#/components/headers/X-API-Version"), + * @OA\Header(header="X-RateLimit-Remaining", ref="#/components/headers/X-RateLimit-Remaining"), + * @OA\Header(header="X-RateLimit-Limit", ref="#/components/headers/X-RateLimit-Limit"), + * @OA\JsonContent(ref="#/components/schemas/Invoice"), + * ), + * @OA\Response( + * response=422, + * description="Validation error", + * @OA\JsonContent(ref="#/components/schemas/ValidationError"), + * + * ), + * @OA\Response( + * response="default", + * description="Unexpected Error", + * @OA\JsonContent(ref="#/components/schemas/Error"), + * ), + * ) + * + */ + public function store(StoreInvoiceRequest $request) + { + $client = Client::find($request->input('client_id')); - $invoice->invitations->each(function ($invitation) use($invoice){ + $invoice = $this->invoice_repo->save($request->all(), InvoiceFactory::create(auth()->user()->company()->id, auth()->user()->id)); - $email_builder = (new InvoiceEmail())->build($invitation, $this->reminder_template); + $invoice = StoreInvoice::dispatchNow($invoice, $request->all(), $invoice->company);//todo potentially this may return mixed ie PDF/$invoice... need to revisit when we implement UI - EmailInvoice::dispatch($email_builder, $invitation, $invoice->company); + event(new InvoiceWasCreated($invoice, $invoice->company)); - }); + return $this->itemResponse($invoice); + } - if($invoice->invitations->count() > 0){ - \Log::error("more than one invitation to send"); - event(new InvoiceWasEmailed($invoice->invitations->first())); - } + /** + * Display the specified resource. + * + * @param \App\Http\Requests\Invoice\ShowInvoiceRequest $request The request + * @param \App\Models\Invoice $invoice The invoice + * + * @return \Illuminate\Http\Response + * + * + * @OA\Get( + * path="/api/v1/invoices/{id}", + * operationId="showInvoice", + * tags={"invoices"}, + * summary="Shows an invoice", + * description="Displays an invoice by id", + * @OA\Parameter(ref="#/components/parameters/X-Api-Secret"), + * @OA\Parameter(ref="#/components/parameters/X-Api-Token"), + * @OA\Parameter(ref="#/components/parameters/X-Requested-With"), + * @OA\Parameter(ref="#/components/parameters/include"), + * @OA\Parameter( + * name="id", + * in="path", + * description="The Invoice Hashed ID", + * example="D2J234DFA", + * required=true, + * @OA\Schema( + * type="string", + * format="string", + * ), + * ), + * @OA\Response( + * response=200, + * description="Returns the invoice object", + * @OA\Header(header="X-API-Version", ref="#/components/headers/X-API-Version"), + * @OA\Header(header="X-RateLimit-Remaining", ref="#/components/headers/X-RateLimit-Remaining"), + * @OA\Header(header="X-RateLimit-Limit", ref="#/components/headers/X-RateLimit-Limit"), + * @OA\JsonContent(ref="#/components/schemas/Invoice"), + * ), + * @OA\Response( + * response=422, + * description="Validation error", + * @OA\JsonContent(ref="#/components/schemas/ValidationError"), + * + * ), + * @OA\Response( + * response="default", + * description="Unexpected Error", + * @OA\JsonContent(ref="#/components/schemas/Error"), + * ), + * ) + * + */ + public function show(ShowInvoiceRequest $request, Invoice $invoice) + { + return $this->itemResponse($invoice); + } - if (!$bulk) { - return response()->json(['message' => 'email sent'], 200); - } - break; + /** + * Show the form for editing the specified resource. + * + * @param \App\Http\Requests\Invoice\EditInvoiceRequest $request The request + * @param \App\Models\Invoice $invoice The invoice + * + * @return \Illuminate\Http\Response + * + * @OA\Get( + * path="/api/v1/invoices/{id}/edit", + * operationId="editInvoice", + * tags={"invoices"}, + * summary="Shows an invoice for editting", + * description="Displays an invoice by id", + * @OA\Parameter(ref="#/components/parameters/X-Api-Secret"), + * @OA\Parameter(ref="#/components/parameters/X-Api-Token"), + * @OA\Parameter(ref="#/components/parameters/X-Requested-With"), + * @OA\Parameter(ref="#/components/parameters/include"), + * @OA\Parameter( + * name="id", + * in="path", + * description="The Invoice Hashed ID", + * example="D2J234DFA", + * required=true, + * @OA\Schema( + * type="string", + * format="string", + * ), + * ), + * @OA\Response( + * response=200, + * description="Returns the invoice object", + * @OA\Header(header="X-API-Version", ref="#/components/headers/X-API-Version"), + * @OA\Header(header="X-RateLimit-Remaining", ref="#/components/headers/X-RateLimit-Remaining"), + * @OA\Header(header="X-RateLimit-Limit", ref="#/components/headers/X-RateLimit-Limit"), + * @OA\JsonContent(ref="#/components/schemas/Invoice"), + * ), + * @OA\Response( + * response=422, + * description="Validation error", + * @OA\JsonContent(ref="#/components/schemas/ValidationError"), + * + * ), + * @OA\Response( + * response="default", + * description="Unexpected Error", + * @OA\JsonContent(ref="#/components/schemas/Error"), + * ), + * ) + * + */ + public function edit(EditInvoiceRequest $request, Invoice $invoice) + { + return $this->itemResponse($invoice); + } - default: - return response()->json(['message' => "The requested action `{$action}` is not available."], 400); - break; - } - } + /** + * Update the specified resource in storage. + * + * @param \App\Http\Requests\Invoice\UpdateInvoiceRequest $request The request + * @param \App\Models\Invoice $invoice The invoice + * + * @return \Illuminate\Http\Response + * + * + * @OA\Put( + * path="/api/v1/invoices/{id}", + * operationId="updateInvoice", + * tags={"invoices"}, + * summary="Updates an invoice", + * description="Handles the updating of an invoice by id", + * @OA\Parameter(ref="#/components/parameters/X-Api-Secret"), + * @OA\Parameter(ref="#/components/parameters/X-Api-Token"), + * @OA\Parameter(ref="#/components/parameters/X-Requested-With"), + * @OA\Parameter(ref="#/components/parameters/include"), + * @OA\Parameter( + * name="id", + * in="path", + * description="The Invoice Hashed ID", + * example="D2J234DFA", + * required=true, + * @OA\Schema( + * type="string", + * format="string", + * ), + * ), + * @OA\Response( + * response=200, + * description="Returns the invoice object", + * @OA\Header(header="X-API-Version", ref="#/components/headers/X-API-Version"), + * @OA\Header(header="X-RateLimit-Remaining", ref="#/components/headers/X-RateLimit-Remaining"), + * @OA\Header(header="X-RateLimit-Limit", ref="#/components/headers/X-RateLimit-Limit"), + * @OA\JsonContent(ref="#/components/schemas/Invoice"), + * ), + * @OA\Response( + * response=422, + * description="Validation error", + * @OA\JsonContent(ref="#/components/schemas/ValidationError"), + * + * ), + * @OA\Response( + * response="default", + * description="Unexpected Error", + * @OA\JsonContent(ref="#/components/schemas/Error"), + * ), + * ) + * + */ + public function update(UpdateInvoiceRequest $request, Invoice $invoice) + { + if ($request->entityIsDeleted($invoice)) { + return $request->disallowUpdate(); + } - /** - * - * @OA\Get( - * path="/api/v1/invoice/{invitation_key}/download", - * operationId="downloadInvoice", - * tags={"invoices"}, - * summary="Download a specific invoice by invitation key", - * description="Downloads a specific invoice", - * @OA\Parameter(ref="#/components/parameters/X-Api-Secret"), - * @OA\Parameter(ref="#/components/parameters/X-Api-Token"), - * @OA\Parameter(ref="#/components/parameters/X-Requested-With"), - * @OA\Parameter(ref="#/components/parameters/include"), - * @OA\Parameter( - * name="invitation_key", - * in="path", - * description="The Invoice Invitation Key", - * example="D2J234DFA", - * required=true, - * @OA\Schema( - * type="string", - * format="string", - * ), - * ), - * @OA\Response( - * response=200, - * description="Returns the invoice pdf", - * @OA\Header(header="X-API-Version", ref="#/components/headers/X-API-Version"), - * @OA\Header(header="X-RateLimit-Remaining", ref="#/components/headers/X-RateLimit-Remaining"), - * @OA\Header(header="X-RateLimit-Limit", ref="#/components/headers/X-RateLimit-Limit"), - * ), - * @OA\Response( - * response=422, - * description="Validation error", - * @OA\JsonContent(ref="#/components/schemas/ValidationError"), - * - * ), - * @OA\Response( - * response="default", - * description="Unexpected Error", - * @OA\JsonContent(ref="#/components/schemas/Error"), - * ), - * ) - * - */ - public function downloadPdf($invitation_key) { + $invoice = $this->invoice_repo->save($request->all(), $invoice); - $invitation = $this->invoice_repo->getInvitationByKey($invitation_key); - $contact = $invitation->contact; - $invoice = $invitation->invoice; + event(new InvoiceWasUpdated($invoice, $invoice->company)); - $file_path = $invoice->service()->getInvoicePdf($contact); + return $this->itemResponse($invoice); + } - return response()->download($file_path); + /** + * Remove the specified resource from storage. + * + * @param \App\Http\Requests\Invoice\DestroyInvoiceRequest $request + * @param \App\Models\Invoice $invoice + * + * @return \Illuminate\Http\Response + * + * @OA\Delete( + * path="/api/v1/invoices/{id}", + * operationId="deleteInvoice", + * tags={"invoices"}, + * summary="Deletes a invoice", + * description="Handles the deletion of an invoice by id", + * @OA\Parameter(ref="#/components/parameters/X-Api-Secret"), + * @OA\Parameter(ref="#/components/parameters/X-Api-Token"), + * @OA\Parameter(ref="#/components/parameters/X-Requested-With"), + * @OA\Parameter(ref="#/components/parameters/include"), + * @OA\Parameter( + * name="id", + * in="path", + * description="The Invoice Hashed ID", + * example="D2J234DFA", + * required=true, + * @OA\Schema( + * type="string", + * format="string", + * ), + * ), + * @OA\Response( + * response=200, + * description="Returns a HTTP status", + * @OA\Header(header="X-API-Version", ref="#/components/headers/X-API-Version"), + * @OA\Header(header="X-RateLimit-Remaining", ref="#/components/headers/X-RateLimit-Remaining"), + * @OA\Header(header="X-RateLimit-Limit", ref="#/components/headers/X-RateLimit-Limit"), + * ), + * @OA\Response( + * response=422, + * description="Validation error", + * @OA\JsonContent(ref="#/components/schemas/ValidationError"), + * + * ), + * @OA\Response( + * response="default", + * description="Unexpected Error", + * @OA\JsonContent(ref="#/components/schemas/Error"), + * ), + * ) + * + */ + public function destroy(DestroyInvoiceRequest $request, Invoice $invoice) + { + $invoice->delete(); - } + return response()->json([], 200); + } + + /** + * Perform bulk actions on the list view + * + * @return Collection + * + * @OA\Post( + * path="/api/v1/invoices/bulk", + * operationId="bulkInvoices", + * tags={"invoices"}, + * summary="Performs bulk actions on an array of invoices", + * description="", + * @OA\Parameter(ref="#/components/parameters/X-Api-Secret"), + * @OA\Parameter(ref="#/components/parameters/X-Api-Token"), + * @OA\Parameter(ref="#/components/parameters/X-Requested-With"), + * @OA\Parameter(ref="#/components/parameters/index"), + * @OA\RequestBody( + * description="User credentials", + * required=true, + * @OA\MediaType( + * mediaType="application/json", + * @OA\Schema( + * type="array", + * @OA\Items( + * type="integer", + * description="Array of hashed IDs to be bulk 'actioned", + * example="[0,1,2,3]", + * ), + * ) + * ) + * ), + * @OA\Response( + * response=200, + * description="The Bulk Action response", + * @OA\Header(header="X-API-Version", ref="#/components/headers/X-API-Version"), + * @OA\Header(header="X-RateLimit-Remaining", ref="#/components/headers/X-RateLimit-Remaining"), + * @OA\Header(header="X-RateLimit-Limit", ref="#/components/headers/X-RateLimit-Limit"), + * ), + * @OA\Response( + * response=422, + * description="Validation error", + * @OA\JsonContent(ref="#/components/schemas/ValidationError"), + + * ), + * @OA\Response( + * response="default", + * description="Unexpected Error", + * @OA\JsonContent(ref="#/components/schemas/Error"), + * ), + * ) + * + */ + public function bulk() + { + + /* + * WIP! + */ + $action = request()->input('action'); + + $ids = request()->input('ids'); + + $invoices = Invoice::withTrashed()->whereIn('id', $this->transformKeys($ids))->company()->get(); + + if (!$invoices) { + return response()->json(['message' => 'No Invoices Found']); + } + + /* + * Download Invoice/s + */ + + if ($action == 'download' && $invoices->count() > 1) { + $invoices->each(function ($invoice) { + if (auth()->user()->cannot('view', $invoice)) { + return response()->json(['message'=>'Insufficient privileges to access invoice '. $invoice->number]); + } + }); + + ZipInvoices::dispatch($invoices, $invoices->first()->company, auth()->user()->email); + + return response()->json(['message' => 'Email Sent!'], 200); + } + + /* + * Send the other actions to the switch + */ + $invoices->each(function ($invoice, $key) use ($action) { + if (auth()->user()->can('edit', $invoice)) { + $this->performAction($invoice, $action, true); + } + }); + + /* Need to understand which permission are required for the given bulk action ie. view / edit */ + + return $this->listResponse(Invoice::withTrashed()->whereIn('id', $this->transformKeys($ids))->company()); + } + + + /** + * + * @OA\Get( + * path="/api/v1/invoices/{id}/{action}", + * operationId="actionInvoice", + * tags={"invoices"}, + * summary="Performs a custom action on an invoice", + * description="Performs a custom action on an invoice. + * + * The current range of actions are as follows + * - clone_to_invoice + * - clone_to_quote + * - history + * - delivery_note + * - mark_paid + * - download + * - archive + * - delete + * - email", + * @OA\Parameter(ref="#/components/parameters/X-Api-Secret"), + * @OA\Parameter(ref="#/components/parameters/X-Api-Token"), + * @OA\Parameter(ref="#/components/parameters/X-Requested-With"), + * @OA\Parameter(ref="#/components/parameters/include"), + * @OA\Parameter( + * name="id", + * in="path", + * description="The Invoice Hashed ID", + * example="D2J234DFA", + * required=true, + * @OA\Schema( + * type="string", + * format="string", + * ), + * ), + * @OA\Parameter( + * name="action", + * in="path", + * description="The action string to be performed", + * example="clone_to_quote", + * required=true, + * @OA\Schema( + * type="string", + * format="string", + * ), + * ), + * @OA\Response( + * response=200, + * description="Returns the invoice object", + * @OA\Header(header="X-API-Version", ref="#/components/headers/X-API-Version"), + * @OA\Header(header="X-RateLimit-Remaining", ref="#/components/headers/X-RateLimit-Remaining"), + * @OA\Header(header="X-RateLimit-Limit", ref="#/components/headers/X-RateLimit-Limit"), + * @OA\JsonContent(ref="#/components/schemas/Invoice"), + * ), + * @OA\Response( + * response=422, + * description="Validation error", + * @OA\JsonContent(ref="#/components/schemas/ValidationError"), + * + * ), + * @OA\Response( + * response="default", + * description="Unexpected Error", + * @OA\JsonContent(ref="#/components/schemas/Error"), + * ), + * ) + * + */ + public function action(ActionInvoiceRequest $request, Invoice $invoice, $action) + { + return $this->performAction($invoice, $action); + } + + private function performAction(Invoice $invoice, $action, $bulk = false) + { + /*If we are using bulk actions, we don't want to return anything */ + switch ($action) { + case 'clone_to_invoice': + $invoice = CloneInvoiceFactory::create($invoice, auth()->user()->id); + return $this->itemResponse($invoice); + break; + case 'clone_to_quote': + $quote = CloneInvoiceToQuoteFactory::create($invoice, auth()->user()->id); + // todo build the quote transformer and return response here + break; + case 'history': + # code... + break; + case 'delivery_note': + # code... + break; + case 'mark_paid': + if ($invoice->balance < 0 || $invoice->status_id == Invoice::STATUS_PAID || $invoice->is_deleted === true) { + return $this->errorResponse(['message' => 'Invoice cannot be marked as paid'], 400); + } + + $invoice = $invoice->service()->markPaid(); + + if (!$bulk) { + return $this->itemResponse($invoice); + } + break; + case 'mark_sent': + $invoice->service()->markSent()->save(); + + if (!$bulk) { + return $this->itemResponse($invoice); + } + break; + case 'download': + return response()->download(public_path($invoice->pdf_file_path())); + break; + case 'archive': + $this->invoice_repo->archive($invoice); + + if (!$bulk) { + return $this->listResponse($invoice); + } + break; + case 'delete': + $this->invoice_repo->delete($invoice); + + if (!$bulk) { + return $this->listResponse($invoice); + } + break; + case 'email': + + $this->reminder_template = $invoice->calculateTemplate(); + + $invoice->invitations->each(function ($invitation) use ($invoice) { + $email_builder = (new InvoiceEmail())->build($invitation, $this->reminder_template); + + EmailInvoice::dispatch($email_builder, $invitation, $invoice->company); + }); + + if ($invoice->invitations->count() > 0) { + \Log::error("more than one invitation to send"); + event(new InvoiceWasEmailed($invoice->invitations->first())); + } + + if (!$bulk) { + return response()->json(['message' => 'email sent'], 200); + } + break; + + default: + return response()->json(['message' => "The requested action `{$action}` is not available."], 400); + break; + } + } + + /** + * + * @OA\Get( + * path="/api/v1/invoice/{invitation_key}/download", + * operationId="downloadInvoice", + * tags={"invoices"}, + * summary="Download a specific invoice by invitation key", + * description="Downloads a specific invoice", + * @OA\Parameter(ref="#/components/parameters/X-Api-Secret"), + * @OA\Parameter(ref="#/components/parameters/X-Api-Token"), + * @OA\Parameter(ref="#/components/parameters/X-Requested-With"), + * @OA\Parameter(ref="#/components/parameters/include"), + * @OA\Parameter( + * name="invitation_key", + * in="path", + * description="The Invoice Invitation Key", + * example="D2J234DFA", + * required=true, + * @OA\Schema( + * type="string", + * format="string", + * ), + * ), + * @OA\Response( + * response=200, + * description="Returns the invoice pdf", + * @OA\Header(header="X-API-Version", ref="#/components/headers/X-API-Version"), + * @OA\Header(header="X-RateLimit-Remaining", ref="#/components/headers/X-RateLimit-Remaining"), + * @OA\Header(header="X-RateLimit-Limit", ref="#/components/headers/X-RateLimit-Limit"), + * ), + * @OA\Response( + * response=422, + * description="Validation error", + * @OA\JsonContent(ref="#/components/schemas/ValidationError"), + * + * ), + * @OA\Response( + * response="default", + * description="Unexpected Error", + * @OA\JsonContent(ref="#/components/schemas/Error"), + * ), + * ) + * + */ + public function downloadPdf($invitation_key) + { + $invitation = $this->invoice_repo->getInvitationByKey($invitation_key); + $contact = $invitation->contact; + $invoice = $invitation->invoice; + + $file_path = $invoice->service()->getInvoicePdf($contact); + + return response()->download($file_path); + } } diff --git a/app/Http/Controllers/LicenseController.php b/app/Http/Controllers/LicenseController.php index 99c50ce339..0e2f516f68 100644 --- a/app/Http/Controllers/LicenseController.php +++ b/app/Http/Controllers/LicenseController.php @@ -19,7 +19,6 @@ use Illuminate\Http\Request; class LicenseController extends BaseController { - public function __construct() { parent::__construct(); @@ -84,9 +83,7 @@ class LicenseController extends BaseController { /* Catch claim license requests */ - if(config('ninja.environment') == 'selfhost' && $request->has('license_key')) - { - + if (config('ninja.environment') == 'selfhost' && $request->has('license_key')) { $license_key = $request->input('license_key'); $product_id = 3; @@ -94,29 +91,23 @@ class LicenseController extends BaseController $data = trim(CurlUtils::get($url)); if ($data == Account::RESULT_FAILURE) { - $error = [ 'message' => trans('texts.invalid_white_label_license'), 'errors' => [] ]; return response()->json($error, 400); - } elseif ($data) { - $date = date_create($data)->modify('+1 year'); if ($date < date_create()) { - $error = [ 'message' => trans('texts.invalid_white_label_license'), 'errors' => [] ]; return response()->json($error, 400); - } else { - $account = auth()->user()->company()->account; $account->plan_term = Account::PLAN_TERM_YEARLY; @@ -131,19 +122,15 @@ class LicenseController extends BaseController ]; return response()->json($error, 200); - } } else { - - $error = [ + $error = [ 'message' => trans('texts.white_label_license_error'), 'errors' => [] ]; - return response()->json($error, 400); - + return response()->json($error, 400); } - } $error = [ @@ -153,6 +140,4 @@ class LicenseController extends BaseController return response()->json($error, 400); } - - } diff --git a/app/Http/Controllers/MigrationController.php b/app/Http/Controllers/MigrationController.php index 6e0cfa12a1..d30835056c 100644 --- a/app/Http/Controllers/MigrationController.php +++ b/app/Http/Controllers/MigrationController.php @@ -226,7 +226,9 @@ class MigrationController extends BaseController $migration_file = $request->file('migration') ->storeAs('migrations', $request->file('migration')->getClientOriginalName()); - if (app()->environment() == 'testing') return; + if (app()->environment() == 'testing') { + return; + } StartMigration::dispatch(base_path("storage/app/public/$migration_file"), $user, $company); diff --git a/app/Http/Controllers/OpenAPI/ClientGatewayToken.php b/app/Http/Controllers/OpenAPI/ClientGatewayToken.php index b16740d896..a9b4dd7df9 100644 --- a/app/Http/Controllers/OpenAPI/ClientGatewayToken.php +++ b/app/Http/Controllers/OpenAPI/ClientGatewayToken.php @@ -10,6 +10,6 @@ * @OA\Property(property="routing_number", type="string", example="2", description="______"), * @OA\Property(property="company_gateway_id", type="string", example="2", description="______"), * @OA\Property(property="is_default", type="boolean", example="true", description="______"), - * + * * ) */ diff --git a/app/Http/Controllers/OpenAPI/CreditPaymentableSchema.php b/app/Http/Controllers/OpenAPI/CreditPaymentableSchema.php index 2b8519d377..e05ff50a85 100644 --- a/app/Http/Controllers/OpenAPI/CreditPaymentableSchema.php +++ b/app/Http/Controllers/OpenAPI/CreditPaymentableSchema.php @@ -5,6 +5,6 @@ * type="object", * @OA\Property(property="credit_id", type="string", example="Opnel5aKBz", description="______"), * @OA\Property(property="amount", type="string", example="2", description="______"), - * + * * ) */ diff --git a/app/Http/Controllers/OpenAPI/InvoicePaymentableSchema.php b/app/Http/Controllers/OpenAPI/InvoicePaymentableSchema.php index 7e2789e31c..311088cbb7 100644 --- a/app/Http/Controllers/OpenAPI/InvoicePaymentableSchema.php +++ b/app/Http/Controllers/OpenAPI/InvoicePaymentableSchema.php @@ -5,6 +5,6 @@ * type="object", * @OA\Property(property="invoice_id", type="string", example="Opnel5aKBz", description="______"), * @OA\Property(property="amount", type="string", example="2", description="______"), - * + * * ) */ diff --git a/app/Http/Controllers/OpenAPI/PaymentSchema.php b/app/Http/Controllers/OpenAPI/PaymentSchema.php index f8ca4898da..98b681a625 100644 --- a/app/Http/Controllers/OpenAPI/PaymentSchema.php +++ b/app/Http/Controllers/OpenAPI/PaymentSchema.php @@ -37,6 +37,6 @@ * ref="#/components/schemas/CreditPaymentable", * ), * ), - * + * * ) */ diff --git a/app/Http/Controllers/OpenAPI/PaymentableSchema.php b/app/Http/Controllers/OpenAPI/PaymentableSchema.php index f145837684..357dc40c5f 100644 --- a/app/Http/Controllers/OpenAPI/PaymentableSchema.php +++ b/app/Http/Controllers/OpenAPI/PaymentableSchema.php @@ -9,6 +9,6 @@ * @OA\Property(property="refunded", type="number", format="float", example="10.00", description="______"), * @OA\Property(property="amount", type="number", format="float", example="10.00", description="______"), * @OA\Property(property="updated_at", type="number", format="integer", example="1434342123", description="Timestamp"), - * @OA\Property(property="created_at", type="number", format="integer", example="1434342123", description="Timestamp"),* + * @OA\Property(property="created_at", type="number", format="integer", example="1434342123", description="Timestamp"),* * ) */ diff --git a/app/Http/Controllers/PaymentController.php b/app/Http/Controllers/PaymentController.php index e421fd7f97..eb08d67b7d 100644 --- a/app/Http/Controllers/PaymentController.php +++ b/app/Http/Controllers/PaymentController.php @@ -381,8 +381,9 @@ class PaymentController extends BaseController */ public function update(UpdatePaymentRequest $request, Payment $payment) { - if($request->entityIsDeleted($payment)) + if ($request->entityIsDeleted($payment)) { return $request->disallowUpdate(); + } $payment = $this->payment_repo->save($request->all(), $payment); @@ -674,12 +675,10 @@ class PaymentController extends BaseController */ public function refund(RefundPaymentRequest $request) { - $payment = $request->payment(); $payment = $payment->refund($request->all()); return $this->itemResponse($payment); } - } diff --git a/app/Http/Controllers/PreviewController.php b/app/Http/Controllers/PreviewController.php index 0de8824798..468cb3d74a 100644 --- a/app/Http/Controllers/PreviewController.php +++ b/app/Http/Controllers/PreviewController.php @@ -20,7 +20,6 @@ use App\Utils\Traits\MakesHash; use App\Utils\Traits\MakesInvoiceHtml; use Illuminate\Support\Facades\Storage; - class PreviewController extends BaseController { use MakesHash; @@ -88,16 +87,14 @@ class PreviewController extends BaseController */ public function show() { - - if (request()->has('entity') && - request()->has('entity_id') && - request()->has('body')) - { - + if (request()->has('entity') && + request()->has('entity_id') && + request()->has('body')) { $design_object = json_decode(json_encode(request()->input('design'))); - if(!is_object($design_object)) + if (!is_object($design_object)) { return response()->json(['message' => 'Invalid custom design object'], 400); + } $entity = ucfirst(request()->input('entity')); @@ -107,8 +104,9 @@ class PreviewController extends BaseController $entity_obj = $class::whereId($this->decodePrimaryKey(request()->input('entity_id')))->company()->first(); - if(!$entity_obj) + if (!$entity_obj) { return $this->blankEntity(); + } $entity_obj->load('client'); @@ -119,21 +117,19 @@ class PreviewController extends BaseController $file_path = PreviewPdf::dispatchNow($html, auth()->user()->company()); return response()->download($file_path)->deleteFileAfterSend(true); - } return $this->blankEntity(); - } private function blankEntity() { - $client = factory(\App\Models\Client::class)->create([ + $client = factory(\App\Models\Client::class)->create([ 'user_id' => auth()->user()->id, 'company_id' => auth()->user()->company()->id, ]); - $contact = factory(\App\Models\ClientContact::class)->create([ + $contact = factory(\App\Models\ClientContact::class)->create([ 'user_id' => auth()->user()->id, 'company_id' => auth()->user()->company()->id, 'client_id' => $client->id, @@ -141,35 +137,32 @@ class PreviewController extends BaseController 'send_email' => true, ]); - $invoice = factory(\App\Models\Invoice::class)->create([ + $invoice = factory(\App\Models\Invoice::class)->create([ 'user_id' => auth()->user()->id, 'company_id' => auth()->user()->company()->id, 'client_id' => $client->id, ]); - $invoice->setRelation('client', $client); - $invoice->setRelation('company', auth()->user()->company()); - $invoice->load('client'); + $invoice->setRelation('client', $client); + $invoice->setRelation('company', auth()->user()->company()); + $invoice->load('client'); - $design_object = json_decode(json_encode(request()->input('design'))); + $design_object = json_decode(json_encode(request()->input('design'))); - if(!is_object($design_object)) - return response()->json(['message' => 'Invalid custom design object'], 400); + if (!is_object($design_object)) { + return response()->json(['message' => 'Invalid custom design object'], 400); + } - $designer = new Designer($invoice, $design_object, $invoice->client->getSetting('pdf_variables'), lcfirst(request()->has('entity'))); + $designer = new Designer($invoice, $design_object, $invoice->client->getSetting('pdf_variables'), lcfirst(request()->has('entity'))); - $html = $this->generateEntityHtml($designer, $invoice, $contact); + $html = $this->generateEntityHtml($designer, $invoice, $contact); - $file_path = PreviewPdf::dispatchNow($html, auth()->user()->company()); + $file_path = PreviewPdf::dispatchNow($html, auth()->user()->company()); - $invoice->forceDelete(); - $contact->forceDelete(); - $client->forceDelete(); - - return response()->file($file_path, array('content-type' => 'application/pdf')); + $invoice->forceDelete(); + $contact->forceDelete(); + $client->forceDelete(); + return response()->file($file_path, array('content-type' => 'application/pdf')); } - - - } diff --git a/app/Http/Controllers/ProductController.php b/app/Http/Controllers/ProductController.php index fea5c5b7e5..59fbbefec4 100644 --- a/app/Http/Controllers/ProductController.php +++ b/app/Http/Controllers/ProductController.php @@ -345,9 +345,9 @@ class ProductController extends BaseController */ public function update(UpdateProductRequest $request, Product $product) { - - if($request->entityIsDeleted($product)) + if ($request->entityIsDeleted($product)) { return $request->disallowUpdate(); + } $product = $this->product_repo->save($request->all(), $product); diff --git a/app/Http/Controllers/QuoteController.php b/app/Http/Controllers/QuoteController.php index 982de7587b..5e11973a11 100644 --- a/app/Http/Controllers/QuoteController.php +++ b/app/Http/Controllers/QuoteController.php @@ -378,8 +378,9 @@ class QuoteController extends BaseController */ public function update(UpdateQuoteRequest $request, Quote $quote) { - if($request->entityIsDeleted($quote)) + if ($request->entityIsDeleted($quote)) { return $request->disallowUpdate(); + } $quote = $this->quote_repo->save($request->all(), $quote); @@ -516,31 +517,25 @@ class QuoteController extends BaseController * Download Invoice/s */ - if($action == 'download' && $quotes->count() > 1) - { - + if ($action == 'download' && $quotes->count() > 1) { $quotes->each(function ($quote) { - - if(auth()->user()->cannot('view', $quote)){ + if (auth()->user()->cannot('view', $quote)) { return response()->json(['message'=>'Insufficient privileges to access quote '. $quote->number]); } - }); ZipInvoices::dispatch($quotes, $quotes->first()->company, auth()->user()->email); - return response()->json(['message' => 'Email Sent!'],200); + return response()->json(['message' => 'Email Sent!'], 200); } /* * Send the other actions to the switch */ $quotes->each(function ($quote, $key) use ($action) { - if (auth()->user()->can('edit', $quote)) { $this->performAction($quote, $action, true); } - }); /* Need to understand which permission are required for the given bulk action ie. view / edit */ @@ -620,7 +615,8 @@ class QuoteController extends BaseController * */ - public function action(ActionQuoteRequest $request, Quote $quote, $action) { + public function action(ActionQuoteRequest $request, Quote $quote, $action) + { return $this->performAction($quote, $action); } @@ -642,8 +638,9 @@ class QuoteController extends BaseController break; case 'approve': //make sure it hasn't already been approved!! - if($quote->status_id != Quote::STATUS_SENT) + if ($quote->status_id != Quote::STATUS_SENT) { return response()->json(['message' => 'Unable to approve this quote as it has expired.'], 400); + } return $this->itemResponse($quote->service()->approve()->save()); break; @@ -679,23 +676,21 @@ class QuoteController extends BaseController if (!$bulk) { return $this->itemResponse($quote); } + // no break default: return response()->json(['message' => "The requested action `{$action}` is not available."], 400); break; } } - public function downloadPdf($invitation_key) + public function downloadPdf($invitation_key) { - $invitation = $this->quote_repo->getInvitationByKey($invitation_key); $contact = $invitation->contact; $quote = $invitation->quote; - $file_path = $quote->service()->getQuotePdf($contact); + $file_path = $quote->service()->getQuotePdf($contact); return response()->download($file_path); - } - } diff --git a/app/Http/Controllers/RecurringInvoiceController.php b/app/Http/Controllers/RecurringInvoiceController.php index a90a8d4e11..93ba9ea414 100644 --- a/app/Http/Controllers/RecurringInvoiceController.php +++ b/app/Http/Controllers/RecurringInvoiceController.php @@ -377,8 +377,9 @@ class RecurringInvoiceController extends BaseController */ public function update(UpdateRecurringInvoiceRequest $request, RecurringInvoice $recurring_invoice) { - if($request->entityIsDeleted($recurring_invoice)) + if ($request->entityIsDeleted($recurring_invoice)) { return $request->disallowUpdate(); + } $recurring_invoice = $this->recurring_invoice_repo->save($request->all(), $recurring_invoice); diff --git a/app/Http/Controllers/RecurringQuoteController.php b/app/Http/Controllers/RecurringQuoteController.php index 82ad2c48ee..c209f625c9 100644 --- a/app/Http/Controllers/RecurringQuoteController.php +++ b/app/Http/Controllers/RecurringQuoteController.php @@ -375,9 +375,9 @@ class RecurringQuoteController extends BaseController */ public function update(UpdateRecurringQuoteRequest $request, RecurringQuote $recurring_quote) { - - if($request->entityIsDeleted($recurring_quote)) + if ($request->entityIsDeleted($recurring_quote)) { return $request->disallowUpdate(); + } $recurring_quote = $this->recurring_quote_repo->save(request(), $recurring_quote); diff --git a/app/Http/Controllers/SelfUpdateController.php b/app/Http/Controllers/SelfUpdateController.php index f839ab56a2..6f955ccd0a 100644 --- a/app/Http/Controllers/SelfUpdateController.php +++ b/app/Http/Controllers/SelfUpdateController.php @@ -11,6 +11,7 @@ namespace App\Http\Controllers; +use App\Utils\Ninja; use Codedge\Updater\UpdaterManager; use Illuminate\Foundation\Bus\DispatchesJobs; use Illuminate\Support\Facades\Storage; @@ -21,7 +22,6 @@ class SelfUpdateController extends BaseController public function __construct() { - } /** @@ -58,18 +58,13 @@ class SelfUpdateController extends BaseController */ public function update(UpdaterManager $updater) { - - $res = $updater->update(); + if(Ninja::isNinja()) + return response()->json(['message' => 'Self update not available on this system.'], 403); - return response()->json(['message'=>$res], 200); - + $res = $updater->update(); + + return response()->json(['message'=>$res], 200); } - public function checkVersion(UpdaterManager $updater) - { - - - - } - -} \ No newline at end of file + +} diff --git a/app/Http/Controllers/SetupController.php b/app/Http/Controllers/SetupController.php index 321347b6b8..8c2150b0ef 100644 --- a/app/Http/Controllers/SetupController.php +++ b/app/Http/Controllers/SetupController.php @@ -17,49 +17,44 @@ use App\Utils\SystemHealth; use Illuminate\Http\Request; use Illuminate\Support\Facades\Artisan; - /** * Class SetupController */ class SetupController extends Controller { + public function index() + { + $system_health = SystemHealth::check(); - public function index() - { - - $system_health = SystemHealth::check(); - - return view(); - - } - - public function doSetup(StoreSetupRequest $request) - { + return view(); + } + public function doSetup(StoreSetupRequest $request) + { $_ENV['APP_URL'] = $request->input('url'); $_ENV['APP_DEBUG'] = $request->input('debug') ? 'true' : 'false'; $_ENV['REQUIRE_HTTPS'] = $request->input('https') ? 'true' : 'false'; - $_ENV['DB_TYPE'] = 'mysql'; + $_ENV['DB_TYPE'] = 'mysql'; $_ENV['DB_HOST1'] = $request->input('host'); $_ENV['DB_DATABASE1'] = $request->input('db_username'); $_ENV['DB_USERNAME1'] = $request->input('db_password'); $_ENV['DB_PASSWORD1'] = $request->input('db_password'); - $_ENV['MAIL_DRIVER'] = $request->input('mail_driver'); - $_ENV['MAIL_PORT'] = $request->input('port'); - $_ENV['MAIL_ENCRYPTION'] = $request->input('encryption'); - $_ENV['MAIL_HOST'] = $request->input('mail_host'); - $_ENV['MAIL_USERNAME'] = $request->input('mail_username'); - $_ENV['MAIL_FROM_NAME'] = $request->input('mail_name'); - $_ENV['MAIL_FROM_ADDRESS'] = $request->input('mail_address'); - $_ENV['MAIL_PASSWORD'] = $request->input('mail_password'); + $_ENV['MAIL_DRIVER'] = $request->input('mail_driver'); + $_ENV['MAIL_PORT'] = $request->input('port'); + $_ENV['MAIL_ENCRYPTION'] = $request->input('encryption'); + $_ENV['MAIL_HOST'] = $request->input('mail_host'); + $_ENV['MAIL_USERNAME'] = $request->input('mail_username'); + $_ENV['MAIL_FROM_NAME'] = $request->input('mail_name'); + $_ENV['MAIL_FROM_ADDRESS'] = $request->input('mail_address'); + $_ENV['MAIL_PASSWORD'] = $request->input('mail_password'); $_ENV['NINJA_ENVIRONMENT'] = 'selfhost'; - $_ENV['SELF_UPDATER_REPO_VENDOR'] = 'invoiceninja'; - $_ENV['SELF_UPDATER_REPO_NAME'] = 'invoiceninja'; - $_ENV['SELF_UPDATER_USE_BRANCH'] = 'v2'; - $_ENV['SELF_UPDATER_MAILTO_ADDRESS'] = $request->input('mail_address'); - $_ENV['SELF_UPDATER_MAILTO_NAME'] = $request->input('mail_name'); - $_ENV['DB_CONNECTION'] = 'db-ninja-01'; - $_ENV['APP_DEBUG'] = false; + $_ENV['SELF_UPDATER_REPO_VENDOR'] = 'invoiceninja'; + $_ENV['SELF_UPDATER_REPO_NAME'] = 'invoiceninja'; + $_ENV['SELF_UPDATER_USE_BRANCH'] = 'v2'; + $_ENV['SELF_UPDATER_MAILTO_ADDRESS'] = $request->input('mail_address'); + $_ENV['SELF_UPDATER_MAILTO_NAME'] = $request->input('mail_name'); + $_ENV['DB_CONNECTION'] = 'db-ninja-01'; + $_ENV['APP_DEBUG'] = false; $config = ''; @@ -82,11 +77,10 @@ class SetupController extends Controller Artisan::call('migrate'); Artisan::call('db:seed'); - if(Account::count() == 0) - $account = CreateAccount::dispatchNow($request->all()); + if (Account::count() == 0) { + $account = CreateAccount::dispatchNow($request->all()); + } return view('index.index'); - - } - -} \ No newline at end of file + } +} diff --git a/app/Http/Controllers/Support/Messages/SendingController.php b/app/Http/Controllers/Support/Messages/SendingController.php index 65b395d02c..e404c59abc 100644 --- a/app/Http/Controllers/Support/Messages/SendingController.php +++ b/app/Http/Controllers/Support/Messages/SendingController.php @@ -71,8 +71,9 @@ class SendingController extends Controller $send_logs = false; - if($request->has('send_logs')) + if ($request->has('send_logs')) { $send_logs = $request->input('send_logs'); + } Mail::to(config('ninja.contact.ninja_official_contact')) ->send(new SupportMessageSent($request->message, $send_logs)); diff --git a/app/Http/Controllers/Traits/VerifiesUserEmail.php b/app/Http/Controllers/Traits/VerifiesUserEmail.php index 0d6250f0d8..f4874860f2 100644 --- a/app/Http/Controllers/Traits/VerifiesUserEmail.php +++ b/app/Http/Controllers/Traits/VerifiesUserEmail.php @@ -29,7 +29,6 @@ trait VerifiesUserEmail */ public function confirm() { - if ($user = User::whereRaw("BINARY `confirmation_code`= ?", request()->route('confirmation_code'))->first()) { $user->email_verified_at = now(); $user->confirmation_code = null; diff --git a/app/Http/Controllers/UserController.php b/app/Http/Controllers/UserController.php index a386f6c15e..2abf72188f 100644 --- a/app/Http/Controllers/UserController.php +++ b/app/Http/Controllers/UserController.php @@ -501,15 +501,14 @@ class UserController extends BaseController */ public function bulk() { - $action = request()->input('action'); $ids = request()->input('ids'); $users = User::withTrashed()->find($this->transformKeys($ids)); - /* - * In case a user maliciously sends keys which do not belong to them, we push + /* + * In case a user maliciously sends keys which do not belong to them, we push * each user through the Policy sieve and only return users that they * have access to */ @@ -517,19 +516,14 @@ class UserController extends BaseController $return_user_collection = collect(); $users->each(function ($user, $key) use ($action, $return_user_collection) { - if (auth()->user()->can('edit', $user)) { - $user = $this->user_repo->{$action}($user); $return_user_collection->push($user->id); - } - }); return $this->listResponse(User::withTrashed()->whereIn('id', $return_user_collection)); - } @@ -589,13 +583,16 @@ class UserController extends BaseController { $company = auth()->user()->company(); - $user->companies()->attach($company->id, - array_merge($request->all(), + $user->companies()->attach( + $company->id, + array_merge( + $request->all(), [ 'account_id' => $company->account->id, 'notifications' => CompanySettings::notificationDefaults(), ] - )); + ) + ); $ct = CreateCompanyToken::dispatchNow($company, $user, 'User token created by'.auth()->user()->present()->name()); diff --git a/app/Http/Controllers/VendorController.php b/app/Http/Controllers/VendorController.php index 66dd50dc0a..16e8716651 100644 --- a/app/Http/Controllers/VendorController.php +++ b/app/Http/Controllers/VendorController.php @@ -267,8 +267,9 @@ class VendorController extends BaseController */ public function update(UpdateVendorRequest $request, Vendor $vendor) { - if($request->entityIsDeleted($vendor)) + if ($request->entityIsDeleted($vendor)) { return $request->disallowUpdate(); + } $vendor = $this->client_repo->save($request->all(), $vendor); diff --git a/app/Http/Middleware/PasswordProtection.php b/app/Http/Middleware/PasswordProtection.php index 9b4ec933f8..ce91d95313 100644 --- a/app/Http/Middleware/PasswordProtection.php +++ b/app/Http/Middleware/PasswordProtection.php @@ -40,7 +40,6 @@ class PasswordProtection return response()->json($error, 403); } } elseif (Cache::get(auth()->user()->email."_logged_in")) { - Cache::pull(auth()->user()->email."_logged_in"); Cache::add(auth()->user()->email."_logged_in", Str::random(64), now()->addMinutes(10)); diff --git a/app/Http/Middleware/QueryLogging.php b/app/Http/Middleware/QueryLogging.php index e7eb6f1bd0..110c927b5c 100644 --- a/app/Http/Middleware/QueryLogging.php +++ b/app/Http/Middleware/QueryLogging.php @@ -49,9 +49,8 @@ class QueryLogging $time = $timeEnd - $timeStart; Log::info($request->method() . ' - ' . $request->url() . ": $count queries - " . $time); - // if($count > 50) + // if($count > 50) // Log::info($queries); - } } diff --git a/app/Http/Middleware/SetInviteDb.php b/app/Http/Middleware/SetInviteDb.php index dec0b19913..1ed7301534 100644 --- a/app/Http/Middleware/SetInviteDb.php +++ b/app/Http/Middleware/SetInviteDb.php @@ -35,10 +35,11 @@ class SetInviteDb **/ $entity = null; - if(!$request->route('entity')) + if (!$request->route('entity')) { $entity = $request->segment(2); - else + } else { $entity = $request->route('entity'); + } if ($request->getSchemeAndHttpHost() && config('ninja.db.multi_db_enabled') && ! MultiDB::findAndSetDbByInvitation($entity, $request->route('invitation_key'))) { if (request()->json) { diff --git a/app/Http/Middleware/TokenAuth.php b/app/Http/Middleware/TokenAuth.php index 12de1235ba..bfa3169560 100644 --- a/app/Http/Middleware/TokenAuth.php +++ b/app/Http/Middleware/TokenAuth.php @@ -28,7 +28,6 @@ class TokenAuth public function handle($request, Closure $next) { if ($request->header('X-API-TOKEN') && ($company_token = CompanyToken::with(['user','company'])->whereRaw("BINARY `token`= ?", [$request->header('X-API-TOKEN')])->first())) { - $user = $company_token->user; $error = [ @@ -51,8 +50,8 @@ class TokenAuth config(['ninja.company_id' => $company_token->company->id]); - app('queue')->createPayloadUsing(function () use($company_token) { - return ['db' => $company_token->company->db]; + app('queue')->createPayloadUsing(function () use ($company_token) { + return ['db' => $company_token->company->db]; }); //user who once existed, but has been soft deleted diff --git a/app/Http/Requests/Client/StoreClientRequest.php b/app/Http/Requests/Client/StoreClientRequest.php index c6cf31a001..540d7eedf1 100644 --- a/app/Http/Requests/Client/StoreClientRequest.php +++ b/app/Http/Requests/Client/StoreClientRequest.php @@ -69,72 +69,56 @@ class StoreClientRequest extends Request protected function prepareForValidation() { - $input = $this->all(); //@todo implement feature permissions for > 100 clients // $settings = ClientSettings::defaults(); - if(array_key_exists('settings', $input) && !empty($input['settings'])) - { - - foreach($input['settings'] as $key => $value) - { + if (array_key_exists('settings', $input) && !empty($input['settings'])) { + foreach ($input['settings'] as $key => $value) { $settings->{$key} = $value; } - - } + } //is no settings->currency_id is set then lets dive in and find either a group or company currency all the below may be redundant!! - if(!property_exists($settings, 'currency_id') && isset($input['group_settings_id'])) - { - + if (!property_exists($settings, 'currency_id') && isset($input['group_settings_id'])) { $input['group_settings_id'] = $this->decodePrimaryKey($input['group_settings_id']); $group_settings = GroupSetting::find($input['group_settings_id']); - if($group_settings && property_exists($group_settings->settings, 'currency_id') && isset($group_settings->settings->currency_id)) + if ($group_settings && property_exists($group_settings->settings, 'currency_id') && isset($group_settings->settings->currency_id)) { $settings->currency_id = (string)$group_settings->settings->currency_id; - else + } else { $settings->currency_id = (string)auth()->user()->company()->settings->currency_id; - - } - elseif(!property_exists($settings, 'currency_id')) - { + } + } elseif (!property_exists($settings, 'currency_id')) { $settings->currency_id = (string)auth()->user()->company()->settings->currency_id; } $input['settings'] = $settings; - if(isset($input['contacts'])) - { - foreach($input['contacts'] as $key => $contact) - { - if(array_key_exists('id', $contact) && is_numeric($contact['id'])) + if (isset($input['contacts'])) { + foreach ($input['contacts'] as $key => $contact) { + if (array_key_exists('id', $contact) && is_numeric($contact['id'])) { unset($input['contacts'][$key]['id']); - elseif(array_key_exists('id', $contact) && is_string($contact['id'])) + } elseif (array_key_exists('id', $contact) && is_string($contact['id'])) { $input['contacts'][$key]['id'] = $this->decodePrimaryKey($contact['id']); + } //Filter the client contact password - if it is sent with ***** we should ignore it! - if(isset($contact['password'])) - { - - if(strlen($contact['password']) == 0){ + if (isset($contact['password'])) { + if (strlen($contact['password']) == 0) { $input['contacts'][$key]['password'] = ''; - } - else { + } else { $contact['password'] = str_replace("*", "", $contact['password']); - if(strlen($contact['password']) == 0){ + if (strlen($contact['password']) == 0) { unset($input['contacts'][$key]['password']); } - } - } - } } diff --git a/app/Http/Requests/Client/UpdateClientRequest.php b/app/Http/Requests/Client/UpdateClientRequest.php index 2b60e7dd06..9aefe6f465 100644 --- a/app/Http/Requests/Client/UpdateClientRequest.php +++ b/app/Http/Requests/Client/UpdateClientRequest.php @@ -80,34 +80,27 @@ class UpdateClientRequest extends Request $input['group_settings_id'] = $this->decodePrimaryKey($input['group_settings_id']); } - if(isset($input['contacts'])) - { - foreach($input['contacts'] as $key => $contact) - { - if(array_key_exists('id', $contact) && is_numeric($contact['id'])) + if (isset($input['contacts'])) { + foreach ($input['contacts'] as $key => $contact) { + if (array_key_exists('id', $contact) && is_numeric($contact['id'])) { unset($input['contacts'][$key]['id']); - elseif(array_key_exists('id', $contact) && is_string($contact['id'])) + } elseif (array_key_exists('id', $contact) && is_string($contact['id'])) { $input['contacts'][$key]['id'] = $this->decodePrimaryKey($contact['id']); + } //Filter the client contact password - if it is sent with ***** we should ignore it! - if(isset($contact['password'])) - { - - if(strlen($contact['password']) == 0){ + if (isset($contact['password'])) { + if (strlen($contact['password']) == 0) { $input['contacts'][$key]['password'] = ''; - } - else { + } else { $contact['password'] = str_replace("*", "", $contact['password']); - if(strlen($contact['password']) == 0){ + if (strlen($contact['password']) == 0) { unset($input['contacts'][$key]['password']); } - } - } - } } $this->replace($input); diff --git a/app/Http/Requests/Company/StoreCompanyRequest.php b/app/Http/Requests/Company/StoreCompanyRequest.php index 69bc29b31a..9766aa3050 100644 --- a/app/Http/Requests/Company/StoreCompanyRequest.php +++ b/app/Http/Requests/Company/StoreCompanyRequest.php @@ -52,19 +52,14 @@ class StoreCompanyRequest extends Request protected function prepareForValidation() { - $input = $this->all(); $company_settings = CompanySettings::defaults(); - if(array_key_exists('settings', $input) && !empty($input['settings'])) - { - - foreach($input['settings'] as $key => $value) - { + if (array_key_exists('settings', $input) && !empty($input['settings'])) { + foreach ($input['settings'] as $key => $value) { $company_settings->{$key} = $value; } - } // $company_settings->invoice_design_id = $this->encodePrimaryKey(1); diff --git a/app/Http/Requests/Company/UpdateCompanyRequest.php b/app/Http/Requests/Company/UpdateCompanyRequest.php index 4c87e45824..56c1053888 100644 --- a/app/Http/Requests/Company/UpdateCompanyRequest.php +++ b/app/Http/Requests/Company/UpdateCompanyRequest.php @@ -52,7 +52,5 @@ class UpdateCompanyRequest extends Request protected function prepareForValidation() { - } - } diff --git a/app/Http/Requests/CompanyUser/UpdateCompanyUserRequest.php b/app/Http/Requests/CompanyUser/UpdateCompanyUserRequest.php index 9f11d99f20..97aafe8390 100644 --- a/app/Http/Requests/CompanyUser/UpdateCompanyUserRequest.php +++ b/app/Http/Requests/CompanyUser/UpdateCompanyUserRequest.php @@ -38,5 +38,4 @@ class UpdateCompanyUserRequest extends Request { return []; } - } diff --git a/app/Http/Requests/Credit/StoreCreditRequest.php b/app/Http/Requests/Credit/StoreCreditRequest.php index 0221efdfea..be3a7c4c64 100644 --- a/app/Http/Requests/Credit/StoreCreditRequest.php +++ b/app/Http/Requests/Credit/StoreCreditRequest.php @@ -40,41 +40,36 @@ class StoreCreditRequest extends FormRequest { $input = $this->all(); - if(array_key_exists('design_id', $input) && is_string($input['design_id'])) - $input['design_id'] = $this->decodePrimaryKey($input['design_id']); - - if($input['client_id']) - $input['client_id'] = $this->decodePrimaryKey($input['client_id']); - - if(isset($input['client_contacts'])) - { - foreach($input['client_contacts'] as $key => $contact) - { - if(!array_key_exists('send_email', $contact) || !array_key_exists('id', $contact)) - { - unset($input['client_contacts'][$key]); - } - } - + if (array_key_exists('design_id', $input) && is_string($input['design_id'])) { + $input['design_id'] = $this->decodePrimaryKey($input['design_id']); } - if(isset($input['invitations'])) - { + if ($input['client_id']) { + $input['client_id'] = $this->decodePrimaryKey($input['client_id']); + } - foreach($input['invitations'] as $key => $value) - { + if (isset($input['client_contacts'])) { + foreach ($input['client_contacts'] as $key => $contact) { + if (!array_key_exists('send_email', $contact) || !array_key_exists('id', $contact)) { + unset($input['client_contacts'][$key]); + } + } + } - if(isset($input['invitations'][$key]['id']) && is_numeric($input['invitations'][$key]['id'])) - unset($input['invitations'][$key]['id']); + if (isset($input['invitations'])) { + foreach ($input['invitations'] as $key => $value) { + if (isset($input['invitations'][$key]['id']) && is_numeric($input['invitations'][$key]['id'])) { + unset($input['invitations'][$key]['id']); + } - if(isset($input['invitations'][$key]['id']) && is_string($input['invitations'][$key]['id'])) - $input['invitations'][$key]['id'] = $this->decodePrimaryKey($input['invitations'][$key]['id']); - - if(is_string($input['invitations'][$key]['client_contact_id'])) - $input['invitations'][$key]['client_contact_id'] = $this->decodePrimaryKey($input['invitations'][$key]['client_contact_id']); - - } + if (isset($input['invitations'][$key]['id']) && is_string($input['invitations'][$key]['id'])) { + $input['invitations'][$key]['id'] = $this->decodePrimaryKey($input['invitations'][$key]['id']); + } + if (is_string($input['invitations'][$key]['client_contact_id'])) { + $input['invitations'][$key]['client_contact_id'] = $this->decodePrimaryKey($input['invitations'][$key]['client_contact_id']); + } + } } $input['line_items'] = isset($input['line_items']) ? $this->cleanItems($input['line_items']) : []; diff --git a/app/Http/Requests/Credit/UpdateCreditRequest.php b/app/Http/Requests/Credit/UpdateCreditRequest.php index bffd24dc7c..3179d235a3 100644 --- a/app/Http/Requests/Credit/UpdateCreditRequest.php +++ b/app/Http/Requests/Credit/UpdateCreditRequest.php @@ -42,30 +42,28 @@ class UpdateCreditRequest extends FormRequest { $input = $this->all(); - if(array_key_exists('design_id', $input) && is_string($input['design_id'])) - $input['design_id'] = $this->decodePrimaryKey($input['design_id']); + if (array_key_exists('design_id', $input) && is_string($input['design_id'])) { + $input['design_id'] = $this->decodePrimaryKey($input['design_id']); + } if (isset($input['client_id'])) { $input['client_id'] = $this->decodePrimaryKey($input['client_id']); } - if(isset($input['invitations'])) - { + if (isset($input['invitations'])) { + foreach ($input['invitations'] as $key => $value) { + if (is_numeric($input['invitations'][$key]['id'])) { + unset($input['invitations'][$key]['id']); + } - foreach($input['invitations'] as $key => $value) - { - - if(is_numeric($input['invitations'][$key]['id'])) - unset($input['invitations'][$key]['id']); - - if(is_string($input['invitations'][$key]['id'])) - $input['invitations'][$key]['id'] = $this->decodePrimaryKey($input['invitations'][$key]['id']); - - if(is_string($input['invitations'][$key]['client_contact_id'])) - $input['invitations'][$key]['client_contact_id'] = $this->decodePrimaryKey($input['invitations'][$key]['client_contact_id']); - - } + if (is_string($input['invitations'][$key]['id'])) { + $input['invitations'][$key]['id'] = $this->decodePrimaryKey($input['invitations'][$key]['id']); + } + if (is_string($input['invitations'][$key]['client_contact_id'])) { + $input['invitations'][$key]['client_contact_id'] = $this->decodePrimaryKey($input['invitations'][$key]['client_contact_id']); + } + } } $input['line_items'] = isset($input['line_items']) ? $this->cleanItems($input['line_items']) : []; diff --git a/app/Http/Requests/Design/StoreDesignRequest.php b/app/Http/Requests/Design/StoreDesignRequest.php index f186fbf6c8..587d98c3ff 100644 --- a/app/Http/Requests/Design/StoreDesignRequest.php +++ b/app/Http/Requests/Design/StoreDesignRequest.php @@ -40,11 +40,13 @@ class StoreDesignRequest extends Request { $input = $this->all(); - if(!array_key_exists('product', $input['design']) || is_null($input['design']['product'])) - $input['design']['product'] = ''; + if (!array_key_exists('product', $input['design']) || is_null($input['design']['product'])) { + $input['design']['product'] = ''; + } - if(!array_key_exists('task', $input['design']) || is_null($input['design']['task'])) - $input['design']['task'] = ''; + if (!array_key_exists('task', $input['design']) || is_null($input['design']['task'])) { + $input['design']['task'] = ''; + } $this->replace($input); } diff --git a/app/Http/Requests/Design/UpdateDesignRequest.php b/app/Http/Requests/Design/UpdateDesignRequest.php index 51ad03927b..d08fabf743 100644 --- a/app/Http/Requests/Design/UpdateDesignRequest.php +++ b/app/Http/Requests/Design/UpdateDesignRequest.php @@ -35,15 +35,17 @@ class UpdateDesignRequest extends Request return []; } - protected function prepareForValidation() + protected function prepareForValidation() { $input = $this->all(); - if(!array_key_exists('product', $input['design']) || is_null($input['design']['product'])) - $input['design']['product'] = ''; + if (!array_key_exists('product', $input['design']) || is_null($input['design']['product'])) { + $input['design']['product'] = ''; + } - if(!array_key_exists('task', $input['design']) || is_null($input['design']['task'])) - $input['design']['task'] = ''; + if (!array_key_exists('task', $input['design']) || is_null($input['design']['task'])) { + $input['design']['task'] = ''; + } $this->replace($input); } diff --git a/app/Http/Requests/GroupSetting/StoreGroupSettingRequest.php b/app/Http/Requests/GroupSetting/StoreGroupSettingRequest.php index f8d2a02f24..32cdfe87d8 100644 --- a/app/Http/Requests/GroupSetting/StoreGroupSettingRequest.php +++ b/app/Http/Requests/GroupSetting/StoreGroupSettingRequest.php @@ -44,14 +44,10 @@ class StoreGroupSettingRequest extends Request $group_settings = ClientSettings::defaults(); - if(array_key_exists('settings', $input) && !empty($input['settings'])) - { - - foreach($input['settings'] as $key => $value) - { + if (array_key_exists('settings', $input) && !empty($input['settings'])) { + foreach ($input['settings'] as $key => $value) { $group_settings->{$key} = $value; } - } $input['settings'] = $group_settings; diff --git a/app/Http/Requests/Invoice/EditInvoiceRequest.php b/app/Http/Requests/Invoice/EditInvoiceRequest.php index 35fc0212f0..03809bb7ae 100644 --- a/app/Http/Requests/Invoice/EditInvoiceRequest.php +++ b/app/Http/Requests/Invoice/EditInvoiceRequest.php @@ -26,5 +26,4 @@ class EditInvoiceRequest extends Request { return auth()->user()->can('edit', $this->invoice); } - } diff --git a/app/Http/Requests/Invoice/StoreInvoiceRequest.php b/app/Http/Requests/Invoice/StoreInvoiceRequest.php index a67de19d98..966219a83f 100644 --- a/app/Http/Requests/Invoice/StoreInvoiceRequest.php +++ b/app/Http/Requests/Invoice/StoreInvoiceRequest.php @@ -46,41 +46,36 @@ class StoreInvoiceRequest extends Request { $input = $this->all(); - if(array_key_exists('design_id', $input) && is_string($input['design_id'])) - $input['design_id'] = $this->decodePrimaryKey($input['design_id']); - - if(array_key_exists('client_id', $input) && is_string($input['client_id'])) - $input['client_id'] = $this->decodePrimaryKey($input['client_id']); - - if(isset($input['client_contacts'])) - { - foreach($input['client_contacts'] as $key => $contact) - { - if(!array_key_exists('send_email', $contact) || !array_key_exists('id', $contact)) - { - unset($input['client_contacts'][$key]); - } - } - + if (array_key_exists('design_id', $input) && is_string($input['design_id'])) { + $input['design_id'] = $this->decodePrimaryKey($input['design_id']); } - if(isset($input['invitations'])) - { + if (array_key_exists('client_id', $input) && is_string($input['client_id'])) { + $input['client_id'] = $this->decodePrimaryKey($input['client_id']); + } - foreach($input['invitations'] as $key => $value) - { + if (isset($input['client_contacts'])) { + foreach ($input['client_contacts'] as $key => $contact) { + if (!array_key_exists('send_email', $contact) || !array_key_exists('id', $contact)) { + unset($input['client_contacts'][$key]); + } + } + } - if(isset($input['invitations'][$key]['id']) && is_numeric($input['invitations'][$key]['id'])) - unset($input['invitations'][$key]['id']); + if (isset($input['invitations'])) { + foreach ($input['invitations'] as $key => $value) { + if (isset($input['invitations'][$key]['id']) && is_numeric($input['invitations'][$key]['id'])) { + unset($input['invitations'][$key]['id']); + } - if(isset($input['invitations'][$key]['id']) && is_string($input['invitations'][$key]['id'])) - $input['invitations'][$key]['id'] = $this->decodePrimaryKey($input['invitations'][$key]['id']); - - if(is_string($input['invitations'][$key]['client_contact_id'])) - $input['invitations'][$key]['client_contact_id'] = $this->decodePrimaryKey($input['invitations'][$key]['client_contact_id']); - - } + if (isset($input['invitations'][$key]['id']) && is_string($input['invitations'][$key]['id'])) { + $input['invitations'][$key]['id'] = $this->decodePrimaryKey($input['invitations'][$key]['id']); + } + if (is_string($input['invitations'][$key]['client_contact_id'])) { + $input['invitations'][$key]['client_contact_id'] = $this->decodePrimaryKey($input['invitations'][$key]['client_contact_id']); + } + } } $input['line_items'] = isset($input['line_items']) ? $this->cleanItems($input['line_items']) : []; diff --git a/app/Http/Requests/Invoice/UpdateInvoiceRequest.php b/app/Http/Requests/Invoice/UpdateInvoiceRequest.php index 62b563eba0..8278d9934a 100644 --- a/app/Http/Requests/Invoice/UpdateInvoiceRequest.php +++ b/app/Http/Requests/Invoice/UpdateInvoiceRequest.php @@ -49,30 +49,28 @@ class UpdateInvoiceRequest extends Request { $input = $this->all(); - if(array_key_exists('design_id', $input) && is_string($input['design_id'])) - $input['design_id'] = $this->decodePrimaryKey($input['design_id']); + if (array_key_exists('design_id', $input) && is_string($input['design_id'])) { + $input['design_id'] = $this->decodePrimaryKey($input['design_id']); + } if (isset($input['client_id'])) { $input['client_id'] = $this->decodePrimaryKey($input['client_id']); } - if(isset($input['invitations'])) - { + if (isset($input['invitations'])) { + foreach ($input['invitations'] as $key => $value) { + if (is_numeric($input['invitations'][$key]['id'])) { + unset($input['invitations'][$key]['id']); + } - foreach($input['invitations'] as $key => $value) - { - - if(is_numeric($input['invitations'][$key]['id'])) - unset($input['invitations'][$key]['id']); - - if(is_string($input['invitations'][$key]['id'])) - $input['invitations'][$key]['id'] = $this->decodePrimaryKey($input['invitations'][$key]['id']); - - if(is_string($input['invitations'][$key]['client_contact_id'])) - $input['invitations'][$key]['client_contact_id'] = $this->decodePrimaryKey($input['invitations'][$key]['client_contact_id']); - - } + if (is_string($input['invitations'][$key]['id'])) { + $input['invitations'][$key]['id'] = $this->decodePrimaryKey($input['invitations'][$key]['id']); + } + if (is_string($input['invitations'][$key]['client_contact_id'])) { + $input['invitations'][$key]['client_contact_id'] = $this->decodePrimaryKey($input['invitations'][$key]['client_contact_id']); + } + } } $input['line_items'] = isset($input['line_items']) ? $this->cleanItems($input['line_items']) : []; diff --git a/app/Http/Requests/Migration/UploadMigrationFileRequest.php b/app/Http/Requests/Migration/UploadMigrationFileRequest.php index b0c159a3d0..f630f9e991 100644 --- a/app/Http/Requests/Migration/UploadMigrationFileRequest.php +++ b/app/Http/Requests/Migration/UploadMigrationFileRequest.php @@ -28,7 +28,7 @@ class UploadMigrationFileRequest extends FormRequest ]; /** We'll skip mime validation while running tests. */ - if(app()->environment() !== 'testing') { + if (app()->environment() !== 'testing') { $rules['migration'] = ['required', 'file', 'mimes:zip']; } diff --git a/app/Http/Requests/Payment/RefundPaymentRequest.php b/app/Http/Requests/Payment/RefundPaymentRequest.php index e040f70eb9..6f56730ef1 100644 --- a/app/Http/Requests/Payment/RefundPaymentRequest.php +++ b/app/Http/Requests/Payment/RefundPaymentRequest.php @@ -19,7 +19,7 @@ use App\Utils\Traits\MakesHash; class RefundPaymentRequest extends Request { - use MakesHash; + use MakesHash; /** * Determine if the user is authorized to make this request. * @@ -33,35 +33,33 @@ class RefundPaymentRequest extends Request protected function prepareForValidation() { - $input = $this->all(); - if(!isset($input['gateway_refund'])) - $input['gateway_refund'] = false; + if (!isset($input['gateway_refund'])) { + $input['gateway_refund'] = false; + } - if(!isset($input['send_email'])) + if (!isset($input['send_email'])) { $input['send_email'] = false; + } - if(isset($input['id'])) - $input['id'] = $this->decodePrimaryKey($input['id']); + if (isset($input['id'])) { + $input['id'] = $this->decodePrimaryKey($input['id']); + } - if(isset($input['invoices'])) - { - - foreach($input['invoices'] as $key => $invoice) + if (isset($input['invoices'])) { + foreach ($input['invoices'] as $key => $invoice) { $input['invoices'][$key]['invoice_id'] = $this->decodePrimaryKey($invoice['invoice_id']); - + } } - if(isset($input['credits'])) - { + if (isset($input['credits'])) { unset($input['credits']); - // foreach($input['credits'] as $key => $credit) + // foreach($input['credits'] as $key => $credit) // $input['credits'][$key]['credit_id'] = $this->decodePrimaryKey($credit['credit_id']); - } - $this->replace($input); + $this->replace($input); } public function rules() diff --git a/app/Http/Requests/Payment/StorePaymentRequest.php b/app/Http/Requests/Payment/StorePaymentRequest.php index 82c36a297c..2458e5aceb 100644 --- a/app/Http/Requests/Payment/StorePaymentRequest.php +++ b/app/Http/Requests/Payment/StorePaymentRequest.php @@ -46,7 +46,6 @@ class StorePaymentRequest extends Request } if (isset($input['invoices']) && is_array($input['invoices']) !== false) { - foreach ($input['invoices'] as $key => $value) { $input['invoices'][$key]['invoice_id'] = $this->decodePrimaryKey($value['invoice_id']); $invoices_total += $value['amount']; @@ -61,9 +60,7 @@ class StorePaymentRequest extends Request if (isset($input['credits']) && is_array($input['credits']) !== false) { foreach ($input['credits'] as $key => $value) { - - if(array_key_exists('credit_id', $input['credits'][$key])) - { + if (array_key_exists('credit_id', $input['credits'][$key])) { $input['credits'][$key]['credit_id'] = $this->decodePrimaryKey($value['credit_id']); $credits_total += $value['amount']; } @@ -74,7 +71,7 @@ class StorePaymentRequest extends Request $input['credits'] = null; } - if(!isset($input['amount']) || $input['amount'] == 0){ + if (!isset($input['amount']) || $input['amount'] == 0) { $input['amount'] = $invoices_total - $credits_total; } diff --git a/app/Http/Requests/Payment/UpdatePaymentRequest.php b/app/Http/Requests/Payment/UpdatePaymentRequest.php index 0c716b90a8..7ea172cf2c 100644 --- a/app/Http/Requests/Payment/UpdatePaymentRequest.php +++ b/app/Http/Requests/Payment/UpdatePaymentRequest.php @@ -46,23 +46,29 @@ class UpdatePaymentRequest extends Request { $input = $this->all(); - if(isset($input['client_id'])) + if (isset($input['client_id'])) { unset($input['client_id']); + } - if(isset($input['amount'])) + if (isset($input['amount'])) { unset($input['amount']); + } - if(isset($input['type_id'])) + if (isset($input['type_id'])) { unset($input['type_id']); + } - if(isset($input['date'])) + if (isset($input['date'])) { unset($input['date']); + } - if(isset($input['transaction_reference'])) + if (isset($input['transaction_reference'])) { unset($input['transaction_reference']); + } - if(isset($input['number'])) + if (isset($input['number'])) { unset($input['number']); + } if (isset($input['invoices']) && is_array($input['invoices']) !== false) { foreach ($input['invoices'] as $key => $value) { diff --git a/app/Http/Requests/Quote/EditQuoteRequest.php b/app/Http/Requests/Quote/EditQuoteRequest.php index 82afcd3a82..5fbb75b281 100644 --- a/app/Http/Requests/Quote/EditQuoteRequest.php +++ b/app/Http/Requests/Quote/EditQuoteRequest.php @@ -26,6 +26,4 @@ class EditQuoteRequest extends Request { return auth()->user()->can('edit', $this->quote); } - - } diff --git a/app/Http/Requests/Quote/StoreQuoteRequest.php b/app/Http/Requests/Quote/StoreQuoteRequest.php index 6b96176381..d18b16155f 100644 --- a/app/Http/Requests/Quote/StoreQuoteRequest.php +++ b/app/Http/Requests/Quote/StoreQuoteRequest.php @@ -32,45 +32,40 @@ class StoreQuoteRequest extends Request return auth()->user()->can('create', Quote::class); } -protected function prepareForValidation() + protected function prepareForValidation() { $input = $this->all(); - if(array_key_exists('design_id', $input) && is_string($input['design_id'])) - $input['design_id'] = $this->decodePrimaryKey($input['design_id']); + if (array_key_exists('design_id', $input) && is_string($input['design_id'])) { + $input['design_id'] = $this->decodePrimaryKey($input['design_id']); + } - if($input['client_id']) - $input['client_id'] = $this->decodePrimaryKey($input['client_id']); - - if(isset($input['client_contacts'])) - { - foreach($input['client_contacts'] as $key => $contact) - { - if(!array_key_exists('send_email', $contact) || !array_key_exists('id', $contact)) - { - unset($input['client_contacts'][$key]); - } - } - + if ($input['client_id']) { + $input['client_id'] = $this->decodePrimaryKey($input['client_id']); } - if(isset($input['invitations'])) - { + if (isset($input['client_contacts'])) { + foreach ($input['client_contacts'] as $key => $contact) { + if (!array_key_exists('send_email', $contact) || !array_key_exists('id', $contact)) { + unset($input['client_contacts'][$key]); + } + } + } - foreach($input['invitations'] as $key => $value) - { + if (isset($input['invitations'])) { + foreach ($input['invitations'] as $key => $value) { + if (isset($input['invitations'][$key]['id']) && is_numeric($input['invitations'][$key]['id'])) { + unset($input['invitations'][$key]['id']); + } - if(isset($input['invitations'][$key]['id']) && is_numeric($input['invitations'][$key]['id'])) - unset($input['invitations'][$key]['id']); - - if(isset($input['invitations'][$key]['id']) && is_string($input['invitations'][$key]['id'])) - $input['invitations'][$key]['id'] = $this->decodePrimaryKey($input['invitations'][$key]['id']); - - if(is_string($input['invitations'][$key]['client_contact_id'])) - $input['invitations'][$key]['client_contact_id'] = $this->decodePrimaryKey($input['invitations'][$key]['client_contact_id']); - - } + if (isset($input['invitations'][$key]['id']) && is_string($input['invitations'][$key]['id'])) { + $input['invitations'][$key]['id'] = $this->decodePrimaryKey($input['invitations'][$key]['id']); + } + if (is_string($input['invitations'][$key]['client_contact_id'])) { + $input['invitations'][$key]['client_contact_id'] = $this->decodePrimaryKey($input['invitations'][$key]['client_contact_id']); + } + } } $input['line_items'] = isset($input['line_items']) ? $this->cleanItems($input['line_items']) : []; @@ -86,4 +81,3 @@ protected function prepareForValidation() ]; } } - diff --git a/app/Http/Requests/Quote/UpdateQuoteRequest.php b/app/Http/Requests/Quote/UpdateQuoteRequest.php index f1465f64b6..82c17ffb61 100644 --- a/app/Http/Requests/Quote/UpdateQuoteRequest.php +++ b/app/Http/Requests/Quote/UpdateQuoteRequest.php @@ -47,8 +47,9 @@ class UpdateQuoteRequest extends Request { $input = $this->all(); - if(array_key_exists('design_id', $input) && is_string($input['design_id'])) - $input['design_id'] = $this->decodePrimaryKey($input['design_id']); + if (array_key_exists('design_id', $input) && is_string($input['design_id'])) { + $input['design_id'] = $this->decodePrimaryKey($input['design_id']); + } if (isset($input['client_id'])) { $input['client_id'] = $this->decodePrimaryKey($input['client_id']); diff --git a/app/Http/Requests/RecurringInvoice/StoreRecurringInvoiceRequest.php b/app/Http/Requests/RecurringInvoice/StoreRecurringInvoiceRequest.php index 7f1f565a1e..c3f7903d17 100644 --- a/app/Http/Requests/RecurringInvoice/StoreRecurringInvoiceRequest.php +++ b/app/Http/Requests/RecurringInvoice/StoreRecurringInvoiceRequest.php @@ -45,8 +45,9 @@ class StoreRecurringInvoiceRequest extends Request { $input = $this->all(); - if($input['client_id']) + if ($input['client_id']) { $input['client_id'] = $this->decodePrimaryKey($input['client_id']); + } $input['line_items'] = isset($input['line_items']) ? $this->cleanItems($input['line_items']) : []; //$input['line_items'] = json_encode($input['line_items']); diff --git a/app/Http/Requests/RecurringInvoice/UpdateRecurringInvoiceRequest.php b/app/Http/Requests/RecurringInvoice/UpdateRecurringInvoiceRequest.php index 4283da8b37..138ca1eb0a 100644 --- a/app/Http/Requests/RecurringInvoice/UpdateRecurringInvoiceRequest.php +++ b/app/Http/Requests/RecurringInvoice/UpdateRecurringInvoiceRequest.php @@ -49,6 +49,4 @@ class UpdateRecurringInvoiceRequest extends Request //$input['line_items'] = json_encode($input['line_items']); $this->replace($input); } - - } diff --git a/app/Http/Requests/RecurringQuote/StoreRecurringQuoteRequest.php b/app/Http/Requests/RecurringQuote/StoreRecurringQuoteRequest.php index ef0e777dd0..d1713f4d9f 100644 --- a/app/Http/Requests/RecurringQuote/StoreRecurringQuoteRequest.php +++ b/app/Http/Requests/RecurringQuote/StoreRecurringQuoteRequest.php @@ -45,12 +45,12 @@ class StoreRecurringQuoteRequest extends Request { $input = $this->all(); - if($input['client_id']) + if ($input['client_id']) { $input['client_id'] = $this->decodePrimaryKey($input['client_id']); + } $input['line_items'] = isset($input['line_items']) ? $this->cleanItems($input['line_items']) : []; //$input['line_items'] = json_encode($input['line_items']); $this->replace($input); } - } diff --git a/app/Http/Requests/RecurringQuote/UpdateRecurringQuoteRequest.php b/app/Http/Requests/RecurringQuote/UpdateRecurringQuoteRequest.php index fa7e9cfae6..4b957ebb65 100644 --- a/app/Http/Requests/RecurringQuote/UpdateRecurringQuoteRequest.php +++ b/app/Http/Requests/RecurringQuote/UpdateRecurringQuoteRequest.php @@ -48,5 +48,4 @@ class UpdateRecurringQuoteRequest extends Request $input['line_items'] = isset($input['line_items']) ? $this->cleanItems($input['line_items']) : []; $this->replace($input); } - } diff --git a/app/Http/Requests/Setup/StoreSetupRequest.php b/app/Http/Requests/Setup/StoreSetupRequest.php index 8876208a56..26616f9461 100644 --- a/app/Http/Requests/Setup/StoreSetupRequest.php +++ b/app/Http/Requests/Setup/StoreSetupRequest.php @@ -29,7 +29,7 @@ class StoreSetupRequest extends Request public function rules() { - return [ + return [ /*System*/ 'url' => 'required', 'debug' => 'required', @@ -61,8 +61,8 @@ class StoreSetupRequest extends Request { $input = $this->all(); - $input['user_agent'] = request()->server('HTTP_USER_AGENT'); + $input['user_agent'] = request()->server('HTTP_USER_AGENT'); $this->replace($input); } -} \ No newline at end of file +} diff --git a/app/Http/Requests/User/UpdateUserRequest.php b/app/Http/Requests/User/UpdateUserRequest.php index 34d3d42855..580bdeef76 100644 --- a/app/Http/Requests/User/UpdateUserRequest.php +++ b/app/Http/Requests/User/UpdateUserRequest.php @@ -44,8 +44,9 @@ class UpdateUserRequest extends Request { $input = $this->all(); - if (isset($input['company_user']) && !auth()->user()->isAdmin()) + if (isset($input['company_user']) && !auth()->user()->isAdmin()) { unset($input['company_user']); + } $this->replace($input); diff --git a/app/Http/ValidationRules/Company/ValidCompanyQuantity.php b/app/Http/ValidationRules/Company/ValidCompanyQuantity.php index fe0a754f95..b27741f4b2 100644 --- a/app/Http/ValidationRules/Company/ValidCompanyQuantity.php +++ b/app/Http/ValidationRules/Company/ValidCompanyQuantity.php @@ -27,9 +27,7 @@ class ValidCompanyQuantity implements Rule */ public function passes($attribute, $value) { - return auth()->user()->company()->account->companies->count() <= 10; - } /** @@ -39,6 +37,4 @@ class ValidCompanyQuantity implements Rule { return "Limit of 10 companies per account."; } - - } diff --git a/app/Http/ValidationRules/Payment/ValidInvoicesRules.php b/app/Http/ValidationRules/Payment/ValidInvoicesRules.php index 5996dde590..69644dcc8b 100644 --- a/app/Http/ValidationRules/Payment/ValidInvoicesRules.php +++ b/app/Http/ValidationRules/Payment/ValidInvoicesRules.php @@ -44,47 +44,41 @@ class ValidInvoicesRules implements Rule public function passes($attribute, $value) { - - return $this->checkInvoicesAreHomogenous(); - + return $this->checkInvoicesAreHomogenous(); } private function checkInvoicesAreHomogenous() { - - if(!array_key_exists('client_id', $this->input)){ + if (!array_key_exists('client_id', $this->input)) { $this->error_msg = "Client id is required"; return false; } $unique_array = []; - foreach($this->input['invoices'] as $invoice) - { - $unique_array[] = $invoice['invoice_id']; + foreach ($this->input['invoices'] as $invoice) { + $unique_array[] = $invoice['invoice_id']; $inv = Invoice::whereId($invoice['invoice_id'])->first(); - if(!$inv){ + if (!$inv) { $this->error_msg = "Invoice not found "; return false; } - if($inv->client_id != $this->input['client_id']){ + if ($inv->client_id != $this->input['client_id']) { $this->error_msg = "Selected invoices are not from a single client"; - return false; + return false; } - } + } - if(!(array_unique($unique_array) == $unique_array)) - { + if (!(array_unique($unique_array) == $unique_array)) { $this->error_msg = "Duplicate invoices submitted."; return false; } return true; - } @@ -95,6 +89,4 @@ class ValidInvoicesRules implements Rule { return $this->error_msg; } - - } diff --git a/app/Http/ValidationRules/Payment/ValidRefundableRequest.php b/app/Http/ValidationRules/Payment/ValidRefundableRequest.php index 56daad730f..7fcb39b0f4 100644 --- a/app/Http/ValidationRules/Payment/ValidRefundableRequest.php +++ b/app/Http/ValidationRules/Payment/ValidRefundableRequest.php @@ -44,11 +44,9 @@ class ValidRefundableRequest implements Rule public function passes($attribute, $value) { - $payment = Payment::whereId($this->input['id'])->first(); - if(!$payment) - { + if (!$payment) { $this->error_msg = "Unable to retrieve specified payment"; return false; } @@ -63,10 +61,10 @@ class ValidRefundableRequest implements Rule // $request_credits[$key]['credit_id'] = $this->decodePrimaryKey($value['credit_id']); - if($payment->invoices()->exists()) - { - foreach($payment->invoices as $paymentable_invoice) + if ($payment->invoices()->exists()) { + foreach ($payment->invoices as $paymentable_invoice) { $this->checkInvoice($paymentable_invoice, $request_invoices); + } } // if($payment->credits()->exists()) @@ -75,36 +73,32 @@ class ValidRefundableRequest implements Rule // $this->checkCredit($paymentable_credit, $request_credits); // } - foreach($request_invoices as $request_invoice) + foreach ($request_invoices as $request_invoice) { $this->checkInvoiceIsPaymentable($request_invoice, $payment); + } // foreach($request_credits as $request_credit) // $this->checkCreditIsPaymentable($request_credit, $payment); - if(strlen($this->error_msg) > 0 ) + if (strlen($this->error_msg) > 0) { return false; + } return true; } private function checkInvoiceIsPaymentable($invoice, $payment) { - $invoice = Invoice::whereId($invoice['invoice_id'])->whereCompanyId($payment->company_id)->first(); - if($payment->invoices()->exists()) - { - + if ($payment->invoices()->exists()) { $paymentable_invoice = $payment->invoices->where('id', $invoice->id)->first(); - if(!$paymentable_invoice){ + if (!$paymentable_invoice) { $this->error_msg = "Invoice id ".$invoice->hashed_id." is not related to this payment"; return false; } - - } - else - { + } else { $this->error_msg = "Invoice id ".$invoice->hashed_id." is not related to this payment"; return false; } @@ -114,55 +108,42 @@ class ValidRefundableRequest implements Rule { $credit = Credit::whereId($credit['credit_id'])->whereCompanyId($payment->company_id)->first(); - if($payment->credits()->exists()) - { - + if ($payment->credits()->exists()) { $paymentable_credit = $payment->credits->where('id', $credit->id)->first(); - if(!$paymentable_invoice){ + if (!$paymentable_invoice) { $this->error_msg = "Credit id ".$credit->hashed_id." is not related to this payment"; return false; } - - } - else - { + } else { $this->error_msg = "Credit id ".$credit->hashed_id." is not related to this payment"; return false; - } + } } private function checkInvoice($paymentable, $request_invoices) { $record_found = false; - foreach($request_invoices as $request_invoice) - { - if($request_invoice['invoice_id'] == $paymentable->pivot->paymentable_id) - { + foreach ($request_invoices as $request_invoice) { + if ($request_invoice['invoice_id'] == $paymentable->pivot->paymentable_id) { $record_found = true; $refundable_amount = ($paymentable->pivot->amount - $paymentable->pivot->refunded); - if($request_invoice['amount'] > $refundable_amount){ - + if ($request_invoice['amount'] > $refundable_amount) { $invoice = $paymentable; $this->error_msg = "Attempting to refund more than allowed for invoice id ".$invoice->hashed_id.", maximum refundable amount is ". $refundable_amount; return false; } - } - } - if(!$record_found) - { + if (!$record_found) { $this->error_msg = "Attempting to refund a payment with invoices attached, please specify valid invoice/s to be refunded."; return false; } - - } @@ -170,33 +151,25 @@ class ValidRefundableRequest implements Rule { $record_found = null; - foreach($request_credits as $request_credit) - { - if($request_credit['credit_id'] == $paymentable->pivot->paymentable_id) - { - + foreach ($request_credits as $request_credit) { + if ($request_credit['credit_id'] == $paymentable->pivot->paymentable_id) { $record_found = true; $refundable_amount = ($paymentable->pivot->amount - $paymentable->pivot->refunded); - if($request_credit['amount'] > $refundable_amount){ - + if ($request_credit['amount'] > $refundable_amount) { $credit = $paymentable; - $this->error_msg = "Attempting to refund more than allowed for credit ".$credit->number.", maximum refundable amount is ". $refundable_amount; + $this->error_msg = "Attempting to refund more than allowed for credit ".$credit->number.", maximum refundable amount is ". $refundable_amount; return false; } - } - } - if(!$record_found) - { + if (!$record_found) { $this->error_msg = "Attempting to refund a payment with credits attached, please specify valid credit/s to be refunded."; return false; } - } /** @@ -206,5 +179,4 @@ class ValidRefundableRequest implements Rule { return $this->error_msg; } - } diff --git a/app/Http/ValidationRules/PaymentAmountsBalanceRule.php b/app/Http/ValidationRules/PaymentAmountsBalanceRule.php index 919737dd36..be6ce7a0c9 100644 --- a/app/Http/ValidationRules/PaymentAmountsBalanceRule.php +++ b/app/Http/ValidationRules/PaymentAmountsBalanceRule.php @@ -28,8 +28,8 @@ class PaymentAmountsBalanceRule implements Rule * @return bool */ public function passes($attribute, $value) - { - return $this->calculateAmounts(); + { + return $this->calculateAmounts(); } /** @@ -48,36 +48,33 @@ class PaymentAmountsBalanceRule implements Rule * have been presented! */ - if(!request()->has('amount')) + if (!request()->has('amount')) { return true; + } - if(request()->has('amount') && request()->input('amount') == 0) + if (request()->has('amount') && request()->input('amount') == 0) { return true; + } $payment_amounts = 0; $invoice_amounts = 0; $payment_amounts += request()->input('amount'); - if(request()->input('credits') && is_array(request()->input('credits'))) - { - foreach(request()->input('credits') as $credit) - { + if (request()->input('credits') && is_array(request()->input('credits'))) { + foreach (request()->input('credits') as $credit) { $payment_amounts += $credit['amount']; } } - if(request()->input('invoices') && is_array(request()->input('invoices'))) - { - foreach(request()->input('invoices') as $invoice) - { + if (request()->input('invoices') && is_array(request()->input('invoices'))) { + foreach (request()->input('invoices') as $invoice) { $invoice_amounts += $invoice['amount']; } - } - else - return true; // if no invoices are present, then this is an unapplied payment, let this pass validation! + } else { + return true; + } // if no invoices are present, then this is an unapplied payment, let this pass validation! return $payment_amounts >= $invoice_amounts; - } } diff --git a/app/Http/ValidationRules/PaymentAppliedValidAmount.php b/app/Http/ValidationRules/PaymentAppliedValidAmount.php index 31dc43eb95..c796bd2ff7 100644 --- a/app/Http/ValidationRules/PaymentAppliedValidAmount.php +++ b/app/Http/ValidationRules/PaymentAppliedValidAmount.php @@ -23,7 +23,7 @@ use Illuminate\Contracts\Validation\Rule; */ class PaymentAppliedValidAmount implements Rule { - use MakesHash; + use MakesHash; /** * @param string $attribute @@ -32,7 +32,7 @@ class PaymentAppliedValidAmount implements Rule */ public function passes($attribute, $value) { - return $this->calculateAmounts(); + return $this->calculateAmounts(); } /** @@ -45,34 +45,29 @@ class PaymentAppliedValidAmount implements Rule private function calculateAmounts() :bool { + $payment = Payment::whereId($this->decodePrimaryKey(request()->segment(4)))->company()->first(); - $payment = Payment::whereId($this->decodePrimaryKey(request()->segment(4)))->company()->first(); - - if(!$payment) + if (!$payment) { return false; + } $payment_amounts = 0; $invoice_amounts = 0; $payment_amounts = $payment->amount - $payment->applied; - if(request()->input('credits') && is_array(request()->input('credits'))) - { - foreach(request()->input('credits') as $credit) - { + if (request()->input('credits') && is_array(request()->input('credits'))) { + foreach (request()->input('credits') as $credit) { $payment_amounts += $credit['amount']; } } - if(request()->input('invoices') && is_array(request()->input('invoices'))) - { - foreach(request()->input('invoices') as $invoice) - { + if (request()->input('invoices') && is_array(request()->input('invoices'))) { + foreach (request()->input('invoices') as $invoice) { $invoice_amounts += $invoice['amount']; } } return $payment_amounts >= $invoice_amounts; - } } diff --git a/app/Http/ValidationRules/ValidCreditsPresentRule.php b/app/Http/ValidationRules/ValidCreditsPresentRule.php index 593eae6062..684479481f 100644 --- a/app/Http/ValidationRules/ValidCreditsPresentRule.php +++ b/app/Http/ValidationRules/ValidCreditsPresentRule.php @@ -32,7 +32,7 @@ class ValidCreditsPresentRule implements Rule */ public function passes($attribute, $value) { - return $this->validCreditsPresent(); + return $this->validCreditsPresent(); } /** @@ -47,20 +47,18 @@ class ValidCreditsPresentRule implements Rule private function validCreditsPresent() :bool { -//todo need to ensure the clients credits are here not random ones! + //todo need to ensure the clients credits are here not random ones! - if(request()->input('credits') && is_array(request()->input('credits'))) - { - foreach(request()->input('credits') as $credit) - { + if (request()->input('credits') && is_array(request()->input('credits'))) { + foreach (request()->input('credits') as $credit) { $cred = Credit::find($this->decodePrimaryKey($credit['credit_id'])); - if($cred->balance == 0) - return false; + if ($cred->balance == 0) { + return false; + } } } return true; - } } diff --git a/app/Http/ValidationRules/ValidRefundableInvoices.php b/app/Http/ValidationRules/ValidRefundableInvoices.php index e3fbc75d32..e7e6becc92 100644 --- a/app/Http/ValidationRules/ValidRefundableInvoices.php +++ b/app/Http/ValidationRules/ValidRefundableInvoices.php @@ -43,15 +43,14 @@ class ValidRefundableInvoices implements Rule public function passes($attribute, $value) { - $payment = Payment::whereId($this->input['id'])->first(); - if(!$payment){ + if (!$payment) { $this->error_msg = "Payment couldn't be retrieved cannot be refunded "; - return false; + return false; } - if(request()->has('amount') && (request()->input('amount') > ($payment->amount - $payment->refunded))){ + if (request()->has('amount') && (request()->input('amount') > ($payment->amount - $payment->refunded))) { $this->error_msg = "Attempting to refunded more than payment amount, enter a value equal to or lower than the payment amount of ". $payment->amount; return false; } @@ -61,9 +60,9 @@ class ValidRefundableInvoices implements Rule if (is_array($value)) { $invoices = Invoice::whereIn('id', array_column($this->input['invoices'], 'invoice_id'))->company()->get(); - } - else + } else { return true; + } foreach ($invoices as $invoice) { if (! $invoice->isRefundable()) { @@ -73,18 +72,17 @@ class ValidRefundableInvoices implements Rule foreach ($this->input['invoices'] as $val) { - if ($val['invoice_id'] == $invoice->id) { + if ($val['invoice_id'] == $invoice->id) { //$pivot_record = $invoice->payments->where('id', $invoice->id)->first(); $pivot_record = $payment->paymentables->where('paymentable_id', $invoice->id)->first(); - if($val['amount'] > ($pivot_record->amount - $pivot_record->refunded)) { + if ($val['amount'] > ($pivot_record->amount - $pivot_record->refunded)) { $this->error_msg = "Attempting to refund ". $val['amount'] ." only ".($pivot_record->amount - $pivot_record->refunded)." available for refund"; return false; } - } + } } - } return true; diff --git a/app/Http/ViewComposers/HeaderComposer.php b/app/Http/ViewComposers/HeaderComposer.php index 3fe1efb544..7cca11d981 100644 --- a/app/Http/ViewComposers/HeaderComposer.php +++ b/app/Http/ViewComposers/HeaderComposer.php @@ -49,7 +49,7 @@ class HeaderComposer $data['current_company'] = $companies->first(function ($company){ return $company->id == auth()->user()->company()->id; }); - + $data['companies'] = $companies->reject(function ($company){ return $company->id == auth()->user()->company()->id; }); diff --git a/app/Jobs/Account/CreateAccount.php b/app/Jobs/Account/CreateAccount.php index b53706fb44..ce534adae6 100644 --- a/app/Jobs/Account/CreateAccount.php +++ b/app/Jobs/Account/CreateAccount.php @@ -1,2 +1,54 @@ request = $sp660339; } public function handle() { if (config('ninja.environment') == 'selfhost' && Account::all()->count() > 1) { return response()->json(array('message' => Ninja::selfHostedMessage()), 400); } elseif (Ninja::boot()) { return response()->json(array('message' => Ninja::parse()), 401); } $sp794f3f = Account::create($this->request); $sp035a66 = CreateCompany::dispatchNow($this->request, $sp794f3f); $sp035a66->load('account'); $sp794f3f->default_company_id = $sp035a66->id; $sp794f3f->save(); $spaa9f78 = CreateUser::dispatchNow($this->request, $sp794f3f, $sp035a66, true); if ($spaa9f78) { auth()->login($spaa9f78, false); } $spaa9f78->setCompany($sp035a66); $spafe62e = isset($this->request['token_name']) ? $this->request['token_name'] : request()->server('HTTP_USER_AGENT'); $sp2d97e8 = CreateCompanyToken::dispatchNow($sp035a66, $spaa9f78, $spafe62e); if ($spaa9f78) { event(new AccountCreated($spaa9f78)); } $spaa9f78->fresh(); $sp035a66->notification(new NewAccountCreated($spaa9f78, $sp035a66))->ninja(); return $sp794f3f; } } \ No newline at end of file +namespace App\Jobs\Account; + +use App\Events\Account\AccountCreated; +use App\Jobs\Company\CreateCompany; +use App\Jobs\Company\CreateCompanyToken; +use App\Jobs\User\CreateUser; +use App\Models\Account; +use App\Models\User; +use App\Notifications\Ninja\NewAccountCreated; +use App\Utils\Ninja; +use App\Utils\Traits\UserSessionAttributes; +use Illuminate\Foundation\Bus\Dispatchable; +use Illuminate\Http\Request; +use Illuminate\Support\Facades\Auth; +use Illuminate\Support\Facades\Log; +use Illuminate\Support\Facades\Notification; +use Symfony\Component\HttpFoundation\Response; + +class CreateAccount +{ + use Dispatchable; + protected $request; + public function __construct(array $sp660339) + { + $this->request = $sp660339; + } + public function handle() + { + if (config('ninja.environment') == 'selfhost' && Account::all()->count() > 1) { + return response()->json(array('message' => Ninja::selfHostedMessage()), 400); + } elseif (Ninja::boot()) { + return response()->json(array('message' => Ninja::parse()), 401); + } + $sp794f3f = Account::create($this->request); + $sp035a66 = CreateCompany::dispatchNow($this->request, $sp794f3f); + $sp035a66->load('account'); + $sp794f3f->default_company_id = $sp035a66->id; + $sp794f3f->save(); + $spaa9f78 = CreateUser::dispatchNow($this->request, $sp794f3f, $sp035a66, true); + if ($spaa9f78) { + auth()->login($spaa9f78, false); + } + $spaa9f78->setCompany($sp035a66); + $spafe62e = isset($this->request['token_name']) ? $this->request['token_name'] : request()->server('HTTP_USER_AGENT'); + $sp2d97e8 = CreateCompanyToken::dispatchNow($sp035a66, $spaa9f78, $spafe62e); + if ($spaa9f78) { + event(new AccountCreated($spaa9f78)); + } + $spaa9f78->fresh(); + $sp035a66->notification(new NewAccountCreated($spaa9f78, $sp035a66))->ninja(); + return $sp794f3f; + } +} diff --git a/app/Jobs/Credit/ApplyCreditPayment.php b/app/Jobs/Credit/ApplyCreditPayment.php index 3958b7ce19..4babaa313c 100644 --- a/app/Jobs/Credit/ApplyCreditPayment.php +++ b/app/Jobs/Credit/ApplyCreditPayment.php @@ -70,7 +70,7 @@ class ApplyCreditPayment implements ShouldQueue if ($this->amount == $credit_balance) { //total credit applied. $this->credit->setStatus(Credit::STATUS_APPLIED); $this->credit->updateBalance($this->amount*-1); - } elseif($this->amount < $credit_balance) { //compare number appropriately + } elseif ($this->amount < $credit_balance) { //compare number appropriately $this->credit->setStatus(Credit::PARTIAL); $this->credit->updateBalance($this->amount*-1); } @@ -78,6 +78,4 @@ class ApplyCreditPayment implements ShouldQueue /* Update Payment Applied Amount*/ $this->payment->save(); } - - } diff --git a/app/Jobs/Credit/CreateCreditPdf.php b/app/Jobs/Credit/CreateCreditPdf.php index d72314f828..8492601c32 100644 --- a/app/Jobs/Credit/CreateCreditPdf.php +++ b/app/Jobs/Credit/CreateCreditPdf.php @@ -32,70 +32,68 @@ use Illuminate\Support\Facades\App; use Illuminate\Support\Facades\Storage; use Spatie\Browsershot\Browsershot; -class CreateCreditPdf implements ShouldQueue { +class CreateCreditPdf implements ShouldQueue +{ + use Dispatchable, InteractsWithQueue, Queueable, SerializesModels, NumberFormatter, MakesInvoiceHtml, PdfMaker, MakesHash; - use Dispatchable, InteractsWithQueue, Queueable, SerializesModels, NumberFormatter, MakesInvoiceHtml, PdfMaker, MakesHash; + public $credit; - public $credit; + public $company; - public $company; + public $contact; - public $contact; + private $disk; - private $disk; + /** + * Create a new job instance. + * + * @return void + */ + public function __construct($credit, Company $company, ClientContact $contact = null) + { + $this->credit = $credit; - /** - * Create a new job instance. - * - * @return void - */ - public function __construct($credit, Company $company, ClientContact $contact = null) - { + $this->company = $company; - $this->credit = $credit; - - $this->company = $company; - - $this->contact = $contact; + $this->contact = $contact; $this->disk = $disk ?? config('filesystems.default'); + } - } + public function handle() + { + MultiDB::setDB($this->company->db); - public function handle() { + $this->credit->load('client'); - MultiDB::setDB($this->company->db); + if (!$this->contact) { + $this->contact = $this->credit->client->primary_contact()->first(); + } - $this->credit->load('client'); + App::setLocale($this->contact->preferredLocale()); - if(!$this->contact) - $this->contact = $this->credit->client->primary_contact()->first(); + $path = $this->credit->client->credit_filepath(); - App::setLocale($this->contact->preferredLocale()); + $file_path = $path . $this->credit->number . '.pdf'; - $path = $this->credit->client->credit_filepath(); + $design = Design::find($this->decodePrimaryKey($this->credit->client->getSetting('credit_design_id'))); + + $designer = new Designer($this->credit, $design, $this->credit->client->getSetting('pdf_variables'), 'credit'); - $file_path = $path . $this->credit->number . '.pdf'; + //get invoice design + // $html = $this->generateInvoiceHtml($designer->build()->getHtml(), $this->credit, $this->contact); + $html = $this->generateEntityHtml($designer, $this->credit, $this->contact); - $design = Design::find($this->decodePrimaryKey($this->credit->client->getSetting('credit_design_id'))); - - $designer = new Designer($this->credit, $design, $this->credit->client->getSetting('pdf_variables'), 'credit'); + //todo - move this to the client creation stage so we don't keep hitting this unnecessarily + Storage::makeDirectory($path, 0755); - //get invoice design -// $html = $this->generateInvoiceHtml($designer->build()->getHtml(), $this->credit, $this->contact); - $html = $this->generateEntityHtml($designer, $this->credit, $this->contact); + //\Log::error($html); + $pdf = $this->makePdf(null, null, $html); - //todo - move this to the client creation stage so we don't keep hitting this unnecessarily - Storage::makeDirectory($path, 0755); - - //\Log::error($html); - $pdf = $this->makePdf(null, null, $html); - - $instance = Storage::disk($this->disk)->put($file_path, $pdf); - - //$instance= Storage::disk($this->disk)->path($file_path); - // - return $file_path; - } + $instance = Storage::disk($this->disk)->put($file_path, $pdf); + //$instance= Storage::disk($this->disk)->path($file_path); + // + return $file_path; + } } diff --git a/app/Jobs/Invoice/CreateInvoicePdf.php b/app/Jobs/Invoice/CreateInvoicePdf.php index d2087c81c6..82d8233dec 100644 --- a/app/Jobs/Invoice/CreateInvoicePdf.php +++ b/app/Jobs/Invoice/CreateInvoicePdf.php @@ -32,69 +32,65 @@ use Illuminate\Support\Facades\App; use Illuminate\Support\Facades\Storage; use Spatie\Browsershot\Browsershot; -class CreateInvoicePdf implements ShouldQueue { +class CreateInvoicePdf implements ShouldQueue +{ + use Dispatchable, InteractsWithQueue, Queueable, SerializesModels, NumberFormatter, MakesInvoiceHtml, PdfMaker, MakesHash; - use Dispatchable, InteractsWithQueue, Queueable, SerializesModels, NumberFormatter, MakesInvoiceHtml, PdfMaker, MakesHash; + public $invoice; - public $invoice; + public $company; - public $company; + public $contact; - public $contact; + private $disk; - private $disk; + /** + * Create a new job instance. + * + * @return void + */ + public function __construct($invoice, Company $company, ClientContact $contact = null) + { + $this->invoice = $invoice; - /** - * Create a new job instance. - * - * @return void - */ - public function __construct($invoice, Company $company, ClientContact $contact = null) - { + $this->company = $company; - $this->invoice = $invoice; - - $this->company = $company; - - $this->contact = $contact; + $this->contact = $contact; $this->disk = $disk ?? config('filesystems.default'); + } - } + public function handle() + { + $this->invoice->load('client'); - public function handle() { + if (!$this->contact) { + $this->contact = $this->invoice->client->primary_contact()->first(); + } - $this->invoice->load('client'); + App::setLocale($this->contact->preferredLocale()); - if(!$this->contact) - $this->contact = $this->invoice->client->primary_contact()->first(); + $path = $this->invoice->client->invoice_filepath(); - App::setLocale($this->contact->preferredLocale()); + $file_path = $path . $this->invoice->number . '.pdf'; + + $design = Design::find($this->decodePrimaryKey($this->invoice->client->getSetting('invoice_design_id'))); - $path = $this->invoice->client->invoice_filepath(); + $designer = new Designer($this->invoice, $design, $this->invoice->client->getSetting('pdf_variables'), 'invoice'); - $file_path = $path . $this->invoice->number . '.pdf'; - - $design = Design::find($this->decodePrimaryKey($this->invoice->client->getSetting('invoice_design_id'))); - - $designer = new Designer($this->invoice, $design, $this->invoice->client->getSetting('pdf_variables'), 'invoice'); - - //get invoice design - //$html = $this->generateInvoiceHtml($designer->build()->getHtml(), $this->invoice, $this->contact); - $html = $this->generateEntityHtml($designer, $this->invoice, $this->contact); + //get invoice design + //$html = $this->generateInvoiceHtml($designer->build()->getHtml(), $this->invoice, $this->contact); + $html = $this->generateEntityHtml($designer, $this->invoice, $this->contact); - //todo - move this to the client creation stage so we don't keep hitting this unnecessarily - Storage::makeDirectory($path, 0755); + //todo - move this to the client creation stage so we don't keep hitting this unnecessarily + Storage::makeDirectory($path, 0755); - //\Log::error($html); - $pdf = $this->makePdf(null, null, $html); - - $instance = Storage::disk($this->disk)->put($file_path, $pdf); - - return $file_path; - - } + //\Log::error($html); + $pdf = $this->makePdf(null, null, $html); + $instance = Storage::disk($this->disk)->put($file_path, $pdf); + return $file_path; + } } diff --git a/app/Jobs/Invoice/EmailInvoice.php b/app/Jobs/Invoice/EmailInvoice.php index a061d83b0f..cca6b8286e 100644 --- a/app/Jobs/Invoice/EmailInvoice.php +++ b/app/Jobs/Invoice/EmailInvoice.php @@ -30,7 +30,7 @@ class EmailInvoice implements ShouldQueue public $company; /** - * + * * EmailQuote constructor. * @param BuildEmail $email_builder * @param QuoteInvitation $quote_invitation @@ -54,18 +54,18 @@ class EmailInvoice implements ShouldQueue public function handle() { - Mail::to($this->invoice_invitation->contact->email, $this->invoice_invitation->contact->present()->name()) - ->send(new TemplateEmail($this->email_builder, - $this->invoice_invitation->contact->user, - $this->invoice_invitation->contact->client - ) + ->send( + new TemplateEmail( + $this->email_builder, + $this->invoice_invitation->contact->user, + $this->invoice_invitation->contact->client + ) ); if (count(Mail::failures()) > 0) { return $this->logMailError(Mail::failures()); } - } private function logMailError($errors) diff --git a/app/Jobs/Invoice/InvoiceNotification.php b/app/Jobs/Invoice/InvoiceNotification.php index 5f4ab1fcd6..7a6bad80ed 100644 --- a/app/Jobs/Invoice/InvoiceNotification.php +++ b/app/Jobs/Invoice/InvoiceNotification.php @@ -19,30 +19,33 @@ use Illuminate\Foundation\Bus\Dispatchable; use Illuminate\Queue\InteractsWithQueue; use Illuminate\Queue\SerializesModels; -class InvoiceNotification implements ShouldQueue { - use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; +class InvoiceNotification implements ShouldQueue +{ + use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; - public $invoice; + public $invoice; - /** - * Create a new job instance. - * - * @return void - */ - public function __construct(Invoice $invoice) { - $this->invoice = $invoice; - } + /** + * Create a new job instance. + * + * @return void + */ + public function __construct(Invoice $invoice) + { + $this->invoice = $invoice; + } - /** - * Execute the job. - * - * - * @return void - */ - public function handle() { + /** + * Execute the job. + * + * + * @return void + */ + public function handle() + { - //notification for the invoice. - // - //could mean a email, sms, slack, push - } + //notification for the invoice. + // + //could mean a email, sms, slack, push + } } diff --git a/app/Jobs/Invoice/ZipInvoices.php b/app/Jobs/Invoice/ZipInvoices.php index 2086c607b8..4004ce79cd 100644 --- a/app/Jobs/Invoice/ZipInvoices.php +++ b/app/Jobs/Invoice/ZipInvoices.php @@ -59,7 +59,6 @@ class ZipInvoices implements ShouldQueue */ public function handle() { - $tempStream = fopen('php://memory', 'w+'); $options = new Archive(); diff --git a/app/Jobs/Payment/EmailPayment.php b/app/Jobs/Payment/EmailPayment.php index 2c4468a5e6..46eb387c76 100644 --- a/app/Jobs/Payment/EmailPayment.php +++ b/app/Jobs/Payment/EmailPayment.php @@ -36,12 +36,12 @@ class EmailPayment implements ShouldQueue * * @return void */ - public function __construct(Payment $payment, $email_builder, $contact) - { + public function __construct(Payment $payment, $email_builder, $contact) + { $this->payment = $payment; $this->email_builder = $email_builder; $this->contact = $contact; - } + } /** @@ -52,7 +52,6 @@ class EmailPayment implements ShouldQueue */ public function handle() { - if ($this->contact->email) { Mail::to($this->contact->email, $this->contact->present()->name()) ->send(new TemplateEmail($this->email_builder, $this->contact->user, $this->contact->customer)); @@ -68,7 +67,6 @@ class EmailPayment implements ShouldQueue //sleep(5); } - } private function logMailError($errors) diff --git a/app/Jobs/Quote/CreateQuotePdf.php b/app/Jobs/Quote/CreateQuotePdf.php index f346289dc2..59cb55c2f7 100644 --- a/app/Jobs/Quote/CreateQuotePdf.php +++ b/app/Jobs/Quote/CreateQuotePdf.php @@ -32,100 +32,98 @@ use Illuminate\Support\Facades\App; use Illuminate\Support\Facades\Storage; use Spatie\Browsershot\Browsershot; -class CreateQuotePdf implements ShouldQueue { +class CreateQuotePdf implements ShouldQueue +{ + use Dispatchable, InteractsWithQueue, Queueable, SerializesModels, NumberFormatter, MakesInvoiceHtml, PdfMaker, MakesHash; - use Dispatchable, InteractsWithQueue, Queueable, SerializesModels, NumberFormatter, MakesInvoiceHtml, PdfMaker, MakesHash; + public $quote; - public $quote; + public $company; - public $company; + public $contact; - public $contact; + private $disk; - private $disk; + /** + * Create a new job instance. + * + * @return void + */ + public function __construct($quote, Company $company, ClientContact $contact = null) + { + $this->quote = $quote; - /** - * Create a new job instance. - * - * @return void - */ - public function __construct($quote, Company $company, ClientContact $contact = null) - { + $this->company = $company; - $this->quote = $quote; - - $this->company = $company; - - $this->contact = $contact; + $this->contact = $contact; $this->disk = $disk ?? config('filesystems.default'); + } - } + public function handle() + { + MultiDB::setDB($this->company->db); - public function handle() { + $settings = $this->quote->client->getMergedSettings(); - MultiDB::setDB($this->company->db); + $this->quote->load('client'); - $settings = $this->quote->client->getMergedSettings(); + if (!$this->contact) { + $this->contact = $this->quote->client->primary_contact()->first(); + } - $this->quote->load('client'); + App::setLocale($this->contact->preferredLocale()); - if(!$this->contact) - $this->contact = $this->quote->client->primary_contact()->first(); + $path = $this->quote->client->quote_filepath(); - App::setLocale($this->contact->preferredLocale()); + $design = Design::find($this->decodePrimaryKey($this->quote->client->getSetting('quote_design_id'))); - $path = $this->quote->client->quote_filepath(); + $designer = new Designer($this->quote, $design, $this->quote->client->getSetting('pdf_variables'), 'quote'); - $design = Design::find($this->decodePrimaryKey($this->quote->client->getSetting('quote_design_id'))); + //todo - move this to the client creation stage so we don't keep hitting this unnecessarily + Storage::makeDirectory($path, 0755); - $designer = new Designer($this->quote, $design, $this->quote->client->getSetting('pdf_variables'), 'quote'); + //\Log::error($html); - //todo - move this to the client creation stage so we don't keep hitting this unnecessarily - Storage::makeDirectory($path, 0755); + $all_pages_header = $settings->all_pages_header; + $all_pages_footer = $settings->all_pages_footer; - //\Log::error($html); - - $all_pages_header = $settings->all_pages_header; - $all_pages_footer = $settings->all_pages_footer; - - $quote_number = $this->quote->number; + $quote_number = $this->quote->number; - // if($all_pages_header && $all_pages_footer){ - // $all_pages_header = $designer->init()->getHeader()->getHtml(); - // $all_pages_footer = $designer->init()->getFooter()->getHtml(); - // $design_body = $designer->init()->getBody()->getHtml(); - // $quote_number = "header_and_footer"; - // } - // elseif($all_pages_header){ - // $all_pages_header = $designer->init()->getHeader()->getHtml(); - // $design_body = $designer->init()->getBody()->getFooter()->getHtml(); - // $quote_number = "header_only"; - // } - // elseif($all_pages_footer){ - // $all_pages_footer = $designer->init()->getFooter()->getHtml(); - // $design_body = $designer->init()->getHeader()->getBody()->getHtml(); - // $quote_number = "footer_only"; - // } - // else{ - $design_body = $designer->build()->getHtml(); - + // if($all_pages_header && $all_pages_footer){ + // $all_pages_header = $designer->init()->getHeader()->getHtml(); + // $all_pages_footer = $designer->init()->getFooter()->getHtml(); + // $design_body = $designer->init()->getBody()->getHtml(); + // $quote_number = "header_and_footer"; + // } + // elseif($all_pages_header){ + // $all_pages_header = $designer->init()->getHeader()->getHtml(); + // $design_body = $designer->init()->getBody()->getFooter()->getHtml(); + // $quote_number = "header_only"; + // } + // elseif($all_pages_footer){ + // $all_pages_footer = $designer->init()->getFooter()->getHtml(); + // $design_body = $designer->init()->getHeader()->getBody()->getHtml(); + // $quote_number = "footer_only"; + // } + // else{ + $design_body = $designer->build()->getHtml(); + - + - //get invoice design -// $html = $this->generateInvoiceHtml($design_body, $this->quote, $this->contact); - $html = $this->generateEntityHtml($designer, $this->quote, $this->contact); + //get invoice design + // $html = $this->generateInvoiceHtml($design_body, $this->quote, $this->contact); + $html = $this->generateEntityHtml($designer, $this->quote, $this->contact); - $pdf = $this->makePdf($all_pages_header, $all_pages_footer, $html); - $file_path = $path . $quote_number . '.pdf'; + $pdf = $this->makePdf($all_pages_header, $all_pages_footer, $html); + $file_path = $path . $quote_number . '.pdf'; - $instance = Storage::disk($this->disk)->put($file_path, $pdf); - - //$instance= Storage::disk($this->disk)->path($file_path); - // - return $file_path; - } + $instance = Storage::disk($this->disk)->put($file_path, $pdf); + //$instance= Storage::disk($this->disk)->path($file_path); + // + return $file_path; + } } diff --git a/app/Jobs/Quote/EmailQuote.php b/app/Jobs/Quote/EmailQuote.php index c32da9a385..503fafc8f5 100644 --- a/app/Jobs/Quote/EmailQuote.php +++ b/app/Jobs/Quote/EmailQuote.php @@ -47,18 +47,18 @@ class EmailQuote implements ShouldQueue */ public function handle() { - Mail::to($this->quote_invitation->contact->email, $this->quote_invitation->contact->present()->name()) - ->send(new TemplateEmail($this->email_builder, - $this->quote_invitation->contact->user, - $this->quote_invitation->contact->client - ) + ->send( + new TemplateEmail( + $this->email_builder, + $this->quote_invitation->contact->user, + $this->quote_invitation->contact->client + ) ); if (count(Mail::failures()) > 0) { return $this->logMailError(Mail::failures()); } - } private function logMailError($errors) diff --git a/app/Jobs/Util/Import.php b/app/Jobs/Util/Import.php index 3cb04d315b..0b9d9470a7 100644 --- a/app/Jobs/Util/Import.php +++ b/app/Jobs/Util/Import.php @@ -129,7 +129,7 @@ class Import implements ShouldQueue public function handle() { foreach ($this->data as $key => $resource) { -\Log::error("importing {$key}"); + \Log::error("importing {$key}"); if (!in_array($key, $this->available_imports)) { throw new ResourceNotAvailableForMigration("Resource {$key} is not available for migration."); } @@ -161,14 +161,14 @@ class Import implements ShouldQueue throw new MigrationValidatorFailed(json_encode($validator->errors())); } - if (isset($data['account_id'])) + if (isset($data['account_id'])) { unset($data['account_id']); + } $company_repository = new CompanyRepository(); $company_repository->save($data, $this->company); Company::reguard(); - } /** @@ -192,16 +192,17 @@ class Import implements ShouldQueue } foreach ($data as $resource) { - $modified = $resource; $company_id = $this->company->id; $user_id = $this->processUserId($resource); - if (isset($resource['user_id'])) + if (isset($resource['user_id'])) { unset($resource['user_id']); + } - if (isset($resource['company_id'])) + if (isset($resource['company_id'])) { unset($resource['company_id']); + } $tax_rate = TaxRateFactory::create($this->company->id, $user_id); $tax_rate->fill($resource); @@ -210,7 +211,6 @@ class Import implements ShouldQueue } TaxRate::reguard(); - } /** @@ -240,7 +240,6 @@ class Import implements ShouldQueue $user_repository = new UserRepository(); foreach ($data as $resource) { - $modified = $resource; unset($modified['id']); @@ -259,7 +258,6 @@ class Import implements ShouldQueue } User::reguard(); - } /** @@ -275,7 +273,6 @@ class Import implements ShouldQueue $client_repository = new ClientRepository($contact_repository); foreach ($data as $key => $resource) { - $modified = $resource; $modified['company_id'] = $this->company->id; $modified['user_id'] = $this->processUserId($resource); @@ -283,14 +280,18 @@ class Import implements ShouldQueue unset($modified['id']); unset($modified['contacts']); - $client = $client_repository->save($modified, ClientFactory::create( - $this->company->id, $modified['user_id']) + $client = $client_repository->save( + $modified, + ClientFactory::create( + $this->company->id, + $modified['user_id'] + ) ); - if(array_key_exists('contacts', $resource)) { // need to remove after importing new migration.json + if (array_key_exists('contacts', $resource)) { // need to remove after importing new migration.json $modified_contacts = $resource['contacts']; - foreach($modified_contacts as $key => $client_contacts) { + foreach ($modified_contacts as $key => $client_contacts) { $modified_contacts[$key]['company_id'] = $this->company->id; $modified_contacts[$key]['user_id'] = $this->processUserId($resource); $modified_contacts[$key]['client_id'] = $client->id; @@ -310,7 +311,6 @@ class Import implements ShouldQueue } Client::reguard(); - } private function processProducts(array $data): void @@ -333,25 +333,26 @@ class Import implements ShouldQueue $product_repository = new ProductRepository(); foreach ($data as $resource) { - $modified = $resource; $modified['company_id'] = $this->company->id; $modified['user_id'] = $this->processUserId($resource); unset($modified['id']); - $product_repository->save($modified, ProductFactory::create( - $this->company->id, $modified['user_id']) + $product_repository->save( + $modified, + ProductFactory::create( + $this->company->id, + $modified['user_id'] + ) ); } Product::reguard(); - } private function processInvoices(array $data): void { - Invoice::unguard(); $rules = [ @@ -367,7 +368,6 @@ class Import implements ShouldQueue $invoice_repository = new InvoiceRepository(); foreach ($data as $resource) { - $modified = $resource; if (array_key_exists('client_id', $resource) && !array_key_exists('clients', $this->ids)) { @@ -381,7 +381,8 @@ class Import implements ShouldQueue unset($modified['id']); $invoice = $invoice_repository->save( - $modified, InvoiceFactory::create($this->company->id, $modified['user_id']) + $modified, + InvoiceFactory::create($this->company->id, $modified['user_id']) ); $key = "invoices_{$resource['id']}"; @@ -390,11 +391,9 @@ class Import implements ShouldQueue 'old' => $resource['id'], 'new' => $invoice->id, ]; - } Invoice::reguard(); - } private function processCredits(array $data): void @@ -414,7 +413,6 @@ class Import implements ShouldQueue $credit_repository = new CreditRepository(); foreach ($data as $resource) { - $modified = $resource; if (array_key_exists('client_id', $resource) && !array_key_exists('clients', $this->ids)) { @@ -428,7 +426,8 @@ class Import implements ShouldQueue unset($modified['id']); $credit = $credit_repository->save( - $modified, CreditFactory::create($this->company->id, $modified['user_id']) + $modified, + CreditFactory::create($this->company->id, $modified['user_id']) ); $key = "credits_{$resource['id']}"; @@ -440,7 +439,6 @@ class Import implements ShouldQueue } Credit::reguard(); - } private function processQuotes(array $data): void @@ -460,7 +458,6 @@ class Import implements ShouldQueue $quote_repository = new QuoteRepository(); foreach ($data as $resource) { - $modified = $resource; if (array_key_exists('client_id', $resource) && !array_key_exists('clients', $this->ids)) { @@ -475,7 +472,8 @@ class Import implements ShouldQueue unset($modified['id']); $invoice = $quote_repository->save( - $modified, QuoteFactory::create($this->company->id, $modified['user_id']) + $modified, + QuoteFactory::create($this->company->id, $modified['user_id']) ); $old_user_key = array_key_exists('user_id', $resource) ?? $this->user->id; @@ -486,11 +484,9 @@ class Import implements ShouldQueue 'old' => $resource['id'], 'new' => $invoice->id, ]; - } Quote::reguard(); - } private function processPayments(array $data): void @@ -511,7 +507,6 @@ class Import implements ShouldQueue $payment_repository = new PaymentRepository(new CreditRepository()); foreach ($data as $resource) { - $modified = $resource; if (array_key_exists('client_id', $resource) && !array_key_exists('clients', $this->ids)) { @@ -527,12 +522,14 @@ class Import implements ShouldQueue unset($modified['invoice_id']); if (isset($modified['invoices'])) { - foreach ($modified['invoices'] as $invoice) + foreach ($modified['invoices'] as $invoice) { $invoice['invoice_id'] = $this->transformId('invoices', $invoice['invoice_id']); + } } $payment = $payment_repository->save( - $modified, PaymentFactory::create($this->company->id, $modified['user_id']) + $modified, + PaymentFactory::create($this->company->id, $modified['user_id']) ); $old_user_key = array_key_exists('user_id', $resource) ?? $this->user->id; @@ -543,11 +540,9 @@ class Import implements ShouldQueue 'new' => $payment->id, ] ]; - } Payment::reguard(); - } private function processDocuments(array $data): void @@ -556,7 +551,6 @@ class Import implements ShouldQueue /** No validators since data provided by database is already valid. */ foreach ($data as $resource) { - $modified = $resource; if (array_key_exists('invoice_id', $resource) && $resource['invoice_id'] && !array_key_exists('invoices', $this->ids)) { @@ -571,12 +565,12 @@ class Import implements ShouldQueue unset($modified['invoice_id']); unset($modified['expense_id']); - if(array_key_exists('invoice_id', $resource) && $resource['invoice_id'] && array_key_exists('invoices', $this->ids)) { + if (array_key_exists('invoice_id', $resource) && $resource['invoice_id'] && array_key_exists('invoices', $this->ids)) { $modified['documentable_id'] = $this->transformId('invoices', $resource['invoice_id']); $modified['documentable_type'] = 'App\\Models\\Invoice'; } - if(array_key_exists('expense_id', $resource) && $resource['expense_id'] && array_key_exists('expenses', $this->ids)) { + if (array_key_exists('expense_id', $resource) && $resource['expense_id'] && array_key_exists('expenses', $this->ids)) { $modified['documentable_id'] = $this->transformId('expenses', $resource['expense_id']); $modified['documentable_type'] = 'App\\Models\\Expense'; } @@ -618,7 +612,6 @@ class Import implements ShouldQueue } foreach ($data as $resource) { - $modified = $resource; $modified['user_id'] = $this->processUserId($resource); @@ -647,7 +640,6 @@ class Import implements ShouldQueue } CompanyGateway::reguard(); - } private function processClientGatewayTokens(array $data) :void @@ -655,7 +647,6 @@ class Import implements ShouldQueue ClientGatewayToken::unguard(); foreach ($data as $resource) { - $modified = $resource; unset($modified['id']); @@ -675,8 +666,7 @@ class Import implements ShouldQueue ]; } - ClientGatewayToken::reguard(); - + ClientGatewayToken::reguard(); } /** @@ -733,7 +723,6 @@ class Import implements ShouldQueue */ public function processUserId(array $resource) { - if (!array_key_exists('user_id', $resource)) { return $this->user->id; } diff --git a/app/Jobs/Util/PreviewPdf.php b/app/Jobs/Util/PreviewPdf.php index b2faec401c..ebd57aa71b 100644 --- a/app/Jobs/Util/PreviewPdf.php +++ b/app/Jobs/Util/PreviewPdf.php @@ -31,51 +31,46 @@ use Illuminate\Support\Facades\App; use Illuminate\Support\Facades\Storage; use Spatie\Browsershot\Browsershot; -class PreviewPdf implements ShouldQueue { +class PreviewPdf implements ShouldQueue +{ + use Dispatchable, InteractsWithQueue, Queueable, SerializesModels, NumberFormatter, MakesInvoiceHtml, PdfMaker; - use Dispatchable, InteractsWithQueue, Queueable, SerializesModels, NumberFormatter, MakesInvoiceHtml, PdfMaker; + public $invoice; - public $invoice; + public $company; - public $company; + public $contact; - public $contact; + private $disk; - private $disk; + public $design_string; - public $design_string; + /** + * Create a new job instance. + * + * @return void + */ + public function __construct($design_string, Company $company) + { + $this->company = $company; - /** - * Create a new job instance. - * - * @return void - */ - public function __construct($design_string, Company $company) - { - - $this->company = $company; - - $this->design_string = $design_string; + $this->design_string = $design_string; $this->disk = $disk ?? config('filesystems.default'); + } - } + public function handle() + { + $path = $this->company->company_key; - public function handle() { + //Storage::makeDirectory($path, 0755); + $file_path = $path . '/stream.pdf'; - $path = $this->company->company_key; - - //Storage::makeDirectory($path, 0755); - - $file_path = $path . '/stream.pdf'; - - $pdf = $this->makePdf(null, null, $this->design_string); - - $instance = Storage::disk('local')->put($file_path, $pdf); - - return storage_path('app') .'/'. $file_path; - } + $pdf = $this->makePdf(null, null, $this->design_string); + $instance = Storage::disk('local')->put($file_path, $pdf); + return storage_path('app') .'/'. $file_path; + } } diff --git a/app/Jobs/Util/StartMigration.php b/app/Jobs/Util/StartMigration.php index 1dabacdd27..89c283b94f 100644 --- a/app/Jobs/Util/StartMigration.php +++ b/app/Jobs/Util/StartMigration.php @@ -71,20 +71,24 @@ class StartMigration implements ShouldQueue $filename = pathinfo($this->filepath, PATHINFO_FILENAME); try { - if (!$archive) + if (!$archive) { throw new ProcessingMigrationArchiveFailed('Processing migration archive failed. Migration file is possibly corrupted.'); + } $zip->extractTo(storage_path("migrations/{$filename}")); $zip->close(); - if (app()->environment() == 'testing') + if (app()->environment() == 'testing') { return; + } $this->start($filename); } catch (NonExistingMigrationFile | ProcessingMigrationArchiveFailed | ResourceNotAvailableForMigration | MigrationValidatorFailed | ResourceDependencyMissing $e) { Mail::to($this->user)->send(new MigrationFailed($e, $e->getMessage())); - if (app()->environment() !== 'production') info($e->getMessage()); + if (app()->environment() !== 'production') { + info($e->getMessage()); + } } \Log::error("stop handle"); @@ -97,13 +101,13 @@ class StartMigration implements ShouldQueue */ public function start(string $filename): void { - \Log::error("start start"); $file = storage_path("migrations/$filename/migration.json"); - if (!file_exists($file)) + if (!file_exists($file)) { throw new NonExistingMigrationFile('Migration file does not exist, or it is corrupted.'); + } $handle = fopen($file, "r"); $file = fread($handle, filesize($file)); diff --git a/app/Jobs/Util/UnlinkFile.php b/app/Jobs/Util/UnlinkFile.php index 73b44d4586..1d50057fe7 100644 --- a/app/Jobs/Util/UnlinkFile.php +++ b/app/Jobs/Util/UnlinkFile.php @@ -31,8 +31,6 @@ class UnlinkFile implements ShouldQueue */ public function handle() { - Storage::disk($this->disk)->delete($this->file_path); - } } diff --git a/app/Jobs/Util/UploadFile.php b/app/Jobs/Util/UploadFile.php index 5ffe81751b..1b7b923c52 100644 --- a/app/Jobs/Util/UploadFile.php +++ b/app/Jobs/Util/UploadFile.php @@ -68,11 +68,14 @@ class UploadFile implements ShouldQueue { $path = self::PROPERTIES[$this->type]['path']; - if ($this->company) + if ($this->company) { $path = sprintf('%s/%s', $this->company->company_key, self::PROPERTIES[$this->type]['path']); + } $instance = Storage::disk($this->disk)->putFileAs( - $path, $this->file, $this->file->hashName() + $path, + $this->file, + $this->file->hashName() ); if (in_array($this->file->extension(), ['jpg', 'jpeg', 'png', 'gif', 'bmp', 'tiff', 'psd'])) { diff --git a/app/Jobs/Util/VersionCheck.php b/app/Jobs/Util/VersionCheck.php index 7838905b56..d2bc0aef82 100644 --- a/app/Jobs/Util/VersionCheck.php +++ b/app/Jobs/Util/VersionCheck.php @@ -16,7 +16,6 @@ class VersionCheck implements ShouldQueue public function __construct() { - } /** @@ -26,12 +25,10 @@ class VersionCheck implements ShouldQueue */ public function handle() { - $version_file = file_get_contents(config('ninja.version_url')); - if($version_file) + if ($version_file) { Account::whereNotNull('id')->update(['latest_version' => $version_file]); - + } } - } diff --git a/app/Libraries/MultiDB.php b/app/Libraries/MultiDB.php index 1b8138681a..22bac8a71c 100644 --- a/app/Libraries/MultiDB.php +++ b/app/Libraries/MultiDB.php @@ -59,11 +59,9 @@ class MultiDB //multi-db active foreach (self::$dbs as $db) { - if (Company::on($db)->whereSubdomain($subdomain)->get()->count() >=1) { return false; } - } self::setDefaultDatabase(); @@ -215,7 +213,7 @@ class MultiDB * @param $database */ public static function setDB(string $database) : void - { + { /* This will set the database connection for the request */ config(['database.default' => $database]); } diff --git a/app/Listeners/Activity/PaymentCreatedActivity.php b/app/Listeners/Activity/PaymentCreatedActivity.php index 9437f2dd6d..52e1434c64 100644 --- a/app/Listeners/Activity/PaymentCreatedActivity.php +++ b/app/Listeners/Activity/PaymentCreatedActivity.php @@ -60,7 +60,5 @@ class PaymentCreatedActivity implements ShouldQueue if (count($invoices) == 0) { $this->activityRepo->save($fields, $payment); } - - } } diff --git a/app/Listeners/Invoice/CreateInvoiceHtmlBackup.php b/app/Listeners/Invoice/CreateInvoiceHtmlBackup.php index 3c05676aa4..4e015245d4 100644 --- a/app/Listeners/Invoice/CreateInvoiceHtmlBackup.php +++ b/app/Listeners/Invoice/CreateInvoiceHtmlBackup.php @@ -38,7 +38,6 @@ class CreateInvoiceHtmlBackup implements ShouldQueue */ public function handle($event) { - MultiDB::setDB($event->company->db); $fields = new \stdClass; diff --git a/app/Listeners/Invoice/InvoiceEmailedNotification.php b/app/Listeners/Invoice/InvoiceEmailedNotification.php index d759ebbaa0..93b2e191e8 100644 --- a/app/Listeners/Invoice/InvoiceEmailedNotification.php +++ b/app/Listeners/Invoice/InvoiceEmailedNotification.php @@ -26,7 +26,6 @@ use Illuminate\Support\Facades\Notification; class InvoiceEmailedNotification implements ShouldQueue { - use UserNotifies; public function __construct() @@ -43,8 +42,7 @@ class InvoiceEmailedNotification implements ShouldQueue { $invitation = $event->invitation; - foreach($invitation->company->company_users as $company_user) - { + foreach ($invitation->company->company_users as $company_user) { $user = $company_user->user; $notification = new EntitySentNotification($invitation, 'invoice'); @@ -52,7 +50,6 @@ class InvoiceEmailedNotification implements ShouldQueue $notification->method = $this->findUserNotificationTypes($invitation, $company_user, 'invoice', ['all_notifications', 'invoice_sent']); $user->notify($notification); - } // if(isset($invitation->company->slack_webhook_url)){ @@ -62,6 +59,4 @@ class InvoiceEmailedNotification implements ShouldQueue // } } - - } diff --git a/app/Listeners/Misc/InvitationViewedListener.php b/app/Listeners/Misc/InvitationViewedListener.php index 347bd01c76..6e06db9f08 100644 --- a/app/Listeners/Misc/InvitationViewedListener.php +++ b/app/Listeners/Misc/InvitationViewedListener.php @@ -26,7 +26,9 @@ class InvitationViewedListener implements ShouldQueue * * @return void */ - public function __construct(){} + public function __construct() + { + } /** * Handle the event. @@ -41,9 +43,7 @@ class InvitationViewedListener implements ShouldQueue $notification = new EntityViewedNotification($invitation, $entity_name); - foreach($invitation->company->company_users as $company_user) - { - + foreach ($invitation->company->company_users as $company_user) { $entity_viewed = "{$entity_name}_viewed"; $notification->method = $this->findUserNotificationTypes($invitation, $company_user, $entity_name, ['all_notifications', $entity_viewed]); @@ -51,13 +51,11 @@ class InvitationViewedListener implements ShouldQueue $company_user->user->notify($notification); } - if(isset($invitation->company->slack_webhook_url)){ - + if (isset($invitation->company->slack_webhook_url)) { $notification->method = ['slack']; Notification::route('slack', $invitation->company->slack_webhook_url) ->notify($notification); - } } @@ -67,8 +65,6 @@ class InvitationViewedListener implements ShouldQueue { $via_array = []; - if(stripos($this->company_user->permissions, ) !== false); - + if (stripos($this->company_user->permissions, ) !== false); } - } diff --git a/app/Listeners/Payment/PaymentNotification.php b/app/Listeners/Payment/PaymentNotification.php index ee9d1f562f..70ca2405b8 100644 --- a/app/Listeners/Payment/PaymentNotification.php +++ b/app/Listeners/Payment/PaymentNotification.php @@ -41,19 +41,18 @@ class PaymentNotification implements ShouldQueue { $payment = $event->payment; - //todo need to iterate through teh company user and determine if the user + //todo need to iterate through teh company user and determine if the user //will receive this notification. - foreach($payment->company->company_users as $company_user) - { - $company_user->user->notify(new NewPaymentNotification($payment, $payment->company)); + foreach ($payment->company->company_users as $company_user) { + if ($company_user->user) { + $company_user->user->notify(new NewPaymentNotification($payment, $payment->company)); + } } - if(isset($payment->company->slack_webhook_url)){ - + if (isset($payment->company->slack_webhook_url)) { Notification::route('slack', $payment->company->slack_webhook_url) ->notify(new NewPaymentNotification($payment, $payment->company, true)); - } } } diff --git a/app/Listeners/SendVerificationNotification.php b/app/Listeners/SendVerificationNotification.php index 8a2946a6f9..9c4a7d831d 100644 --- a/app/Listeners/SendVerificationNotification.php +++ b/app/Listeners/SendVerificationNotification.php @@ -44,7 +44,6 @@ class SendVerificationNotification implements ShouldQueue */ public function handle($event) { - MultiDB::setDB($event->company->db); $event->user->notify(new VerifyUser($event->user)); diff --git a/app/Mail/DownloadInvoices.php b/app/Mail/DownloadInvoices.php index 74214b9741..67f01b183f 100644 --- a/app/Mail/DownloadInvoices.php +++ b/app/Mail/DownloadInvoices.php @@ -31,13 +31,14 @@ class DownloadInvoices extends Mailable */ public function build() { - return $this->subject(ctrans('texts.download_files')) - ->markdown('email.admin.download_files', + ->markdown( + 'email.admin.download_files', [ 'url' => $this->file_path, 'logo' => $this->company->present()->logo, - ]); + ] + ); // return $this->from(config('mail.from.address')) //todo this needs to be fixed to handle the hosted version // ->subject(ctrans('texts.download_documents',['size'=>''])) diff --git a/app/Mail/TemplateEmail.php b/app/Mail/TemplateEmail.php index 59bb9ae4c4..b78fb92eac 100644 --- a/app/Mail/TemplateEmail.php +++ b/app/Mail/TemplateEmail.php @@ -12,7 +12,7 @@ class TemplateEmail extends Mailable { use Queueable, SerializesModels; - private $build_email; + private $build_email; private $user; //the user the email will be sent from @@ -22,13 +22,11 @@ class TemplateEmail extends Mailable public function __construct($build_email, User $user, Client $client) { - $this->build_email = $build_email; $this->user = $user; //this is inappropriate here, need to refactor 'user' in this context the 'user' could also be the 'system' $this->client = $client; - } /** @@ -47,10 +45,10 @@ class TemplateEmail extends Mailable $company = $this->client->company; - $message = $this->from($this->user->email,$this->user->present()->name())//todo this needs to be fixed to handle the hosted version + $message = $this->from($this->user->email, $this->user->present()->name())//todo this needs to be fixed to handle the hosted version ->subject($this->build_email->getSubject()) ->text('email.template.plain', [ - 'body' => $this->build_email->getBody(), + 'body' => $this->build_email->getBody(), 'footer' => $this->build_email->getFooter() ]) ->view($template_name, [ @@ -63,7 +61,6 @@ class TemplateEmail extends Mailable //conditionally attach files if ($settings->pdf_email_attachment !== false && !empty($this->build_email->getAttachments())) { - foreach ($this->build_email->getAttachments() as $file) { $message->attach($file); } diff --git a/app/Mail/TestMailServer.php b/app/Mail/TestMailServer.php index 9c89e75f2e..a4efd74033 100644 --- a/app/Mail/TestMailServer.php +++ b/app/Mail/TestMailServer.php @@ -29,7 +29,6 @@ class TestMailServer extends Mailable */ public function build() { - return $this->from($this->from_email) //todo this needs to be fixed to handle the hosted version ->subject(ctrans('texts.email')) ->markdown('email.support.message', [ @@ -37,6 +36,5 @@ class TestMailServer extends Mailable 'system_info' => '', 'laravel_log' => [] ]); - } } diff --git a/app/Models/Account.php b/app/Models/Account.php index 4920e7f45c..4bc9278344 100644 --- a/app/Models/Account.php +++ b/app/Models/Account.php @@ -58,7 +58,7 @@ class Account extends BaseModel const PLAN_ENTERPRISE = 'enterprise'; const PLAN_WHITE_LABEL = 'white_label'; const PLAN_TERM_MONTHLY = 'month'; - const PLAN_TERM_YEARLY = 'year'; + const PLAN_TERM_YEARLY = 'year'; const FEATURE_TASKS = 'tasks'; const FEATURE_EXPENSES = 'expenses'; @@ -152,6 +152,7 @@ class Account extends BaseModel return false; } // Fallthrough + // no break case self::FEATURE_REMOVE_CREATED_BY: return ! empty($plan_details); // A plan is required even for self-hosted users @@ -181,16 +182,18 @@ class Account extends BaseModel public function isPaidHostedClient() { - if (! Ninja::isNinja()) - return false; + if (! Ninja::isNinja()) { + return false; + } return $this->plan == 'pro' || $this->plan == 'enterprise'; } public function isTrial() { - if (! Ninja::isNinja()) + if (! Ninja::isNinja()) { return false; + } $plan_details = $this->getPlanDetails(); @@ -199,7 +202,6 @@ class Account extends BaseModel public function getPlanDetails($include_inactive = false, $include_trial = true) { - $plan = $this->plan; $price = $this->plan_price; $trial_plan = $this->trial_plan; diff --git a/app/Models/BaseModel.php b/app/Models/BaseModel.php index 592f7e353a..bbca7eb38c 100644 --- a/app/Models/BaseModel.php +++ b/app/Models/BaseModel.php @@ -156,8 +156,9 @@ class BaseModel extends Model */ public function resolveRouteBinding($value) { - if(is_numeric($value)) + if (is_numeric($value)) { throw new ModelNotFoundException("Record with value {$value} not found"); + } return $this ->withTrashed() diff --git a/app/Models/Client.php b/app/Models/Client.php index 4aa889b774..a26b326769 100644 --- a/app/Models/Client.php +++ b/app/Models/Client.php @@ -227,13 +227,12 @@ class Client extends BaseModel implements HasLocalePreference * Adjusts client "balances" when a client * makes a payment that goes on file, but does * not effect the client.balance record - * + * * @param float $amount Adjustment amount - * @return Client + * @return Client */ public function processUnappliedPayment($amount) :Client { - return $this->service()->updatePaidToDate($amount) ->adjustCreditBalance($amount) ->save(); @@ -249,7 +248,6 @@ class Client extends BaseModel implements HasLocalePreference */ public function getMergedSettings() :object { - if ($this->group_settings !== null) { $group_settings = ClientSettings::buildClientSettings($this->group_settings->settings, $this->settings); @@ -272,8 +270,8 @@ class Client extends BaseModel implements HasLocalePreference { /*Client Settings*/ - if ($this->settings && property_exists($this->settings, $setting) && isset($this->settings->{$setting}) ) { - /*need to catch empty string here*/ + if ($this->settings && property_exists($this->settings, $setting) && isset($this->settings->{$setting})) { + /*need to catch empty string here*/ if (is_string($this->settings->{$setting}) && (iconv_strlen($this->settings->{$setting}) >=1)) { return $this->settings->{$setting}; } @@ -285,7 +283,7 @@ class Client extends BaseModel implements HasLocalePreference } /*Company Settings*/ - else if ((property_exists($this->company->settings, $setting) != false) && (isset($this->company->settings->{$setting}) !== false)) { + elseif ((property_exists($this->company->settings, $setting) != false) && (isset($this->company->settings->{$setting}) !== false)) { return $this->company->settings->{$setting}; } @@ -468,20 +466,22 @@ class Client extends BaseModel implements HasLocalePreference { $defaults = []; - if(!(array_key_exists('terms', $data) && strlen($data['terms']) > 1)) + if (!(array_key_exists('terms', $data) && strlen($data['terms']) > 1)) { $defaults['terms'] = $this->getSetting($entity_name.'_terms'); - elseif(array_key_exists('terms', $data)) + } elseif (array_key_exists('terms', $data)) { $defaults['terms'] = $data['terms']; + } - if(!(array_key_exists('footer', $data) && strlen($data['footer']) > 1)) + if (!(array_key_exists('footer', $data) && strlen($data['footer']) > 1)) { $defaults['footer'] = $this->getSetting($entity_name.'_footer'); - elseif(array_key_exists('footer', $data)) + } elseif (array_key_exists('footer', $data)) { $defaults['footer'] = $data['footer']; + } - if(strlen($this->public_notes) >=1) + if (strlen($this->public_notes) >=1) { $defaults['public_notes'] = $this->public_notes; + } return $defaults; } - } diff --git a/app/Models/Company.php b/app/Models/Company.php index c82c9c81dc..8838d9a95b 100644 --- a/app/Models/Company.php +++ b/app/Models/Company.php @@ -52,18 +52,18 @@ class Company extends BaseModel use \Staudenmeir\EloquentHasManyDeep\HasRelationships; use \Staudenmeir\EloquentHasManyDeep\HasTableAlias; - const ENTITY_RECURRING_INVOICE = 'recurring_invoice'; - const ENTITY_CREDIT = 'credit'; - const ENTITY_QUOTE = 'quote'; - const ENTITY_TASK = 'task'; - const ENTITY_EXPENSE = 'expense'; - const ENTITY_PROJECT = 'project'; - const ENTITY_VENDOR = 'vendor'; - const ENTITY_TICKET = 'ticket'; - const ENTITY_PROPOSAL = 'proposal'; - const ENTITY_RECURRING_EXPENSE = 'recurring_expense'; - const ENTITY_RECURRING_TASK = 'task'; - const ENTITY_RECURRING_QUOTE = 'recurring_quote'; + const ENTITY_RECURRING_INVOICE = 'recurring_invoice'; + const ENTITY_CREDIT = 'credit'; + const ENTITY_QUOTE = 'quote'; + const ENTITY_TASK = 'task'; + const ENTITY_EXPENSE = 'expense'; + const ENTITY_PROJECT = 'project'; + const ENTITY_VENDOR = 'vendor'; + const ENTITY_TICKET = 'ticket'; + const ENTITY_PROPOSAL = 'proposal'; + const ENTITY_RECURRING_EXPENSE = 'recurring_expense'; + const ENTITY_RECURRING_TASK = 'task'; + const ENTITY_RECURRING_QUOTE = 'recurring_quote'; protected $presenter = 'App\Models\Presenters\CompanyPresenter'; @@ -271,7 +271,7 @@ class Company extends BaseModel public function designs() { - return $this->hasMany(Design::class)->whereCompanyId($this->id)->orWhere('company_id',null); + return $this->hasMany(Design::class)->whereCompanyId($this->id)->orWhere('company_id', null); } /** @@ -358,8 +358,9 @@ class Company extends BaseModel public function domain() { - if(Ninja::isNinja()) + if (Ninja::isNinja()) { return $this->subdomain . config('ninja.app_domain'); + } return config('ninja.app_url'); } @@ -371,8 +372,6 @@ class Company extends BaseModel public function routeNotificationForSlack($notification) { - return $this->slack_webhook_url; - } } diff --git a/app/Models/CompanyUser.php b/app/Models/CompanyUser.php index 1437604ab1..96d8e2bda3 100644 --- a/app/Models/CompanyUser.php +++ b/app/Models/CompanyUser.php @@ -16,7 +16,6 @@ use Illuminate\Database\Eloquent\SoftDeletes; class CompanyUser extends Pivot { - use \Staudenmeir\EloquentHasManyDeep\HasRelationships; use SoftDeletes; @@ -56,12 +55,12 @@ class CompanyUser extends Pivot public function user_pivot() { - return $this->hasOne(User::class)->withPivot('permissions', 'settings', 'is_admin', 'is_owner', 'is_locked','slack_webhook_url'); + return $this->hasOne(User::class)->withPivot('permissions', 'settings', 'is_admin', 'is_owner', 'is_locked', 'slack_webhook_url'); } public function company_pivot() { - return $this->hasOne(Company::class)->withPivot('permissions', 'settings', 'is_admin', 'is_owner', 'is_locked','slack_webhook_url'); + return $this->hasOne(Company::class)->withPivot('permissions', 'settings', 'is_admin', 'is_owner', 'is_locked', 'slack_webhook_url'); } public function user() @@ -99,7 +98,6 @@ class CompanyUser extends Pivot // 'user_id', // Local key on CompanyToken table... // 'company_id' // Local key on CompanyUser table... // ); - } public function tokens() diff --git a/app/Models/Credit.php b/app/Models/Credit.php index fa30e8da97..efe3b91b77 100644 --- a/app/Models/Credit.php +++ b/app/Models/Credit.php @@ -188,16 +188,17 @@ class Credit extends BaseModel { $storage_path = 'storage/' . $this->client->credit_filepath() . $this->number . '.pdf'; - if (Storage::exists($storage_path)) + if (Storage::exists($storage_path)) { return $storage_path; + } - if(!$invitation) + if (!$invitation) { CreateCreditPdf::dispatchNow($this, $this->company, $this->client->primary_contact()->first()); - else + } else { CreateCreditPdf::dispatchNow($invitation->credit, $invitation->company, $invitation->contact); + } return $storage_path; - } public function markInvitationsSent() @@ -209,5 +210,4 @@ class Credit extends BaseModel } }); } - } diff --git a/app/Models/Currency.php b/app/Models/Currency.php index adc551eb99..ddf6ff08be 100644 --- a/app/Models/Currency.php +++ b/app/Models/Currency.php @@ -18,7 +18,7 @@ class Currency extends StaticModel public $timestamps = false; protected $casts = [ - 'exchange_rate' => 'float', + 'exchange_rate' => 'float', 'swap_currency_symbol' => 'boolean', 'updated_at' => 'timestamp', 'created_at' => 'timestamp', diff --git a/app/Models/Design.php b/app/Models/Design.php index 72ed2794be..cc3524466f 100644 --- a/app/Models/Design.php +++ b/app/Models/Design.php @@ -17,7 +17,6 @@ use Illuminate\Database\Eloquent\SoftDeletes; class Design extends BaseModel { - use Filterable; use SoftDeletes; @@ -38,7 +37,4 @@ class Design extends BaseModel { return $this->belongsTo(Company::class); } - - - -} \ No newline at end of file +} diff --git a/app/Models/ExpenseCategory.php b/app/Models/ExpenseCategory.php index a880b453dc..8cb39c13a3 100644 --- a/app/Models/ExpenseCategory.php +++ b/app/Models/ExpenseCategory.php @@ -17,7 +17,6 @@ use Illuminate\Database\Eloquent\SoftDeletes; class ExpenseCategory extends BaseModel { - use SoftDeletes; protected $fillable = [ diff --git a/app/Models/Invoice.php b/app/Models/Invoice.php index 1ab95921d2..8560e8cc3e 100644 --- a/app/Models/Invoice.php +++ b/app/Models/Invoice.php @@ -156,7 +156,8 @@ class Invoice extends BaseModel public function payments() { - return $this->morphToMany(Payment::class, 'paymentable')->withPivot('amount', 'refunded')->withTimestamps();; + return $this->morphToMany(Payment::class, 'paymentable')->withPivot('amount', 'refunded')->withTimestamps(); + ; } public function company_ledger() @@ -166,8 +167,11 @@ class Invoice extends BaseModel public function credits() { - return $this->belongsToMany(Credit::class)->using(Paymentable::class)->withPivot('amount', - 'refunded')->withTimestamps();; + return $this->belongsToMany(Credit::class)->using(Paymentable::class)->withPivot( + 'amount', + 'refunded' + )->withTimestamps(); + ; } /** @@ -178,7 +182,7 @@ class Invoice extends BaseModel return new InvoiceService($this); } - public function ledger() + public function ledger() { return new LedgerService($this); } @@ -230,7 +234,6 @@ class Invoice extends BaseModel public function isRefundable(): bool { - if ($this->is_deleted) { return false; } @@ -240,7 +243,6 @@ class Invoice extends BaseModel } return true; - } /** @@ -450,6 +452,4 @@ class Invoice extends BaseModel // } // } // } - - } diff --git a/app/Models/InvoiceInvitation.php b/app/Models/InvoiceInvitation.php index 8852c0b5b2..2eb907aa56 100644 --- a/app/Models/InvoiceInvitation.php +++ b/app/Models/InvoiceInvitation.php @@ -18,67 +18,75 @@ use App\Utils\Traits\MakesDates; use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Support\Carbon; -class InvoiceInvitation extends BaseModel { - - use MakesDates; - use SoftDeletes; - use Inviteable; +class InvoiceInvitation extends BaseModel +{ + use MakesDates; + use SoftDeletes; + use Inviteable; - protected $fillable = [ - //'key', - //'client_contact_id', - ]; + protected $fillable = [ + //'key', + //'client_contact_id', + ]; - protected $with = [ - // 'company', - ]; + protected $with = [ + // 'company', + ]; - public function entityType() { - return Invoice::class ; - } + public function entityType() + { + return Invoice::class ; + } - /** - * @return mixed - */ - public function invoice() { - return $this->belongsTo(Invoice::class )->withTrashed(); - } + /** + * @return mixed + */ + public function invoice() + { + return $this->belongsTo(Invoice::class)->withTrashed(); + } - /** - * @return mixed - */ - public function contact() { - return $this->belongsTo(ClientContact::class , 'client_contact_id', 'id')->withTrashed(); - } + /** + * @return mixed + */ + public function contact() + { + return $this->belongsTo(ClientContact::class, 'client_contact_id', 'id')->withTrashed(); + } - /** - * @return mixed - */ - public function user() { - return $this->belongsTo(User::class )->withTrashed(); - } + /** + * @return mixed + */ + public function user() + { + return $this->belongsTo(User::class)->withTrashed(); + } - /** - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo - */ - public function company() { - return $this->belongsTo(Company::class ); - } + /** + * @return \Illuminate\Database\Eloquent\Relations\BelongsTo + */ + public function company() + { + return $this->belongsTo(Company::class); + } - public function signatureDiv() { - if (!$this->signature_base64) { - return false; - } + public function signatureDiv() + { + if (!$this->signature_base64) { + return false; + } - return sprintf('

%s: %s', $this->signature_base64, ctrans('texts.signed'), $this->createClientDate($this->signature_date, $this->contact->client->timezone()->name)); - } + return sprintf('

%s: %s', $this->signature_base64, ctrans('texts.signed'), $this->createClientDate($this->signature_date, $this->contact->client->timezone()->name)); + } - public function getName() { - return $this->key; - } + public function getName() + { + return $this->key; + } - public function markViewed() { - $this->viewed_date = Carbon::now(); - $this->save(); - } + public function markViewed() + { + $this->viewed_date = Carbon::now(); + $this->save(); + } } diff --git a/app/Models/Payment.php b/app/Models/Payment.php index fe4a6cf92d..c56dadcac6 100644 --- a/app/Models/Payment.php +++ b/app/Models/Payment.php @@ -106,12 +106,12 @@ class Payment extends BaseModel public function invoices() { - return $this->morphedByMany(Invoice::class, 'paymentable')->withPivot('amount','refunded')->withTimestamps(); + return $this->morphedByMany(Invoice::class, 'paymentable')->withPivot('amount', 'refunded')->withTimestamps(); } public function credits() { - return $this->morphedByMany(Credit::class, 'paymentable')->withPivot('amount','refunded')->withTimestamps(); + return $this->morphedByMany(Credit::class, 'paymentable')->withPivot('amount', 'refunded')->withTimestamps(); } public function company_ledger() @@ -191,9 +191,7 @@ class Payment extends BaseModel public function refund(array $data) :Payment { - return $this->processRefund($data); - } /** @@ -257,5 +255,4 @@ class Payment extends BaseModel event(new PaymentWasVoided($this)); } - } diff --git a/app/Models/Presenters/CreditPresenter.php b/app/Models/Presenters/CreditPresenter.php index 9959069cee..b108831a79 100644 --- a/app/Models/Presenters/CreditPresenter.php +++ b/app/Models/Presenters/CreditPresenter.php @@ -17,5 +17,4 @@ namespace App\Models\Presenters; */ class CreditPresenter extends EntityPresenter { - } diff --git a/app/Models/Presenters/EntityPresenter.php b/app/Models/Presenters/EntityPresenter.php index 426b1fd2d0..70ddc35f4a 100644 --- a/app/Models/Presenters/EntityPresenter.php +++ b/app/Models/Presenters/EntityPresenter.php @@ -174,5 +174,4 @@ class EntityPresenter extends Presenter { return $this->company->present()->address(); } - -} \ No newline at end of file +} diff --git a/app/Models/Presenters/InvoicePresenter.php b/app/Models/Presenters/InvoicePresenter.php index 48cfd5692d..567113b109 100644 --- a/app/Models/Presenters/InvoicePresenter.php +++ b/app/Models/Presenters/InvoicePresenter.php @@ -44,5 +44,4 @@ class InvoicePresenter extends EntityPresenter return ''; } } - } diff --git a/app/Models/Presenters/QuotePresenter.php b/app/Models/Presenters/QuotePresenter.php index 60690be2d0..2e8f77c1af 100644 --- a/app/Models/Presenters/QuotePresenter.php +++ b/app/Models/Presenters/QuotePresenter.php @@ -44,6 +44,4 @@ class QuotePresenter extends EntityPresenter return ''; } } - - } diff --git a/app/Models/Project.php b/app/Models/Project.php index 6b1d0488a4..e924474301 100644 --- a/app/Models/Project.php +++ b/app/Models/Project.php @@ -60,7 +60,4 @@ class Project extends BaseModel // { // return $this->hasMany('App\Models\Task'); // } - - } - diff --git a/app/Models/Quote.php b/app/Models/Quote.php index 2a3ca6cfe4..6fed6f116a 100644 --- a/app/Models/Quote.php +++ b/app/Models/Quote.php @@ -150,15 +150,16 @@ class Quote extends BaseModel { $storage_path = 'storage/' . $this->client->quote_filepath() . $this->number . '.pdf'; - if (Storage::exists($storage_path)) + if (Storage::exists($storage_path)) { return $storage_path; + } - if(!$invitation) + if (!$invitation) { CreateQuotePdf::dispatchNow($this, $this->company, $this->client->primary_contact()->first()); - else + } else { CreateQuotePdf::dispatchNow($invitation->quote, $invitation->company, $invitation->contact); + } return $storage_path; - } } diff --git a/app/Models/QuoteInvitation.php b/app/Models/QuoteInvitation.php index 375df47ba7..97b0c19bc0 100644 --- a/app/Models/QuoteInvitation.php +++ b/app/Models/QuoteInvitation.php @@ -72,7 +72,8 @@ class QuoteInvitation extends BaseModel return sprintf('

%s: %s', $this->signature_base64, ctrans('texts.signed'), $this->createClientDate($this->signature_date, $this->contact->client->timezone()->name)); } - public function markViewed() { + public function markViewed() + { $this->viewed_date = Carbon::now(); $this->save(); } diff --git a/app/Models/RecurringInvoice.php b/app/Models/RecurringInvoice.php index cad00ba774..88bf815524 100644 --- a/app/Models/RecurringInvoice.php +++ b/app/Models/RecurringInvoice.php @@ -44,10 +44,10 @@ class RecurringInvoice extends BaseModel /* Make sure we support overflow!!!!!!!!!! $start = Carbon::today(); $subscription = Carbon::parse('2017-12-31'); - + foreach (range(1, 12) as $month) { $day = $start->addMonthNoOverflow()->thisDayOrLast($subscription->day); - + echo "You will be billed on {$day} in month {$month}\n"; } */ diff --git a/app/Models/User.php b/app/Models/User.php index 788948f8f7..7b5f07a8fc 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -155,10 +155,11 @@ class User extends Authenticatable implements MustVerifyEmail */ public function getCompany() { - if($this->company) + if ($this->company) { return $this->company; + } - return Company::find( config('ninja.company_id') ); + return Company::find(config('ninja.company_id')); } /** @@ -304,10 +305,9 @@ class User extends Authenticatable implements MustVerifyEmail public function routeNotificationForSlack($notification) { - - if($this->company_user->slack_webhook_url) + if ($this->company_user->slack_webhook_url) { return $this->company_user->slack_webhook_url; - + } } diff --git a/app/Models/Vendor.php b/app/Models/Vendor.php index c512547b2f..de2cd58320 100644 --- a/app/Models/Vendor.php +++ b/app/Models/Vendor.php @@ -77,4 +77,3 @@ class Vendor extends BaseModel return $this->hasMany(Activity::class); } } - diff --git a/app/Notifications/Admin/EntitySentNotification.php b/app/Notifications/Admin/EntitySentNotification.php index b6b4999398..b9afa0c564 100644 --- a/app/Notifications/Admin/EntitySentNotification.php +++ b/app/Notifications/Admin/EntitySentNotification.php @@ -22,17 +22,17 @@ class EntitySentNotification extends Notification implements ShouldQueue * @return void */ - protected $invitation; + protected $invitation; - protected $entity; + protected $entity; - protected $entity_name; + protected $entity_name; - protected $settings; + protected $settings; - public $is_system; + public $is_system; - public $method; + public $method; protected $contact; @@ -69,22 +69,25 @@ class EntitySentNotification extends Notification implements ShouldQueue */ public function toMail($notifiable) { - $amount = Number::formatMoney($this->entity->amount, $this->entity->client); - $subject = ctrans("texts.notification_{$this->entity_name}_sent_subject", - [ - 'client' => $this->contact->present()->name(), + $subject = ctrans( + "texts.notification_{$this->entity_name}_sent_subject", + [ + 'client' => $this->contact->present()->name(), 'invoice' => $this->entity->number, - ]); + ] + ); $data = [ 'title' => $subject, - 'message' => ctrans("texts.notification_{$this->entity_name}_sent", + 'message' => ctrans( + "texts.notification_{$this->entity_name}_sent", [ - 'amount' => $amount, - 'client' => $this->contact->present()->name(), + 'amount' => $amount, + 'client' => $this->contact->present()->name(), 'invoice' => $this->entity->number, - ]), + ] + ), 'url' => $this->invitation->getAdminLink(), 'button' => ctrans("texts.view_{$this->entity_name}"), 'signature' => $this->settings->email_signature, @@ -95,8 +98,6 @@ class EntitySentNotification extends Notification implements ShouldQueue return (new MailMessage) ->subject($subject) ->markdown('email.admin.generic', $data); - - } /** @@ -121,10 +122,10 @@ class EntitySentNotification extends Notification implements ShouldQueue // ->success() // ->from(ctrans('texts.notification_bot')) // ->image($logo) - // ->content(ctrans('texts.notification_invoice_sent', + // ->content(ctrans('texts.notification_invoice_sent', // [ - // 'amount' => $amount, - // 'client' => $this->contact->present()->name(), + // 'amount' => $amount, + // 'client' => $this->contact->present()->name(), // 'invoice' => $this->invoice->number // ])); @@ -133,13 +134,15 @@ class EntitySentNotification extends Notification implements ShouldQueue ->from(ctrans('texts.notification_bot')) ->success() ->image('https://app.invoiceninja.com/favicon-v2.png') - ->content(trans("texts.notification_{$this->entity_name}_sent_subject", - [ - 'amount' => $amount, - 'client' => $this->contact->present()->name(), + ->content(trans( + "texts.notification_{$this->entity_name}_sent_subject", + [ + 'amount' => $amount, + 'client' => $this->contact->present()->name(), 'invoice' => $this->entity->number - ])) - ->attachment(function ($attachment) use($amount){ + ] + )) + ->attachment(function ($attachment) use ($amount) { $attachment->title(ctrans('texts.invoice_number_placeholder', ['invoice' => $this->entity->number]), $this->invitation->getAdminLink()) ->fields([ ctrans('texts.client') => $this->contact->present()->name(), @@ -147,5 +150,4 @@ class EntitySentNotification extends Notification implements ShouldQueue ]); }); } - } diff --git a/app/Notifications/Admin/EntityViewedNotification.php b/app/Notifications/Admin/EntityViewedNotification.php index 85eaca0b09..4cae663102 100644 --- a/app/Notifications/Admin/EntityViewedNotification.php +++ b/app/Notifications/Admin/EntityViewedNotification.php @@ -14,7 +14,6 @@ use Illuminate\Notifications\Notification; class EntityViewedNotification extends Notification implements ShouldQueue { - use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; /** @@ -24,19 +23,19 @@ class EntityViewedNotification extends Notification implements ShouldQueue * @ */ - protected $invitation; + protected $invitation; - protected $entity_name; + protected $entity_name; - protected $entity; + protected $entity; - protected $company; + protected $company; - protected $settings; + protected $settings; - public $method; + public $method; - protected $contact; + protected $contact; public function __construct($invitation, $entity_name, $is_system = false, $settings = null) { @@ -58,9 +57,7 @@ class EntityViewedNotification extends Notification implements ShouldQueue */ public function via($notifiable) { - return $this->method ?: []; - } /** @@ -101,36 +98,38 @@ class EntityViewedNotification extends Notification implements ShouldQueue ->from(ctrans('texts.notification_bot')) ->success() ->image('https://app.invoiceninja.com/favicon-v2.png') - ->content(ctrans("texts.notification_{$this->entity_name}_viewed", + ->content(ctrans( + "texts.notification_{$this->entity_name}_viewed", [ - 'amount' => $amount, - 'client' => $this->contact->present()->name(), + 'amount' => $amount, + 'client' => $this->contact->present()->name(), $this->entity_name => $this->entity->number - ])) - ->attachment(function ($attachment) use($amount){ + ] + )) + ->attachment(function ($attachment) use ($amount) { $attachment->title(ctrans('texts.entity_number_placeholder', ['entity' => ucfirst($this->entity_name), 'entity_number' => $this->entity->number]), $this->invitation->getAdminLink()) ->fields([ ctrans('texts.client') => $this->contact->present()->name(), ctrans('texts.status_viewed') => $this->invitation->viewed_date, ]); }); - } private function buildDataArray() { - $amount = Number::formatMoney($this->entity->amount, $this->entity->client); $data = [ 'title' => $this->buildSubject(), - 'message' => ctrans("texts.notification_{$this->entity_name}_viewed", + 'message' => ctrans( + "texts.notification_{$this->entity_name}_viewed", [ - 'amount' => $amount, - 'client' => $this->contact->present()->name(), + 'amount' => $amount, + 'client' => $this->contact->present()->name(), $this->entity_name => $this->entity->number, - ]), + ] + ), 'url' => $this->invitation->getAdminLink(), 'button' => ctrans("texts.view_{$this->entity_name}"), 'signature' => $this->settings->email_signature, @@ -139,18 +138,18 @@ class EntityViewedNotification extends Notification implements ShouldQueue return $data; - } private function buildSubject() { - $subject = ctrans("texts.notification_{$this->entity_name}_viewed_subject", - [ - 'client' => $this->contact->present()->name(), + $subject = ctrans( + "texts.notification_{$this->entity_name}_viewed_subject", + [ + 'client' => $this->contact->present()->name(), $this->entity_name => $this->entity->number, - ]); + ] + ); return $subject; - } } diff --git a/app/Notifications/Admin/InvoiceSentNotification.php b/app/Notifications/Admin/InvoiceSentNotification.php index 18c0c82a8b..ff6bebedd3 100644 --- a/app/Notifications/Admin/InvoiceSentNotification.php +++ b/app/Notifications/Admin/InvoiceSentNotification.php @@ -22,17 +22,17 @@ class InvoiceSentNotification extends Notification implements ShouldQueue * @return void */ - protected $invitation; + protected $invitation; - protected $invoice; + protected $invoice; - protected $company; + protected $company; - protected $settings; + protected $settings; - public $is_system; + public $is_system; - protected $contact; + protected $contact; public function __construct($invitation, $company, $is_system = false, $settings = null) { @@ -52,7 +52,6 @@ class InvoiceSentNotification extends Notification implements ShouldQueue */ public function via($notifiable) { - return $this->is_system ? ['slack'] : ['mail']; } @@ -64,22 +63,25 @@ class InvoiceSentNotification extends Notification implements ShouldQueue */ public function toMail($notifiable) { - $amount = Number::formatMoney($this->invoice->amount, $this->invoice->client); - $subject = ctrans('texts.notification_invoice_sent_subject', - [ - 'client' => $this->contact->present()->name(), + $subject = ctrans( + 'texts.notification_invoice_sent_subject', + [ + 'client' => $this->contact->present()->name(), 'invoice' => $this->invoice->number, - ]); + ] + ); $data = [ 'title' => $subject, - 'message' => ctrans('texts.notification_invoice_sent', + 'message' => ctrans( + 'texts.notification_invoice_sent', [ - 'amount' => $amount, - 'client' => $this->contact->present()->name(), + 'amount' => $amount, + 'client' => $this->contact->present()->name(), 'invoice' => $this->invoice->number, - ]), + ] + ), 'url' => config('ninja.app_url') . '/invoices/' . $this->invoice->hashed_id, 'button' => ctrans('texts.view_invoice'), 'signature' => $this->settings->email_signature, @@ -90,8 +92,6 @@ class InvoiceSentNotification extends Notification implements ShouldQueue return (new MailMessage) ->subject($subject) ->markdown('email.admin.generic', $data); - - } /** @@ -116,10 +116,10 @@ class InvoiceSentNotification extends Notification implements ShouldQueue // ->success() // ->from(ctrans('texts.notification_bot')) // ->image($logo) - // ->content(ctrans('texts.notification_invoice_sent', + // ->content(ctrans('texts.notification_invoice_sent', // [ - // 'amount' => $amount, - // 'client' => $this->contact->present()->name(), + // 'amount' => $amount, + // 'client' => $this->contact->present()->name(), // 'invoice' => $this->invoice->number // ])); @@ -128,13 +128,15 @@ class InvoiceSentNotification extends Notification implements ShouldQueue ->from(ctrans('texts.notification_bot')) ->success() ->image('https://app.invoiceninja.com/favicon-v2.png') - ->content(trans('texts.notification_invoice_sent_subject', - [ - 'amount' => $amount, - 'client' => $this->contact->present()->name(), + ->content(trans( + 'texts.notification_invoice_sent_subject', + [ + 'amount' => $amount, + 'client' => $this->contact->present()->name(), 'invoice' => $this->invoice->number - ])) - ->attachment(function ($attachment) use($amount){ + ] + )) + ->attachment(function ($attachment) use ($amount) { $attachment->title(ctrans('texts.invoice_number_placeholder', ['invoice' => $this->invoice->number]), $this->invitation->getAdminLink()) ->fields([ ctrans('texts.client') => $this->contact->present()->name(), @@ -142,5 +144,4 @@ class InvoiceSentNotification extends Notification implements ShouldQueue ]); }); } - } diff --git a/app/Notifications/Admin/InvoiceViewedNotification.php b/app/Notifications/Admin/InvoiceViewedNotification.php index c7224111ea..c2b4bff14b 100644 --- a/app/Notifications/Admin/InvoiceViewedNotification.php +++ b/app/Notifications/Admin/InvoiceViewedNotification.php @@ -22,17 +22,17 @@ class InvoiceViewedNotification extends Notification implements ShouldQueue * @return void */ - protected $invitation; + protected $invitation; - protected $invoice; + protected $invoice; - protected $company; + protected $company; - protected $settings; + protected $settings; - public $is_system; + public $is_system; - protected $contact; + protected $contact; public function __construct($invitation, $company, $is_system = false, $settings = null) { @@ -51,7 +51,6 @@ class InvoiceViewedNotification extends Notification implements ShouldQueue */ public function via($notifiable) { - return $this->is_system ? ['slack'] : ['mail']; } @@ -63,22 +62,25 @@ class InvoiceViewedNotification extends Notification implements ShouldQueue */ public function toMail($notifiable) { - $amount = Number::formatMoney($this->invoice->amount, $this->invoice->client); - $subject = ctrans('texts.notification_invoice_viewed_subject', - [ - 'client' => $this->contact->present()->name(), + $subject = ctrans( + 'texts.notification_invoice_viewed_subject', + [ + 'client' => $this->contact->present()->name(), 'invoice' => $this->invoice->number, - ]); + ] + ); $data = [ 'title' => $subject, - 'message' => ctrans('texts.notification_invoice_viewed', + 'message' => ctrans( + 'texts.notification_invoice_viewed', [ - 'amount' => $amount, - 'client' => $this->contact->present()->name(), + 'amount' => $amount, + 'client' => $this->contact->present()->name(), 'invoice' => $this->invoice->number, - ]), + ] + ), 'url' => config('ninja.app_url') . '/invoices/' . $this->invoice->hashed_id, 'button' => ctrans('texts.view_invoice'), 'signature' => $this->settings->email_signature, @@ -89,8 +91,6 @@ class InvoiceViewedNotification extends Notification implements ShouldQueue return (new MailMessage) ->subject($subject) ->markdown('email.admin.generic', $data); - - } /** @@ -115,13 +115,13 @@ class InvoiceViewedNotification extends Notification implements ShouldQueue ->success() ->from(ctrans('texts.notification_bot')) ->image($logo) - ->content(ctrans('texts.notification_invoice_viewed', - [ - 'amount' => $amount, - 'client' => $this->contact->present()->name(), + ->content(ctrans( + 'texts.notification_invoice_viewed', + [ + 'amount' => $amount, + 'client' => $this->contact->present()->name(), 'invoice' => $this->invoice->number - ])); - + ] + )); } - } diff --git a/app/Notifications/Admin/NewPartialPaymentNotification.php b/app/Notifications/Admin/NewPartialPaymentNotification.php index 064905f628..53353cc0af 100644 --- a/app/Notifications/Admin/NewPartialPaymentNotification.php +++ b/app/Notifications/Admin/NewPartialPaymentNotification.php @@ -27,7 +27,7 @@ class NewPartialPaymentNotification extends Notification implements ShouldQueue protected $company; - protected $settings; + protected $settings; protected $is_system; @@ -47,7 +47,6 @@ class NewPartialPaymentNotification extends Notification implements ShouldQueue */ public function via($notifiable) { - return $this->is_system ? ['slack'] : ['mail']; } @@ -63,19 +62,24 @@ class NewPartialPaymentNotification extends Notification implements ShouldQueue $invoice_texts = ctrans('texts.invoice_number_short'); - foreach($this->payment->invoices as $invoice) + foreach ($this->payment->invoices as $invoice) { $invoice_texts .= $invoice->number . ','; + } $invoice_texts = substr($invoice_texts, 0, -1); $data = [ - 'title' => ctrans('texts.notification_partial_payment_paid_subject', - ['client' => $this->payment->client->present()->name()]), - 'message' => ctrans('texts.notification_partial_payment_paid', - ['amount' => $amount, - 'client' => $this->payment->client->present()->name(), + 'title' => ctrans( + 'texts.notification_partial_payment_paid_subject', + ['client' => $this->payment->client->present()->name()] + ), + 'message' => ctrans( + 'texts.notification_partial_payment_paid', + ['amount' => $amount, + 'client' => $this->payment->client->present()->name(), 'invoice' => $invoice_texts, - ]), + ] + ), 'url' => config('ninja.app_url') . '/payments/' . $this->payment->hashed_id, 'button' => ctrans('texts.view_payment'), 'signature' => $this->settings->email_signature, @@ -84,11 +88,12 @@ class NewPartialPaymentNotification extends Notification implements ShouldQueue return (new MailMessage) - ->subject(ctrans('texts.notification_partial_payment_paid_subject', - ['client' => $this->payment->client->present()->name()]) + ->subject( + ctrans( + 'texts.notification_partial_payment_paid_subject', + ['client' => $this->payment->client->present()->name()] + ) )->markdown('email.admin.generic', $data); - - } /** @@ -110,8 +115,9 @@ class NewPartialPaymentNotification extends Notification implements ShouldQueue $amount = Number::formatMoney($this->payment->amount, $this->payment->client); $invoice_texts = ctrans('texts.invoice_number_short'); - foreach($this->payment->invoices as $invoice) + foreach ($this->payment->invoices as $invoice) { $invoice_texts .= $invoice->number . ','; + } $invoice_texts = substr($invoice_texts, 0, -1); @@ -120,10 +126,11 @@ class NewPartialPaymentNotification extends Notification implements ShouldQueue //->to("#devv2") ->from("System") ->image($logo) - ->content(ctrans('texts.notification_payment_paid', - ['amount' => $amount, - 'client' => $this->payment->client->present()->name(), - 'invoice' => $invoice_texts])); + ->content(ctrans( + 'texts.notification_payment_paid', + ['amount' => $amount, + 'client' => $this->payment->client->present()->name(), + 'invoice' => $invoice_texts] + )); } - } diff --git a/app/Notifications/Admin/NewPaymentNotification.php b/app/Notifications/Admin/NewPaymentNotification.php index 4f9c8b37e7..c98e1859e6 100644 --- a/app/Notifications/Admin/NewPaymentNotification.php +++ b/app/Notifications/Admin/NewPaymentNotification.php @@ -27,7 +27,7 @@ class NewPaymentNotification extends Notification implements ShouldQueue protected $company; - protected $settings; + protected $settings; protected $is_system; @@ -47,7 +47,6 @@ class NewPaymentNotification extends Notification implements ShouldQueue */ public function via($notifiable) { - return $this->is_system ? ['slack'] : ['mail']; } @@ -63,19 +62,24 @@ class NewPaymentNotification extends Notification implements ShouldQueue $invoice_texts = ctrans('texts.invoice_number_short'); - foreach($this->payment->invoices as $invoice) + foreach ($this->payment->invoices as $invoice) { $invoice_texts .= $invoice->number . ','; + } $invoice_texts = substr($invoice_texts, 0, -1); $data = [ - 'title' => ctrans('texts.notification_payment_paid_subject', - ['client' => $this->payment->client->present()->name()]), - 'message' => ctrans('texts.notification_payment_paid', - ['amount' => $amount, - 'client' => $this->payment->client->present()->name(), + 'title' => ctrans( + 'texts.notification_payment_paid_subject', + ['client' => $this->payment->client->present()->name()] + ), + 'message' => ctrans( + 'texts.notification_payment_paid', + ['amount' => $amount, + 'client' => $this->payment->client->present()->name(), 'invoice' => $invoice_texts, - ]), + ] + ), 'url' => config('ninja.app_url') . '/payments/' . $this->payment->hashed_id, 'button' => ctrans('texts.view_payment'), 'signature' => $this->settings->email_signature, @@ -84,11 +88,12 @@ class NewPaymentNotification extends Notification implements ShouldQueue return (new MailMessage) - ->subject(ctrans('texts.notification_payment_paid_subject', - ['client' => $this->payment->client->present()->name(),]) + ->subject( + ctrans( + 'texts.notification_payment_paid_subject', + ['client' => $this->payment->client->present()->name(),] + ) )->markdown('email.admin.generic', $data); - - } /** @@ -110,8 +115,9 @@ class NewPaymentNotification extends Notification implements ShouldQueue $amount = Number::formatMoney($this->payment->amount, $this->payment->client); $invoice_texts = ctrans('texts.invoice_number_short'); - foreach($this->payment->invoices as $invoice) + foreach ($this->payment->invoices as $invoice) { $invoice_texts .= $invoice->number . ','; + } $invoice_texts = substr($invoice_texts, 0, -1); @@ -120,10 +126,11 @@ class NewPaymentNotification extends Notification implements ShouldQueue //->to("#devv2") ->from("System") ->image($logo) - ->content(ctrans('texts.notification_payment_paid', - ['amount' => $amount, - 'client' => $this->payment->client->present()->name(), - 'invoice' => $invoice_texts])); + ->content(ctrans( + 'texts.notification_payment_paid', + ['amount' => $amount, + 'client' => $this->payment->client->present()->name(), + 'invoice' => $invoice_texts] + )); } - } diff --git a/app/Notifications/NewAccountCreated.php b/app/Notifications/NewAccountCreated.php index d01afa8914..ee2c2df48b 100644 --- a/app/Notifications/NewAccountCreated.php +++ b/app/Notifications/NewAccountCreated.php @@ -54,7 +54,6 @@ class NewAccountCreated extends Notification implements ShouldQueue */ public function toMail($notifiable) { - $user_name = $this->user->first_name . " " . $this->user->last_name; $email = $this->user->email; $ip = $this->user->ip; @@ -72,8 +71,6 @@ class NewAccountCreated extends Notification implements ShouldQueue return (new MailMessage) ->subject(ctrans('texts.new_signup')) ->markdown('email.admin.generic', $data); - - } /** @@ -91,7 +88,6 @@ class NewAccountCreated extends Notification implements ShouldQueue public function toSlack($notifiable) { - $this->user->setCompany($this->company); $user_name = $this->user->first_name . " " . $this->user->last_name; diff --git a/app/Notifications/Ninja/NewAccountCreated.php b/app/Notifications/Ninja/NewAccountCreated.php index 7b0bbb6438..3714b0494d 100644 --- a/app/Notifications/Ninja/NewAccountCreated.php +++ b/app/Notifications/Ninja/NewAccountCreated.php @@ -14,7 +14,6 @@ use Illuminate\Notifications\Notification; class NewAccountCreated extends Notification implements ShouldQueue { - use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; /** @@ -55,7 +54,6 @@ class NewAccountCreated extends Notification implements ShouldQueue */ public function toMail($notifiable) { - $user_name = $this->user->first_name . " " . $this->user->last_name; $email = $this->user->email; $ip = $this->user->ip; @@ -73,8 +71,6 @@ class NewAccountCreated extends Notification implements ShouldQueue return (new MailMessage) ->subject(ctrans('texts.new_signup')) ->markdown('email.admin.generic', $data); - - } /** @@ -92,7 +88,6 @@ class NewAccountCreated extends Notification implements ShouldQueue public function toSlack($notifiable) { - $this->user->setCompany($this->company); $user_name = $this->user->first_name . " " . $this->user->last_name; diff --git a/app/Notifications/Ninja/VerifyUser.php b/app/Notifications/Ninja/VerifyUser.php index 9623c8d391..9ba76c367f 100644 --- a/app/Notifications/Ninja/VerifyUser.php +++ b/app/Notifications/Ninja/VerifyUser.php @@ -14,7 +14,6 @@ use Illuminate\Notifications\Notification; class VerifyUser extends Notification implements ShouldQueue { - use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; /** @@ -49,7 +48,6 @@ class VerifyUser extends Notification implements ShouldQueue */ public function toMail($notifiable) { - $data = [ 'title' => ctrans('texts.confirmation_subject'), 'message' => ctrans('texts.confirmation_message'), @@ -62,8 +60,6 @@ class VerifyUser extends Notification implements ShouldQueue return (new MailMessage) ->subject(ctrans('texts.confirmation_subject')) ->markdown('email.admin.generic', $data); - - } /** @@ -81,6 +77,5 @@ class VerifyUser extends Notification implements ShouldQueue public function toSlack($notifiable) { - } } diff --git a/app/PaymentDrivers/BasePaymentDriver.php b/app/PaymentDrivers/BasePaymentDriver.php index f838913f09..2e6390c96e 100644 --- a/app/PaymentDrivers/BasePaymentDriver.php +++ b/app/PaymentDrivers/BasePaymentDriver.php @@ -285,6 +285,4 @@ class BasePaymentDriver return $payment; } - - } diff --git a/app/Providers/AuthServiceProvider.php b/app/Providers/AuthServiceProvider.php index ff18b59bea..41a9aaa60a 100644 --- a/app/Providers/AuthServiceProvider.php +++ b/app/Providers/AuthServiceProvider.php @@ -89,10 +89,10 @@ class AuthServiceProvider extends ServiceProvider Auth::provider('users', function ($app, array $config) { return new MultiDatabaseUserProvider($this->app['hash'], $config['model']); }); - + Auth::provider('contacts', function ($app, array $config) { return new MultiDatabaseUserProvider($this->app['hash'], $config['model']); - + }); */ Gate::define('view-list', function ($user, $entity) { diff --git a/app/Providers/MultiDBProvider.php b/app/Providers/MultiDBProvider.php index 9ab4fc4153..c5e594634c 100644 --- a/app/Providers/MultiDBProvider.php +++ b/app/Providers/MultiDBProvider.php @@ -32,26 +32,20 @@ class MultiDBProvider extends ServiceProvider */ public function register() { - if($this->app->runningInConsole()){ + if ($this->app->runningInConsole()) { return; } - $this->app['events']->listen(\Illuminate\Queue\Events\JobProcessing::class, function($event) { + $this->app['events']->listen( + \Illuminate\Queue\Events\JobProcessing::class, + function ($event) { + if (isset($event->job->payload()['db'])) { + \Log::error("Provider Setting DB = ".$event->job->payload()['db']); - if (isset($event->job->payload()['db'])) { - - \Log::error("Provider Setting DB = ".$event->job->payload()['db']); - - MultiDB::setDb($event->job->payload()['db']); + MultiDB::setDb($event->job->payload()['db']); + } } - - } - - ); - - } - } diff --git a/app/Repositories/BaseRepository.php b/app/Repositories/BaseRepository.php index 2edf1f4396..69318e7106 100644 --- a/app/Repositories/BaseRepository.php +++ b/app/Repositories/BaseRepository.php @@ -169,39 +169,41 @@ class BaseRepository } public function getInvitation($invitation, $resource) - { - - if(!array_key_exists('key', $invitation)) + { + if (!array_key_exists('key', $invitation)) { return false; + } $invitation_class = sprintf("App\\Models\\%sInvitation", $resource); - $invitation = $invitation_class::whereRaw("BINARY `key`= ?", [$invitation['key']])->first(); + $invitation = $invitation_class::whereRaw("BINARY `key`= ?", [$invitation['key']])->first(); return $invitation; - } + } /** * Alternative save used for Invoices, Quotes & Credits. */ protected function alternativeSave($data, $model) { - $class = new ReflectionClass($model); + $class = new ReflectionClass($model); - if(array_key_exists('client_id', $data)) + if (array_key_exists('client_id', $data)) { $client = Client::find($data['client_id']); - else + } else { $client = Client::find($model->client_id); + } $state = []; $resource = explode('\\', $class->name)[2]; /** This will extract 'Invoice' from App\Models\Invoice */ $lcfirst_resource_id = lcfirst($resource) . '_id'; - if ($class->name == Invoice::class || $class->name == Quote::class) + if ($class->name == Invoice::class || $class->name == Quote::class) { $state['starting_amount'] = $model->amount; + } if (!$model->id) { - $company_defaults = $client->setCompanyDefaults($data,lcfirst($resource)); + $company_defaults = $client->setCompanyDefaults($data, lcfirst($resource)); $model->uses_inclusive_taxes = $client->getSetting('inclusive_taxes'); $data = array_merge($company_defaults, $data); @@ -233,8 +235,7 @@ class BaseRepository foreach ($data['invitations'] as $invitation) { //if no invitations are present - create one. - if (! $this->getInvitation($invitation, $resource) ) { - + if (! $this->getInvitation($invitation, $resource)) { if (isset($invitation['id'])) { unset($invitation['id']); } @@ -242,41 +243,38 @@ class BaseRepository //make sure we are creating an invite for a contact who belongs to the client only! $contact = ClientContact::find($invitation['client_contact_id']); - if($model->client_id == $contact->client_id); + if ($model->client_id == $contact->client_id); { $new_invitation = $invitation_factory_class::create($model->company_id, $model->user_id); $new_invitation->{$lcfirst_resource_id} = $model->id; $new_invitation->client_contact_id = $invitation['client_contact_id']; $new_invitation->save(); } - } } } $model->load('invitations'); - /* If no invitations have been created, this is our fail safe to maintain state*/ - if ($model->invitations->count() == 0) { - $model->service()->createInvitations(); - } + /* If no invitations have been created, this is our fail safe to maintain state*/ + if ($model->invitations->count() == 0) { + $model->service()->createInvitations(); + } - $state['finished_amount'] = $model->amount; + $state['finished_amount'] = $model->amount; - $model = $model->service()->applyNumber()->save(); + $model = $model->service()->applyNumber()->save(); if ($model->company->update_products !== false) { UpdateOrCreateProduct::dispatch($model->line_items, $model, $model->company); } if ($class->name == Invoice::class) { - if (($state['finished_amount'] != $state['starting_amount']) && ($model->status_id != Invoice::STATUS_DRAFT)) { $model->ledger()->updateInvoiceBalance(($state['finished_amount'] - $state['starting_amount'])); } $model = $model->calc()->getInvoice(); - } if ($class->name == Credit::class) { @@ -289,6 +287,6 @@ class BaseRepository $model->save(); - return $model->fresh(); + return $model->fresh(); } -} \ No newline at end of file +} diff --git a/app/Repositories/ClientContactRepository.php b/app/Repositories/ClientContactRepository.php index 440ec0860c..5c83eb01fa 100644 --- a/app/Repositories/ClientContactRepository.php +++ b/app/Repositories/ClientContactRepository.php @@ -24,10 +24,11 @@ class ClientContactRepository extends BaseRepository { public function save(array $data, Client $client) : void { - if(isset($data['contacts'])) + if (isset($data['contacts'])) { $contacts = collect($data['contacts']); - else + } else { $contacts = collect(); + } $client->contacts->pluck('id')->diff($contacts->pluck('id'))->each(function ($contact) { ClientContact::destroy($contact); @@ -56,22 +57,15 @@ class ClientContactRepository extends BaseRepository $update_contact->fill($contact); - if(array_key_exists('password', $contact)) { - - if(strlen($contact['password']) == 0){ - + if (array_key_exists('password', $contact)) { + if (strlen($contact['password']) == 0) { $update_contact->password = ''; - - } - else{ - + } else { $update_contact->password = Hash::make($contact['password']); } - } $update_contact->save(); - }); @@ -84,8 +78,5 @@ class ClientContactRepository extends BaseRepository $new_contact->is_primary = true; $new_contact->save(); } - } - - } diff --git a/app/Repositories/ClientRepository.php b/app/Repositories/ClientRepository.php index 8d058c9a38..be461b6f11 100644 --- a/app/Repositories/ClientRepository.php +++ b/app/Repositories/ClientRepository.php @@ -54,19 +54,18 @@ class ClientRepository extends BaseRepository * @param \App\Models\Client $client The client * * @return Client|\App\Models\Client|null Client Object - * + * * @todo Write tests to make sure that custom client numbers work as expected. */ public function save(array $data, Client $client) : ?Client { - $client->fill($data); $client->save(); if ($client->id_number == "" || !$client->id_number) { $client->id_number = $this->getNextClientNumber($client); - } + } $client->save(); diff --git a/app/Repositories/CompanyRepository.php b/app/Repositories/CompanyRepository.php index 6c6329dd7f..c1095d5411 100644 --- a/app/Repositories/CompanyRepository.php +++ b/app/Repositories/CompanyRepository.php @@ -49,12 +49,13 @@ class CompanyRepository extends BaseRepository $company->fill($data); - if(array_key_exists('settings', $data)) + if (array_key_exists('settings', $data)) { $company->saveSettings($data['settings'], $company); + } $company->save(); -//\Log::error(print_r($company->settings,1)); + //\Log::error(print_r($company->settings,1)); return $company; } diff --git a/app/Repositories/CreditRepository.php b/app/Repositories/CreditRepository.php index cf690dec18..4b450d13b6 100644 --- a/app/Repositories/CreditRepository.php +++ b/app/Repositories/CreditRepository.php @@ -56,5 +56,4 @@ class CreditRepository extends BaseRepository { return CreditInvitation::whereRaw("BINARY `key`= ?", [$key])->first(); } - -} \ No newline at end of file +} diff --git a/app/Repositories/InvoiceRepository.php b/app/Repositories/InvoiceRepository.php index 6babdf7dea..26e063dad0 100644 --- a/app/Repositories/InvoiceRepository.php +++ b/app/Repositories/InvoiceRepository.php @@ -23,41 +23,44 @@ use App\Utils\Traits\MakesHash; * InvoiceRepository */ -class InvoiceRepository extends BaseRepository { - use MakesHash; +class InvoiceRepository extends BaseRepository +{ + use MakesHash; - /** - * Gets the class name. - * - * @return string The class name. - */ - public function getClassName() { - return Invoice::class ; - } + /** + * Gets the class name. + * + * @return string The class name. + */ + public function getClassName() + { + return Invoice::class ; + } - /** - * Saves the invoices - * - * @param array. $data The invoice data - * @param InvoiceSum|\App\Models\Invoice $invoice The invoice - * - * @return Invoice|InvoiceSum|\App\Models\Invoice|null Returns the invoice object - */ - public function save($data, Invoice $invoice):?Invoice - { - return $this->alternativeSave($data, $invoice); - } + /** + * Saves the invoices + * + * @param array. $data The invoice data + * @param InvoiceSum|\App\Models\Invoice $invoice The invoice + * + * @return Invoice|InvoiceSum|\App\Models\Invoice|null Returns the invoice object + */ + public function save($data, Invoice $invoice):?Invoice + { + return $this->alternativeSave($data, $invoice); + } - /** - * Mark the invoice as sent. - * - * @param \App\Models\Invoice $invoice The invoice - * - * @return Invoice|\App\Models\Invoice|null Return the invoice object - */ - public function markSent(Invoice $invoice):?Invoice { - return $invoice->service()->markSent()->save(); - } + /** + * Mark the invoice as sent. + * + * @param \App\Models\Invoice $invoice The invoice + * + * @return Invoice|\App\Models\Invoice|null Return the invoice object + */ + public function markSent(Invoice $invoice):?Invoice + { + return $invoice->service()->markSent()->save(); + } public function getInvitationByKey($key) :?InvoiceInvitation { diff --git a/app/Repositories/PaymentRepository.php b/app/Repositories/PaymentRepository.php index bc2869bda0..e98d96c50c 100644 --- a/app/Repositories/PaymentRepository.php +++ b/app/Repositories/PaymentRepository.php @@ -26,7 +26,6 @@ use Illuminate\Http\Request; */ class PaymentRepository extends BaseRepository { - protected $credit_repo; public function __construct(CreditRepository $credit_repo) @@ -49,12 +48,11 @@ class PaymentRepository extends BaseRepository */ public function save(array $data, Payment $payment): ?Payment { - - if ($payment->amount >= 0) + if ($payment->amount >= 0) { return $this->applyPayment($data, $payment); + } return $this->refundPayment($data, $payment); - } /** @@ -66,8 +64,9 @@ class PaymentRepository extends BaseRepository private function applyPayment(array $data, Payment $payment): ?Payment { //check currencies here and fill the exchange rate data if necessary - if(!$payment->id) + if (!$payment->id) { $this->processExchangeRates($data, $payment); + } $payment->fill($data); @@ -75,8 +74,9 @@ class PaymentRepository extends BaseRepository $payment->save(); - if (!$payment->number || strlen($payment->number) == 0) + if (!$payment->number || strlen($payment->number) == 0) { $payment->number = $payment->client->getNextPaymentNumber($payment->client); + } $payment->client->service()->updatePaidToDate($payment->amount)->save(); @@ -84,7 +84,6 @@ class PaymentRepository extends BaseRepository $credit_totals = 0; if (array_key_exists('invoices', $data) && is_array($data['invoices'])) { - $invoice_totals = array_sum(array_column($data['invoices'], 'amount')); $invoices = Invoice::whereIn('id', array_column($data['invoices'], 'invoice_id'))->get(); @@ -104,7 +103,6 @@ class PaymentRepository extends BaseRepository } if (array_key_exists('credits', $data) && is_array($data['credits'])) { - $credit_totals = array_sum(array_column($data['credits'], 'amount')); $credits = Credit::whereIn('id', array_column($data['credits'], 'credit_id'))->get(); @@ -114,10 +112,10 @@ class PaymentRepository extends BaseRepository foreach ($data['credits'] as $paid_credit) { $credit = Credit::whereId($paid_credit['credit_id'])->first(); - if ($credit) + if ($credit) { ApplyCreditPayment::dispatchNow($credit, $payment, $paid_credit['amount'], $credit->company); + } } - } event(new PaymentWasCreated($payment, $payment->company)); @@ -126,15 +124,15 @@ class PaymentRepository extends BaseRepository //$payment->amount = $invoice_totals; //creates problems when setting amount like this. - if ($invoice_totals == $payment->amount) + if ($invoice_totals == $payment->amount) { $payment->applied += $payment->amount; - elseif ($invoice_totals < $payment->amount) + } elseif ($invoice_totals < $payment->amount) { $payment->applied += $invoice_totals; + } $payment->save(); return $payment->fresh(); - } /** @@ -182,12 +180,11 @@ class PaymentRepository extends BaseRepository // $payment->save(); // $client->save(); - } /** - * If the client is paying in a currency other than + * If the client is paying in a currency other than * the company currency, we need to set a record */ private function processExchangeRates($data, $payment) @@ -197,8 +194,7 @@ class PaymentRepository extends BaseRepository $client_currency = $client->getSetting('currency_id'); $company_currency = $client->company->settings->currency_id; - if($company_currency != $client_currency) - { + if ($company_currency != $client_currency) { $currency = $client->currency(); $payment->exchange_rate = $currency->exchange_rate; @@ -207,5 +203,4 @@ class PaymentRepository extends BaseRepository return $payment; } - } diff --git a/app/Repositories/QuoteRepository.php b/app/Repositories/QuoteRepository.php index f1c0b63d2d..4158bb897e 100644 --- a/app/Repositories/QuoteRepository.php +++ b/app/Repositories/QuoteRepository.php @@ -27,7 +27,6 @@ use Illuminate\Http\Request; */ class QuoteRepository extends BaseRepository { - use MakesHash; public function getClassName() @@ -44,5 +43,4 @@ class QuoteRepository extends BaseRepository { return QuoteInvitation::whereRaw("BINARY `key`= ?", [$key])->first(); } - } diff --git a/app/Repositories/UserRepository.php b/app/Repositories/UserRepository.php index c625cf22b1..2f02b7d3dc 100644 --- a/app/Repositories/UserRepository.php +++ b/app/Repositories/UserRepository.php @@ -67,7 +67,7 @@ class UserRepository extends BaseRepository $cu->save(); } - $user->with(['company_users' => function ($query) use($company, $user){ + $user->with(['company_users' => function ($query) use ($company, $user) { $query->whereCompanyId($company->id) ->whereUserId($user->id); }])->first(); @@ -75,14 +75,11 @@ class UserRepository extends BaseRepository } return $user; - } public function destroy(array $data, User $user) { - - if(array_key_exists('company_user', $data)) - { + if (array_key_exists('company_user', $data)) { $this->forced_includes = 'company_users'; $company = auth()->user()->company(); @@ -98,20 +95,17 @@ class UserRepository extends BaseRepository $user->delete(); return $user->fresh(); - } public function delete($user) { - $company = auth()->user()->company(); $cu = CompanyUser::whereUserId($user->id) ->whereCompanyId($company->id) ->first(); - if($cu) - { + if ($cu) { $cu->tokens()->delete(); $cu->delete(); } @@ -121,7 +115,5 @@ class UserRepository extends BaseRepository $user->delete(); return $user->fresh(); - } - } diff --git a/app/Services/AbstractService.php b/app/Services/AbstractService.php index 5fd7e0b279..f52209521e 100644 --- a/app/Services/AbstractService.php +++ b/app/Services/AbstractService.php @@ -13,7 +13,5 @@ namespace App\Services; abstract class AbstractService { - - abstract public function run(); - -} \ No newline at end of file + abstract public function run(); +} diff --git a/app/Services/Client/ClientService.php b/app/Services/Client/ClientService.php index 7e5fe342af..2c659a8704 100644 --- a/app/Services/Client/ClientService.php +++ b/app/Services/Client/ClientService.php @@ -13,7 +13,6 @@ namespace App\Services\Client; use App\Models\Client; - class ClientService { private $client; @@ -46,8 +45,8 @@ class ClientService public function save() :Client { - $this->client->save(); + $this->client->save(); - return $this->client; + return $this->client; } } diff --git a/app/Services/Credit/ApplyNumber.php b/app/Services/Credit/ApplyNumber.php index 8c926ecefd..387b708109 100644 --- a/app/Services/Credit/ApplyNumber.php +++ b/app/Services/Credit/ApplyNumber.php @@ -32,7 +32,6 @@ class ApplyNumber extends AbstractService public function run() { - if ($this->credit->number != '') { return $this->credit; } diff --git a/app/Services/Credit/CreateInvitations.php b/app/Services/Credit/CreateInvitations.php index 9f0f091549..9cadfd4bfd 100644 --- a/app/Services/Credit/CreateInvitations.php +++ b/app/Services/Credit/CreateInvitations.php @@ -18,10 +18,9 @@ class CreateInvitations extends AbstractService public function run() { - $contacts = $this->credit->client->contacts; - $contacts->each(function ($contact){ + $contacts->each(function ($contact) { $invitation = CreditInvitation::whereCompanyId($this->credit->company_id) ->whereClientContactId($contact->id) ->whereCreditId($this->credit->id) diff --git a/app/Services/Credit/CreditService.php b/app/Services/Credit/CreditService.php index c53e8af726..1f319cc047 100644 --- a/app/Services/Credit/CreditService.php +++ b/app/Services/Credit/CreditService.php @@ -7,7 +7,6 @@ use App\Services\Credit\MarkSent; class CreditService { - protected $credit; public function __construct($credit) diff --git a/app/Services/Credit/GetCreditPdf.php b/app/Services/Credit/GetCreditPdf.php index fa90786fb1..7c31f7cddf 100644 --- a/app/Services/Credit/GetCreditPdf.php +++ b/app/Services/Credit/GetCreditPdf.php @@ -11,7 +11,6 @@ use Illuminate\Support\Facades\Storage; class GetCreditPdf extends AbstractService { - private $credit; private $contact; @@ -42,5 +41,4 @@ class GetCreditPdf extends AbstractService return Storage::disk($disk)->path($file_path); } - } diff --git a/app/Services/Credit/MarkSent.php b/app/Services/Credit/MarkSent.php index d6169b5475..708819adcd 100644 --- a/app/Services/Credit/MarkSent.php +++ b/app/Services/Credit/MarkSent.php @@ -32,6 +32,5 @@ class MarkSent $this->credit->service()->setStatus(Credit::STATUS_SENT)->applyNumber()->save(); return $this->credit; - } } diff --git a/app/Services/Invoice/ApplyNumber.php b/app/Services/Invoice/ApplyNumber.php index ca49defd1b..d75986b383 100644 --- a/app/Services/Invoice/ApplyNumber.php +++ b/app/Services/Invoice/ApplyNumber.php @@ -23,7 +23,7 @@ use App\Utils\Traits\GeneratesCounter; class ApplyNumber extends AbstractService { - use GeneratesCounter; + use GeneratesCounter; private $client; @@ -36,10 +36,11 @@ class ApplyNumber extends AbstractService $this->invoice = $invoice; } - public function run() + public function run() { - if ($this->invoice->number != '') + if ($this->invoice->number != '') { return $this->invoice; + } switch ($this->client->getSetting('counter_number_applied')) { case 'when_saved': diff --git a/app/Services/Invoice/ApplyPayment.php b/app/Services/Invoice/ApplyPayment.php index e005424e3a..9177e7ebd7 100644 --- a/app/Services/Invoice/ApplyPayment.php +++ b/app/Services/Invoice/ApplyPayment.php @@ -18,7 +18,6 @@ use App\Services\Client\ClientService; class ApplyPayment extends AbstractService { - private $invoice; private $payment; @@ -32,8 +31,8 @@ class ApplyPayment extends AbstractService $this->payment_amount = $payment_amount; } - public function run() - { + public function run() + { $this->payment ->ledger() ->updatePaymentBalance($this->payment_amount*-1); @@ -41,7 +40,7 @@ class ApplyPayment extends AbstractService $this->payment->client->service()->updateBalance($this->payment_amount*-1)->save(); /* Update Pivot Record amount */ - $this->payment->invoices->each(function ($inv){ + $this->payment->invoices->each(function ($inv) { if ($inv->id == $this->invoice->id) { $inv->pivot->amount = $this->payment_amount; $inv->pivot->save(); @@ -49,7 +48,7 @@ class ApplyPayment extends AbstractService }); if ($this->invoice->hasPartial()) { - //is partial and amount is exactly the partial amount + //is partial and amount is exactly the partial amount if ($this->invoice->partial == $this->payment_amount) { $this->invoice->service()->clearPartial()->setDueDate()->setStatus(Invoice::STATUS_PARTIAL)->updateBalance($this->payment_amount*-1); } elseif ($this->invoice->partial > 0 && $this->invoice->partial > $this->payment_amount) { //partial amount exists, but the amount is less than the partial amount @@ -59,10 +58,10 @@ class ApplyPayment extends AbstractService } } elseif ($this->payment_amount == $this->invoice->balance) { //total invoice paid. $this->invoice->service()->clearPartial()->setStatus(Invoice::STATUS_PAID)->updateBalance($this->payment_amount*-1); - } elseif($this->payment_amount < $this->invoice->balance) { //partial invoice payment made + } elseif ($this->payment_amount < $this->invoice->balance) { //partial invoice payment made $this->invoice->service()->clearPartial()->setStatus(Invoice::STATUS_PARTIAL)->updateBalance($this->payment_amount*-1); } return $this->invoice; - } + } } diff --git a/app/Services/Invoice/CreateInvitations.php b/app/Services/Invoice/CreateInvitations.php index d7c29cdb8b..a9b56bb749 100644 --- a/app/Services/Invoice/CreateInvitations.php +++ b/app/Services/Invoice/CreateInvitations.php @@ -11,7 +11,6 @@ namespace App\Services\Invoice; - use App\Factory\InvoiceInvitationFactory; use App\Models\Invoice; use App\Models\InvoiceInvitation; @@ -19,7 +18,6 @@ use App\Services\AbstractService; class CreateInvitations extends AbstractService { - private $invoice; public function __construct(Invoice $invoice) @@ -27,11 +25,9 @@ class CreateInvitations extends AbstractService $this->invoice = $invoice; } - public function run() - { - - $this->invoice->client->contacts->each(function ($contact){ - + public function run() + { + $this->invoice->client->contacts->each(function ($contact) { $invitation = InvoiceInvitation::whereCompanyId($this->invoice->company_id) ->whereClientContactId($contact->id) ->whereInvoiceId($this->invoice->id) @@ -48,5 +44,5 @@ class CreateInvitations extends AbstractService }); return $this->invoice; - } + } } diff --git a/app/Services/Invoice/GetInvoicePdf.php b/app/Services/Invoice/GetInvoicePdf.php index 3c835b3fc0..3e8a7a790f 100644 --- a/app/Services/Invoice/GetInvoicePdf.php +++ b/app/Services/Invoice/GetInvoicePdf.php @@ -19,42 +19,33 @@ use Illuminate\Support\Facades\Storage; class GetInvoicePdf extends AbstractService { - public function __construct(Invoice $invoice, ClientContact $contact = null) { - $this->invoice = $invoice; $this->contact = $contact; - } - public function run() - { + public function run() + { + if (!$this->contact) { + $this->contact = $this->invoice->client->primary_contact()->first(); + } - if(!$this->contact) - $this->contact = $this->invoice->client->primary_contact()->first(); + $path = $this->invoice->client->invoice_filepath(); - $path = $this->invoice->client->invoice_filepath(); + $file_path = $path . $this->invoice->number . '.pdf'; - $file_path = $path . $this->invoice->number . '.pdf'; + $disk = config('filesystems.default'); - $disk = config('filesystems.default'); + $file = Storage::disk($disk)->exists($file_path); - $file = Storage::disk($disk)->exists($file_path); + if (!$file) { + $file_path = CreateInvoicePdf::dispatchNow($this->invoice, $this->invoice->company, $this->contact); + } - if(!$file) - { - - $file_path = CreateInvoicePdf::dispatchNow($this->invoice, $this->invoice->company, $this->contact); - - } - - //return $file_path; - - return Storage::disk($disk)->path($file_path); - - } + //return $file_path; + return Storage::disk($disk)->path($file_path); + } } - diff --git a/app/Services/Invoice/InvoiceService.php b/app/Services/Invoice/InvoiceService.php index eef9a57ecc..c4276e14b4 100644 --- a/app/Services/Invoice/InvoiceService.php +++ b/app/Services/Invoice/InvoiceService.php @@ -34,7 +34,6 @@ class InvoiceService $this->invoice = $invoice; $this->client_service = new ClientService($invoice->client); - } /** @@ -105,7 +104,7 @@ class InvoiceService } public function markSent() - { + { $mark_sent = new MarkSent($this->invoice->client, $this->invoice); $this->invoice = $mark_sent->run(); diff --git a/app/Services/Invoice/MarkPaid.php b/app/Services/Invoice/MarkPaid.php index 33d58483e7..6660c1a7df 100644 --- a/app/Services/Invoice/MarkPaid.php +++ b/app/Services/Invoice/MarkPaid.php @@ -35,11 +35,11 @@ class MarkPaid extends AbstractService $this->invoice = $invoice; } - public function run() - { - - if($this->invoice->status_id == Invoice::STATUS_DRAFT) + public function run() + { + if ($this->invoice->status_id == Invoice::STATUS_DRAFT) { $this->invoice->service()->markSent(); + } /* Create Payment */ $payment = PaymentFactory::create($this->invoice->company_id, $this->invoice->user_id); @@ -75,7 +75,5 @@ class MarkPaid extends AbstractService ->save(); return $this->invoice; - } - + } } - diff --git a/app/Services/Invoice/MarkSent.php b/app/Services/Invoice/MarkSent.php index 13240e929f..d63025194b 100644 --- a/app/Services/Invoice/MarkSent.php +++ b/app/Services/Invoice/MarkSent.php @@ -17,7 +17,6 @@ use App\Services\AbstractService; class MarkSent extends AbstractService { - private $client; private $invoice; @@ -28,8 +27,8 @@ class MarkSent extends AbstractService $this->invoice = $invoice; } - public function run() - { + public function run() + { /* Return immediately if status is not draft */ if ($this->invoice->status_id != Invoice::STATUS_DRAFT) { @@ -51,6 +50,5 @@ class MarkSent extends AbstractService //UpdateCompanyLedgerWithInvoice::dispatchNow($this->invoice, $this->invoice->balance, $this->invoice->company); return $this->invoice; - - } + } } diff --git a/app/Services/Invoice/SendEmail.php b/app/Services/Invoice/SendEmail.php index 5cf4331bfa..4cb1852921 100644 --- a/app/Services/Invoice/SendEmail.php +++ b/app/Services/Invoice/SendEmail.php @@ -20,7 +20,6 @@ use Illuminate\Support\Carbon; class SendEmail extends AbstractService { - protected $invoice; public function __construct(Invoice $invoice, $reminder_template = null, ClientContact $contact = null) @@ -40,13 +39,11 @@ class SendEmail extends AbstractService */ public function run() { - if (!$this->reminder_template) { $this->reminder_template = $this->invoice->calculateTemplate(); } - $this->invoice->invitations->each(function ($invitation){ - + $this->invoice->invitations->each(function ($invitation) { $email_builder = (new InvoiceEmail())->build($invitation, $this->reminder_template); if ($invitation->contact->send && $invitation->contact->email) { diff --git a/app/Services/Invoice/UpdateBalance.php b/app/Services/Invoice/UpdateBalance.php index 7b6d466bcf..34d06809f0 100644 --- a/app/Services/Invoice/UpdateBalance.php +++ b/app/Services/Invoice/UpdateBalance.php @@ -16,7 +16,6 @@ use App\Services\AbstractService; class UpdateBalance extends AbstractService { - private $invoice; private $balance_adjustment; @@ -28,9 +27,8 @@ class UpdateBalance extends AbstractService } - public function run() - { - + public function run() + { if ($this->invoice->is_deleted) { return; } @@ -41,9 +39,8 @@ class UpdateBalance extends AbstractService $this->invoice->status_id = Invoice::STATUS_PAID; // $this->save(); // event(new InvoiceWasPaid($this, $this->company)); - } return $this->invoice; - } + } } diff --git a/app/Services/Ledger/LedgerService.php b/app/Services/Ledger/LedgerService.php index 672004f836..f3202a547d 100644 --- a/app/Services/Ledger/LedgerService.php +++ b/app/Services/Ledger/LedgerService.php @@ -16,7 +16,6 @@ use App\Models\CompanyLedger; class LedgerService { - private $entity; public function __construct($entity) @@ -63,26 +62,21 @@ class LedgerService $company_ledger->balance = $balance + $adjustment; $company_ledger->save(); - $this->entity->company_ledger()->save($company_ledger); + $this->entity->company_ledger()->save($company_ledger); } private function ledger() :?CompanyLedger { - return CompanyLedger::whereClientId($this->entity->client_id) ->whereCompanyId($this->entity->company_id) ->orderBy('id', 'DESC') ->first(); - } public function save() { - $this->entity->save(); return $this->entity; - } - } diff --git a/app/Services/Notification/NotificationService.php b/app/Services/Notification/NotificationService.php index 6865a53130..89ec35d7af 100644 --- a/app/Services/Notification/NotificationService.php +++ b/app/Services/Notification/NotificationService.php @@ -18,7 +18,6 @@ use Illuminate\Support\Facades\Notification; class NotificationService extends AbstractService { - const ALL = 'all_notifications'; const ALL_USER = 'all_user_notifications'; @@ -47,26 +46,21 @@ class NotificationService extends AbstractService public function __construct(Company $company, Notifiable $notification) { - $this->company = $company; $this->notification = $notification; - } public function run($is_system = false) { - $this->company->owner()->notify($this->notification); - if($is_system) - { + if ($is_system) { $this->notification->is_system = true; Notification::route('slack', $this->company->slack_webhook_url) ->notify($this->notification); } - } /** @@ -75,11 +69,8 @@ class NotificationService extends AbstractService */ public function ninja() { - Notification::route('slack', config('ninja.notification.slack')) ->route('mail', config('ninja.notification.mail')) ->notify($this->notification); - } - } diff --git a/app/Services/Payment/PaymentService.php b/app/Services/Payment/PaymentService.php index c37832ad53..f9dc3433b2 100644 --- a/app/Services/Payment/PaymentService.php +++ b/app/Services/Payment/PaymentService.php @@ -16,7 +16,6 @@ use App\Models\Invoice; use App\Models\Payment; use App\Services\Payment\UpdateInvoicePayment; - class PaymentService { private $payment; diff --git a/app/Services/Payment/UpdateInvoicePayment.php b/app/Services/Payment/UpdateInvoicePayment.php index b437d93b07..b21eff970f 100644 --- a/app/Services/Payment/UpdateInvoicePayment.php +++ b/app/Services/Payment/UpdateInvoicePayment.php @@ -19,14 +19,13 @@ class UpdateInvoicePayment public function run() { - $invoices = $this->payment->invoices()->get(); + $invoices = $this->payment->invoices()->get(); $invoices_total = $invoices->sum('balance'); /* Simplest scenario - All invoices are paid in full*/ if (strval($invoices_total) === strval($this->payment->amount)) { $invoices->each(function ($invoice) { - $this->payment ->ledger() ->updatePaymentBalance($invoice->balance*-1); @@ -63,7 +62,6 @@ class UpdateInvoicePayment if ($this->payment->amount == $total) { $invoices->each(function ($invoice) { if ($invoice->hasPartial()) { - $this->payment ->ledger() ->updatePaymentBalance($invoice->partial*-1); @@ -82,7 +80,6 @@ class UpdateInvoicePayment ->setStatus(Invoice::STATUS_PARTIAL) ->save(); } else { - $this->payment ->ledger() ->updatePaymentBalance($invoice->balance*-1); @@ -124,5 +121,4 @@ class UpdateInvoicePayment return $this->payment; } - -} \ No newline at end of file +} diff --git a/app/Services/Quote/ApplyNumber.php b/app/Services/Quote/ApplyNumber.php index eaba8647a6..b0bfd14eba 100644 --- a/app/Services/Quote/ApplyNumber.php +++ b/app/Services/Quote/ApplyNumber.php @@ -17,9 +17,9 @@ class ApplyNumber public function run($quote) { - - if ($quote->number != '') + if ($quote->number != '') { return $quote; + } switch ($this->client->getSetting('counter_number_applied')) { case 'when_saved': diff --git a/app/Services/Quote/CreateInvitations.php b/app/Services/Quote/CreateInvitations.php index f6bcfdaf67..7a96b934bc 100644 --- a/app/Services/Quote/CreateInvitations.php +++ b/app/Services/Quote/CreateInvitations.php @@ -6,15 +6,13 @@ use App\Models\QuoteInvitation; class CreateInvitations { - public function __construct() { } public function run($quote) { - - $quote->client->contacts->each(function ($contact) use($quote){ + $quote->client->contacts->each(function ($contact) use ($quote) { $invitation = QuoteInvitation::whereCompanyId($quote->company_id) ->whereClientContactId($contact->id) ->whereQuoteId($quote->id) diff --git a/app/Services/Quote/MarkSent.php b/app/Services/Quote/MarkSent.php index 7a3e4efa70..5010cdd3a9 100644 --- a/app/Services/Quote/MarkSent.php +++ b/app/Services/Quote/MarkSent.php @@ -32,6 +32,5 @@ class MarkSent $this->quote->service()->setStatus(Quote::STATUS_SENT)->applyNumber()->save(); return $this->quote; - } } diff --git a/app/Services/Quote/QuoteService.php b/app/Services/Quote/QuoteService.php index c9939726f5..d928205794 100644 --- a/app/Services/Quote/QuoteService.php +++ b/app/Services/Quote/QuoteService.php @@ -30,7 +30,7 @@ class QuoteService $this->quote = $mark_approved->run($this->quote); - if($this->quote->client->getSetting('auto_convert_quote') === true) { + if ($this->quote->client->getSetting('auto_convert_quote') === true) { $convert_quote = new ConvertQuote($this->quote->client); $this->quote = $convert_quote->run($this->quote); } @@ -85,23 +85,21 @@ class QuoteService public function approve() :QuoteService { - $this->setStatus(Quote::STATUS_APPROVED)->save(); $invoice = null; - if($this->quote->client->getSetting('auto_convert_quote')){ + if ($this->quote->client->getSetting('auto_convert_quote')) { $invoice = $this->convertToInvoice(); $this->linkInvoiceToQuote($invoice)->save(); } - if($this->quote->client->getSetting('auto_archive_quote')) { + if ($this->quote->client->getSetting('auto_archive_quote')) { $quote_repo = new QuoteRepository(); $quote_repo->archive($this->quote); } return $this; - } /** @@ -120,16 +118,16 @@ class QuoteService { Invoice::unguard(); - $invoice = new Invoice((array) $this->quote); - $invoice->status_id = Invoice::STATUS_SENT; - $invoice->due_date = null; - $invoice->invitations = null; - $invoice->number = null; - $invoice->save(); + $invoice = new Invoice((array) $this->quote); + $invoice->status_id = Invoice::STATUS_SENT; + $invoice->due_date = null; + $invoice->invitations = null; + $invoice->number = null; + $invoice->save(); Invoice::reguard(); - $invoice->service()->markSent()->createInvitations()->save(); + $invoice->service()->markSent()->createInvitations()->save(); return $invoice; } diff --git a/app/Services/Quote/SendEmail.php b/app/Services/Quote/SendEmail.php index a14a4cb5e6..e5ab7a9be4 100644 --- a/app/Services/Quote/SendEmail.php +++ b/app/Services/Quote/SendEmail.php @@ -8,7 +8,6 @@ use App\Models\Quote; class SendEmail { - public $quote; public function __construct($quote) @@ -27,17 +26,12 @@ class SendEmail $reminder_template = $this->quote->status_id == Quote::STATUS_DRAFT || Carbon::parse($this->quote->due_date) > now() ? 'invoice' : $this->quote->calculateTemplate(); } - $this->quote->invitations->each(function ($invitation){ - - if ($invitation->contact->send && $invitation->contact->email) - { - + $this->quote->invitations->each(function ($invitation) { + if ($invitation->contact->send && $invitation->contact->email) { $email_builder = (new QuoteEmail())->build($invitation, $reminder_template); EmailQuote::dispatchNow($email_builder, $invitation); } }); - - } } diff --git a/app/Transformers/CreditInvitationTransformer.php b/app/Transformers/CreditInvitationTransformer.php index f157507717..c096c6e0d4 100644 --- a/app/Transformers/CreditInvitationTransformer.php +++ b/app/Transformers/CreditInvitationTransformer.php @@ -14,22 +14,23 @@ namespace App\Transformers; use App\Models\CreditInvitation; use App\Utils\Traits\MakesHash; -class CreditInvitationTransformer extends EntityTransformer { +class CreditInvitationTransformer extends EntityTransformer +{ + use MakesHash; - use MakesHash; - - public function transform(CreditInvitation $invitation) { - return [ - 'id' => $this->encodePrimaryKey($invitation->id), - 'client_contact_id' => $this->encodePrimaryKey($invitation->client_contact_id), - 'key' => $invitation->key, - 'link' => $invitation->getLink() ?:'', - 'sent_date' => $invitation->sent_date ?:'', - 'viewed_date' => $invitation->viewed_date ?:'', - 'opened_date' => $invitation->opened_date ?:'', - 'updated_at' => (int) $invitation->updated_at, - 'archived_at' => (int) $invitation->deleted_at, - 'created_at' => (int) $invitation->created_at, - ]; - } + public function transform(CreditInvitation $invitation) + { + return [ + 'id' => $this->encodePrimaryKey($invitation->id), + 'client_contact_id' => $this->encodePrimaryKey($invitation->client_contact_id), + 'key' => $invitation->key, + 'link' => $invitation->getLink() ?:'', + 'sent_date' => $invitation->sent_date ?:'', + 'viewed_date' => $invitation->viewed_date ?:'', + 'opened_date' => $invitation->opened_date ?:'', + 'updated_at' => (int) $invitation->updated_at, + 'archived_at' => (int) $invitation->deleted_at, + 'created_at' => (int) $invitation->created_at, + ]; + } } diff --git a/app/Transformers/CreditTransformer.php b/app/Transformers/CreditTransformer.php index 29d81f6a28..3ea8f7d59a 100644 --- a/app/Transformers/CreditTransformer.php +++ b/app/Transformers/CreditTransformer.php @@ -41,32 +41,32 @@ class CreditTransformer extends EntityTransformer public function includePayments(quote $credit) { $transformer = new PaymentTransformer($this->account, $this->serializer, $credit); - + return $this->includeCollection($credit->payments, $transformer, ENTITY_PAYMENT); } - + public function includeClient(quote $credit) { $transformer = new ClientTransformer($this->account, $this->serializer); - + return $this->includeItem($credit->client, $transformer, ENTITY_CLIENT); } - + public function includeExpenses(quote $credit) { $transformer = new ExpenseTransformer($this->account, $this->serializer); - + return $this->includeCollection($credit->expenses, $transformer, ENTITY_EXPENSE); } - + public function includeDocuments(quote $credit) { $transformer = new DocumentTransformer($this->account, $this->serializer); - + $credit->documents->each(function ($document) use ($credit) { $document->setRelation('quote', $credit); }); - + return $this->includeCollection($credit->documents, $transformer, ENTITY_DOCUMENT); } */ diff --git a/app/Transformers/DesignTransformer.php b/app/Transformers/DesignTransformer.php index c46f24828e..9ae55ce8ec 100644 --- a/app/Transformers/DesignTransformer.php +++ b/app/Transformers/DesignTransformer.php @@ -37,7 +37,7 @@ class DesignTransformer extends EntityTransformer /** * @param Design $design - * + * * @return array */ public function transform(Design $design) @@ -54,5 +54,4 @@ class DesignTransformer extends EntityTransformer 'is_deleted' => (bool)$design->is_deleted, ]; } - } diff --git a/app/Transformers/ExpenseTransformer.php b/app/Transformers/ExpenseTransformer.php index f84d2cc909..f467cdf3c4 100644 --- a/app/Transformers/ExpenseTransformer.php +++ b/app/Transformers/ExpenseTransformer.php @@ -79,4 +79,4 @@ class ExpenseTransformer extends EntityTransformer 'created_at' => (int)$expense->created_at, ]; } -} \ No newline at end of file +} diff --git a/app/Transformers/InvoiceInvitationTransformer.php b/app/Transformers/InvoiceInvitationTransformer.php index 8416e98f84..0693751141 100644 --- a/app/Transformers/InvoiceInvitationTransformer.php +++ b/app/Transformers/InvoiceInvitationTransformer.php @@ -14,21 +14,23 @@ namespace App\Transformers; use App\Models\InvoiceInvitation; use App\Utils\Traits\MakesHash; -class InvoiceInvitationTransformer extends EntityTransformer { - use MakesHash; +class InvoiceInvitationTransformer extends EntityTransformer +{ + use MakesHash; - public function transform(InvoiceInvitation $invitation) { - return [ - 'id' => $this->encodePrimaryKey($invitation->id), - 'client_contact_id' => $this->encodePrimaryKey($invitation->client_contact_id), - 'key' => $invitation->key, - 'link' => $invitation->getLink()?:'', - 'sent_date' => $invitation->sent_date?:'', - 'viewed_date' => $invitation->viewed_date?:'', - 'opened_date' => $invitation->opened_date?:'', - 'updated_at' => (int) $invitation->updated_at, - 'archived_at' => (int) $invitation->deleted_at, - 'created_at' => (int) $invitation->created_at, - ]; - } + public function transform(InvoiceInvitation $invitation) + { + return [ + 'id' => $this->encodePrimaryKey($invitation->id), + 'client_contact_id' => $this->encodePrimaryKey($invitation->client_contact_id), + 'key' => $invitation->key, + 'link' => $invitation->getLink()?:'', + 'sent_date' => $invitation->sent_date?:'', + 'viewed_date' => $invitation->viewed_date?:'', + 'opened_date' => $invitation->opened_date?:'', + 'updated_at' => (int) $invitation->updated_at, + 'archived_at' => (int) $invitation->deleted_at, + 'created_at' => (int) $invitation->created_at, + ]; + } } diff --git a/app/Transformers/InvoiceTransformer.php b/app/Transformers/InvoiceTransformer.php index 2f8ac41181..8ac568fa29 100644 --- a/app/Transformers/InvoiceTransformer.php +++ b/app/Transformers/InvoiceTransformer.php @@ -41,41 +41,41 @@ class InvoiceTransformer extends EntityTransformer public function includeInvoiceItems(Invoice $invoice) { $transformer = new InvoiceItemTransformer($this->serializer); - + return $this->includeCollection($invoice->invoice_items, $transformer, ENTITY_INVOICE_ITEM); } - - - + + + public function includePayments(Invoice $invoice) { $transformer = new PaymentTransformer($this->account, $this->serializer, $invoice); - + return $this->includeCollection($invoice->payments, $transformer, ENTITY_PAYMENT); } - + public function includeClient(Invoice $invoice) { $transformer = new ClientTransformer($this->account, $this->serializer); - + return $this->includeItem($invoice->client, $transformer, ENTITY_CLIENT); } - + public function includeExpenses(Invoice $invoice) { $transformer = new ExpenseTransformer($this->account, $this->serializer); - + return $this->includeCollection($invoice->expenses, $transformer, ENTITY_EXPENSE); } - + public function includeDocuments(Invoice $invoice) { $transformer = new DocumentTransformer($this->account, $this->serializer); - + $invoice->documents->each(function ($document) use ($invoice) { $document->setRelation('invoice', $invoice); }); - + return $this->includeCollection($invoice->documents, $transformer, ENTITY_DOCUMENT); } */ diff --git a/app/Transformers/PaymentableTransformer.php b/app/Transformers/PaymentableTransformer.php index eec42bcd0d..8e3e17b727 100644 --- a/app/Transformers/PaymentableTransformer.php +++ b/app/Transformers/PaymentableTransformer.php @@ -35,8 +35,9 @@ class PaymentableTransformer extends EntityTransformer { $entity_key = 'invoice_id'; - if($paymentable->paymentable_type == Credit::class) + if ($paymentable->paymentable_type == Credit::class) { $entity_key = 'credit_id'; + } return [ 'id' => $this->encodePrimaryKey($paymentable->id), diff --git a/app/Transformers/ProjectTransformer.php b/app/Transformers/ProjectTransformer.php index bd668fb61f..08f6d36cec 100644 --- a/app/Transformers/ProjectTransformer.php +++ b/app/Transformers/ProjectTransformer.php @@ -50,6 +50,4 @@ class ProjectTransformer extends EntityTransformer 'custom_value4' => $project->custom_value4 ?: '', ]; } - } - diff --git a/app/Transformers/QuoteTransformer.php b/app/Transformers/QuoteTransformer.php index e967d74f2e..673804bdf4 100644 --- a/app/Transformers/QuoteTransformer.php +++ b/app/Transformers/QuoteTransformer.php @@ -41,32 +41,32 @@ class QuoteTransformer extends EntityTransformer public function includePayments(quote $quote) { $transformer = new PaymentTransformer($this->account, $this->serializer, $quote); - + return $this->includeCollection($quote->payments, $transformer, ENTITY_PAYMENT); } - + public function includeClient(quote $quote) { $transformer = new ClientTransformer($this->account, $this->serializer); - + return $this->includeItem($quote->client, $transformer, ENTITY_CLIENT); } - + public function includeExpenses(quote $quote) { $transformer = new ExpenseTransformer($this->account, $this->serializer); - + return $this->includeCollection($quote->expenses, $transformer, ENTITY_EXPENSE); } - + public function includeDocuments(quote $quote) { $transformer = new DocumentTransformer($this->account, $this->serializer); - + $quote->documents->each(function ($document) use ($quote) { $document->setRelation('quote', $quote); }); - + return $this->includeCollection($quote->documents, $transformer, ENTITY_DOCUMENT); } */ diff --git a/app/Transformers/RecurringInvoiceTransformer.php b/app/Transformers/RecurringInvoiceTransformer.php index 5fe6607226..41968c9323 100644 --- a/app/Transformers/RecurringInvoiceTransformer.php +++ b/app/Transformers/RecurringInvoiceTransformer.php @@ -34,46 +34,46 @@ class RecurringInvoiceTransformer extends EntityTransformer public function includeInvoiceItems(Invoice $invoice) { $transformer = new InvoiceItemTransformer($this->serializer); - + return $this->includeCollection($invoice->invoice_items, $transformer, ENTITY_INVOICE_ITEM); } - + public function includeInvitations(Invoice $invoice) { $transformer = new InvitationTransformer($this->account, $this->serializer); - + return $this->includeCollection($invoice->invitations, $transformer, ENTITY_INVITATION); } - + public function includePayments(Invoice $invoice) { $transformer = new PaymentTransformer($this->account, $this->serializer, $invoice); - + return $this->includeCollection($invoice->payments, $transformer, ENTITY_PAYMENT); } - + public function includeClient(Invoice $invoice) { $transformer = new ClientTransformer($this->account, $this->serializer); - + return $this->includeItem($invoice->client, $transformer, ENTITY_CLIENT); } - + public function includeExpenses(Invoice $invoice) { $transformer = new ExpenseTransformer($this->account, $this->serializer); - + return $this->includeCollection($invoice->expenses, $transformer, ENTITY_EXPENSE); } - + public function includeDocuments(Invoice $invoice) { $transformer = new DocumentTransformer($this->account, $this->serializer); - + $invoice->documents->each(function ($document) use ($invoice) { $document->setRelation('invoice', $invoice); }); - + return $this->includeCollection($invoice->documents, $transformer, ENTITY_DOCUMENT); } */ diff --git a/app/Transformers/RecurringQuoteTransformer.php b/app/Transformers/RecurringQuoteTransformer.php index 9349eee74e..bf4aaca7c3 100644 --- a/app/Transformers/RecurringQuoteTransformer.php +++ b/app/Transformers/RecurringQuoteTransformer.php @@ -34,46 +34,46 @@ class RecurringQuoteTransformer extends EntityTransformer public function includeInvoiceItems(Invoice $quote) { $transformer = new InvoiceItemTransformer($this->serializer); - + return $this->includeCollection($quote->invoice_items, $transformer, ENTITY_INVOICE_ITEM); } - + public function includeInvitations(Invoice $quote) { $transformer = new InvitationTransformer($this->account, $this->serializer); - + return $this->includeCollection($quote->invitations, $transformer, ENTITY_INVITATION); } - + public function includePayments(Invoice $quote) { $transformer = new PaymentTransformer($this->account, $this->serializer, $quote); - + return $this->includeCollection($quote->payments, $transformer, ENTITY_PAYMENT); } - + public function includeClient(Invoice $quote) { $transformer = new ClientTransformer($this->account, $this->serializer); - + return $this->includeItem($quote->client, $transformer, ENTITY_CLIENT); } - + public function includeExpenses(Invoice $quote) { $transformer = new ExpenseTransformer($this->account, $this->serializer); - + return $this->includeCollection($quote->expenses, $transformer, ENTITY_EXPENSE); } - + public function includeDocuments(Invoice $quote) { $transformer = new DocumentTransformer($this->account, $this->serializer); - + $quote->documents->each(function ($document) use ($quote) { $document->setRelation('invoice', $quote); }); - + return $this->includeCollection($quote->documents, $transformer, ENTITY_DOCUMENT); } */ diff --git a/app/Utils/CurlUtils.php b/app/Utils/CurlUtils.php index 1e7904404f..750d6e8a9b 100644 --- a/app/Utils/CurlUtils.php +++ b/app/Utils/CurlUtils.php @@ -49,5 +49,4 @@ class CurlUtils return $response; } - } diff --git a/app/Utils/Ninja.php b/app/Utils/Ninja.php index c5708acd9a..2418f21886 100644 --- a/app/Utils/Ninja.php +++ b/app/Utils/Ninja.php @@ -20,7 +20,6 @@ use Illuminate\Support\Facades\DB; */ class Ninja { - const TEST_USERNAME = 'user@example.com'; public static function isSelfHost() @@ -65,10 +64,11 @@ class Ninja $data = trim(CurlUtils::post('https://license.invoiceninja.com/api/check', $data)); $data = json_decode($data); - if($data->message == sha1(config('ninja.license'))) + if ($data->message == sha1(config('ninja.license'))) { return false; - else + } else { return true; + } } public static function parse() @@ -108,5 +108,4 @@ class Ninja curl_exec($ch); curl_close($ch); } - } diff --git a/app/Utils/SystemHealth.php b/app/Utils/SystemHealth.php index bcc26f2331..91fa0c83d8 100644 --- a/app/Utils/SystemHealth.php +++ b/app/Utils/SystemHealth.php @@ -94,11 +94,9 @@ class SystemHealth $result[] = [ config('database.connections.' . config('database.default') . '.database') => false ]; } } - } return $result; - } private static function checkDbConnection() @@ -107,19 +105,17 @@ class SystemHealth } private static function testMailServer() - { - + { try { Mail::to(config('mail.from.address')) ->send(new TestMailServer('Email Server Works!', config('mail.from.address'))); - } - catch(\Exception $e) { - + } catch (\Exception $e) { return $e->getMessage(); } - if(count(Mail::failures()) > 0) + if (count(Mail::failures()) > 0) { return Mail::failures(); + } return []; } diff --git a/app/Utils/Traits/AppSetup.php b/app/Utils/Traits/AppSetup.php index 795ea39412..ce8d6af9c3 100644 --- a/app/Utils/Traits/AppSetup.php +++ b/app/Utils/Traits/AppSetup.php @@ -16,15 +16,12 @@ use App\Utils\SystemHealth; trait AppSetup { - - public function checkAppSetup() - { - - if(Ninja::isNinja()) // Is this the invoice ninja production system? + public function checkAppSetup() + { + if (Ninja::isNinja()) { // Is this the invoice ninja production system? return true; + } return SystemHealth::check()['system_health']; // Do the system tests pass? - } - -} \ No newline at end of file +} diff --git a/app/Utils/Traits/ChecksEntityStatus.php b/app/Utils/Traits/ChecksEntityStatus.php index a13d66f1de..f30864f21f 100644 --- a/app/Utils/Traits/ChecksEntityStatus.php +++ b/app/Utils/Traits/ChecksEntityStatus.php @@ -17,18 +17,13 @@ namespace App\Utils\Traits; */ trait ChecksEntityStatus { + public function entityIsDeleted($entity) + { + return $entity->is_deleted; + } - public function entityIsDeleted($entity) - { - - return $entity->is_deleted; - - } - - public function disallowUpdate() - { - return response()->json(['message'=>'Record is deleted and cannot be edited. Restore the record to enable editing'], 400); - - } - -} \ No newline at end of file + public function disallowUpdate() + { + return response()->json(['message'=>'Record is deleted and cannot be edited. Restore the record to enable editing'], 400); + } +} diff --git a/app/Utils/Traits/ClientGroupSettingsSaver.php b/app/Utils/Traits/ClientGroupSettingsSaver.php index 2107d70bb2..4e88f9ada0 100644 --- a/app/Utils/Traits/ClientGroupSettingsSaver.php +++ b/app/Utils/Traits/ClientGroupSettingsSaver.php @@ -90,7 +90,7 @@ trait ClientGroupSettingsSaver } foreach ($casts as $key => $value) { - if(in_array($key, SettingsSaver::$string_casts)) { + if (in_array($key, SettingsSaver::$string_casts)) { $value = "string"; if (!property_exists($settings, $key)) { diff --git a/app/Utils/Traits/CompanySettingsSaver.php b/app/Utils/Traits/CompanySettingsSaver.php index 3a0489e47c..0697446af6 100644 --- a/app/Utils/Traits/CompanySettingsSaver.php +++ b/app/Utils/Traits/CompanySettingsSaver.php @@ -31,20 +31,21 @@ trait CompanySettingsSaver */ public function saveSettings($settings, $entity) { - /* No Settings, No Save!*/ - if (!$settings) + /* No Settings, No Save!*/ + if (!$settings) { return; + } //Unset Protected Properties. - foreach (CompanySettings::$protected_fields as $field) + foreach (CompanySettings::$protected_fields as $field) { unset($settings[$field]); + } $settings = $this->checkSettingType($settings); $company_settings = CompanySettings::defaults(); //Iterate and set NEW settings foreach ($settings as $key => $value) { - if (is_null($settings->{$key})) { $company_settings->{$key} = ''; } else { @@ -55,7 +56,6 @@ trait CompanySettingsSaver $entity->settings = $company_settings; $entity->save(); - } /** @@ -79,8 +79,7 @@ trait CompanySettingsSaver ksort($casts); foreach ($casts as $key => $value) { - - if(in_array($key, SettingsSaver::$string_casts)) { + if (in_array($key, SettingsSaver::$string_casts)) { $value = "string"; if (!property_exists($settings, $key)) { @@ -102,21 +101,21 @@ trait CompanySettingsSaver } continue; - } - elseif($key == 'pdf_variables') { + } elseif ($key == 'pdf_variables') { continue; } /* Handles unset settings or blank strings */ - if (!property_exists($settings, $key) || is_null($settings->{$key}) || !isset($settings->{$key}) || $settings->{$key} == '') + if (!property_exists($settings, $key) || is_null($settings->{$key}) || !isset($settings->{$key}) || $settings->{$key} == '') { continue; + } /*Catch all filter */ - if (!$this->checkAttribute($value, $settings->{$key})) + if (!$this->checkAttribute($value, $settings->{$key})) { return [$key, $value, $settings->{$key}]; - + } } return true; @@ -140,9 +139,7 @@ trait CompanySettingsSaver $casts = CompanySettings::$casts; foreach ($casts as $key => $value) { - - if(in_array($key, SettingsSaver::$string_casts)) - { + if (in_array($key, SettingsSaver::$string_casts)) { $value = "string"; if (!property_exists($settings, $key)) { @@ -157,7 +154,7 @@ trait CompanySettingsSaver unset($settings->{$key}); } - continue; + continue; } /*Separate loop if it is a _id field which is an integer cast as a string*/ if (substr($key, -3) == '_id' || substr($key, -14) == 'number_counter') { @@ -176,14 +173,14 @@ trait CompanySettingsSaver } continue; - } - elseif($key == 'pdf_variables') { + } elseif ($key == 'pdf_variables') { settype($settings->{$key}, 'object'); } /* Handles unset settings or blank strings */ - if (!property_exists($settings, $key) || is_null($settings->{$key}) || !isset($settings->{$key}) || $settings->{$key} == '') + if (!property_exists($settings, $key) || is_null($settings->{$key}) || !isset($settings->{$key}) || $settings->{$key} == '') { continue; + } /*Catch all filter */ @@ -199,7 +196,6 @@ trait CompanySettingsSaver } return $settings; - } /** @@ -210,7 +206,6 @@ trait CompanySettingsSaver */ private function checkAttribute($key, $value) :bool { - switch ($key) { case 'int': case 'integer': @@ -234,6 +229,5 @@ trait CompanySettingsSaver default: return false; } - } } diff --git a/app/Utils/Traits/GeneratesCounter.php b/app/Utils/Traits/GeneratesCounter.php index 0d339280a9..c0868dd373 100644 --- a/app/Utils/Traits/GeneratesCounter.php +++ b/app/Utils/Traits/GeneratesCounter.php @@ -282,7 +282,6 @@ trait GeneratesCounter } $counter++; - } while ($check); @@ -298,15 +297,13 @@ trait GeneratesCounter */ private function incrementCounter($entity, string $counter_name) :void { - $settings = $entity->settings; - $settings->{$counter_name} = $settings->{$counter_name} + 1; + $settings->{$counter_name} = $settings->{$counter_name} + 1; $entity->settings = $settings; $entity->save(); - } private function prefixCounter($counter, $prefix) : string diff --git a/app/Utils/Traits/Inviteable.php b/app/Utils/Traits/Inviteable.php index f71a75b3c5..9915fb2653 100644 --- a/app/Utils/Traits/Inviteable.php +++ b/app/Utils/Traits/Inviteable.php @@ -70,7 +70,6 @@ trait Inviteable public function getAdminLink() :string { - return $this->getLink(). '?silent=true'; } } diff --git a/app/Utils/Traits/InvoiceEmailBuilder.php b/app/Utils/Traits/InvoiceEmailBuilder.php index 274d76490c..479f5136fa 100644 --- a/app/Utils/Traits/InvoiceEmailBuilder.php +++ b/app/Utils/Traits/InvoiceEmailBuilder.php @@ -86,7 +86,6 @@ trait InvoiceEmailBuilder //process markdown if ($is_markdown) { - $converter = new CommonMarkConverter([ 'html_input' => 'allow', 'allow_unsafe_links' => true, diff --git a/app/Utils/Traits/MakesDates.php b/app/Utils/Traits/MakesDates.php index 8bf33cc4f2..d3d5bec090 100644 --- a/app/Utils/Traits/MakesDates.php +++ b/app/Utils/Traits/MakesDates.php @@ -59,8 +59,9 @@ trait MakesDates */ public function formatDate($date, string $format) :string { - if(!$date || strlen($date) < 1) + if (!$date || strlen($date) < 1) { return ''; + } if (is_string($date)) { $date = $this->convertToDateObject($date); diff --git a/app/Utils/Traits/MakesHash.php b/app/Utils/Traits/MakesHash.php index 8342e42ae1..9b2318b25c 100644 --- a/app/Utils/Traits/MakesHash.php +++ b/app/Utils/Traits/MakesHash.php @@ -27,9 +27,7 @@ trait MakesHash */ public function createHash() : string { - return \Illuminate\Support\Str::random(config('ninja.key_length')); - } /** @@ -40,9 +38,7 @@ trait MakesHash */ public function createDbHash($db) : string { - return $this->getDbCode($db) . '-' . \Illuminate\Support\Str::random(config('ninja.key_length')); - } /** @@ -51,43 +47,37 @@ trait MakesHash */ public function getDbCode($db) : string { - $hashids = new Hashids(config('ninja.hash_salt'), 10); return $hashids->encode(str_replace(MultiDB::DB_PREFIX, "", $db)); - } public function encodePrimaryKey($value) : string { - $hashids = new Hashids(config('ninja.hash_salt'), 10); return $hashids->encode($value); - } public function decodePrimaryKey($value) : string { - try { $hashids = new Hashids(config('ninja.hash_salt'), 10); $decoded_array = $hashids->decode($value); - if(!is_array($decoded_array)) - throw new ModelNotFoundException("Resource not found", 1); + if (!is_array($decoded_array)) { + throw new ModelNotFoundException("Resource not found", 1); + } return $decoded_array[0]; } catch (\Exception $e) { return response()->json(['error'=>'Invalid primary key'], 400); } - } public function transformKeys($keys) { - if (is_array($keys)) { foreach ($keys as &$value) { $value = $this->decodePrimaryKey($value); @@ -97,7 +87,5 @@ trait MakesHash } else { return $this->decodePrimaryKey($keys); } - } - } diff --git a/app/Utils/Traits/MakesInvoiceHtml.php b/app/Utils/Traits/MakesInvoiceHtml.php index 26519b5e84..bac4b54e4e 100644 --- a/app/Utils/Traits/MakesInvoiceHtml.php +++ b/app/Utils/Traits/MakesInvoiceHtml.php @@ -28,14 +28,13 @@ trait MakesInvoiceHtml * * @param string $design either the path to the design template, OR the full design template string * @param Collection $invoice The invoice object - * + * * @deprecated replaced by generateEntityHtml - * + * * @return string The invoice string in HTML format */ public function generateEntityHtml(Designer $designer, $entity, $contact = null) :string { - $entity->load('client'); $client = $entity->client; @@ -55,7 +54,7 @@ trait MakesInvoiceHtml $html = view('pdf.stub', $data)->render(); - // \Log::error($html); + // \Log::error($html); return $html; } @@ -77,7 +76,6 @@ trait MakesInvoiceHtml */ public function renderView($string, $data = []) :string { - $data['__env'] = app(\Illuminate\View\Factory::class); $php = Blade::compileString($string); diff --git a/app/Utils/Traits/MakesInvoiceValues.php b/app/Utils/Traits/MakesInvoiceValues.php index 2237eeef30..3c8d1303f0 100644 --- a/app/Utils/Traits/MakesInvoiceValues.php +++ b/app/Utils/Traits/MakesInvoiceValues.php @@ -73,17 +73,14 @@ trait MakesInvoiceValues { $custom_fields = $this->company->custom_fields; - if($custom_fields && property_exists($custom_fields, $field)){ - + if ($custom_fields && property_exists($custom_fields, $field)) { $custom_field = $custom_fields->{$field}; $custom_field_parts = explode("|", $custom_field); return $custom_field_parts[0]; - } return ''; - } public function makeLabels($contact = null) :array @@ -92,8 +89,7 @@ trait MakesInvoiceValues $values = $this->makeLabelsAndValues($contact); - foreach($values as $key => $value) - { + foreach ($values as $key => $value) { $data[$key.'_label'] = $value['label']; } @@ -113,8 +109,7 @@ trait MakesInvoiceValues $values = $this->makeLabelsAndValues($contact); - foreach($values as $key => $value) - { + foreach ($values as $key => $value) { $data[$key] = $value['value']; } @@ -154,21 +149,21 @@ trait MakesInvoiceValues $data['$total_taxes'] = ['value' => $this->makeTotalTaxes() ?: ' ', 'label' => ctrans('texts.taxes')]; $data['$invoice.total_taxes'] = &$data['$total_taxes']; - if($this instanceof Invoice){ + if ($this instanceof Invoice) { $data['$entity_label'] = ['value' => '', 'label' => ctrans('texts.invoice')]; $data['$number'] = ['value' => $this->number ?: ' ', 'label' => ctrans('texts.invoice_number')]; $data['$entity.terms'] = ['value' => $this->terms ?: ' ', 'label' => ctrans('texts.invoice_terms')]; $data['$terms'] = &$data['$entity.terms']; } - if($this instanceof Quote){ + if ($this instanceof Quote) { $data['$entity_label'] = ['value' => '', 'label' => ctrans('texts.quote')]; $data['$number'] = ['value' => $this->number ?: ' ', 'label' => ctrans('texts.quote_number')]; $data['$entity.terms'] = ['value' => $this->terms ?: ' ', 'label' => ctrans('texts.quote_terms')]; $data['$terms'] = &$data['$entity.terms']; } - if($this instanceof Credit){ + if ($this instanceof Credit) { $data['$entity_label'] = ['value' => '', 'label' => ctrans('texts.credit')]; $data['$number'] = ['value' => $this->number ?: ' ', 'label' => ctrans('texts.credit_number')]; $data['$entity.terms'] = ['value' => $this->terms ?: ' ', 'label' => ctrans('texts.credit_terms')]; @@ -211,7 +206,7 @@ trait MakesInvoiceValues // $data['$your_invoice'] = ; // $data['$quote'] = ; // $data['$your_quote'] = ; - // + // $data['$quote_date'] = ['value' => $this->date ?: ' ', 'label' => ctrans('texts.quote_date')]; $data['$quote_number'] = ['value' => $this->number ?: ' ', 'label' => ctrans('texts.quote_number')]; $data['$quote.quote_number'] = &$data['$quote_number']; @@ -220,7 +215,8 @@ trait MakesInvoiceValues $data['$valid_until'] = ['value' => $this->due_date, 'label' => ctrans('texts.valid_until')]; $data['$quote_total'] = ['value' => Number::formatMoney($this->calc()->getTotal(), $this->client) ?: ' ', 'label' => ctrans('texts.quote_total')]; $data['$credit_amount'] = ['value' => Number::formatMoney($this->calc()->getTotal(), $this->client) ?: ' ', 'label' => ctrans('texts.credit_amount')]; - $data['$credit_balance'] = ['value' => Number::formatMoney($this->balance, $this->client) ?: ' ', 'label' => ctrans('texts.credit_balance')];; + $data['$credit_balance'] = ['value' => Number::formatMoney($this->balance, $this->client) ?: ' ', 'label' => ctrans('texts.credit_balance')]; + ; $data['$credit_number'] = &$data['$number']; $data['$credit_no'] = &$data['$number']; $data['$credit.credit_no'] = &$data['$number']; @@ -265,8 +261,9 @@ trait MakesInvoiceValues $data['$client.country'] = &$data['$country']; $data['$client.email'] = &$data['$email']; - if(!$contact) + if (!$contact) { $contact = $this->client->primary_contact()->first(); + } $data['$contact_name'] = ['value' => isset($contact) ? $contact->present()->name() : 'no contact name on record', 'label' => ctrans('texts.contact_name')]; $data['$contact.name'] = &$data['$contact_name']; @@ -344,7 +341,7 @@ trait MakesInvoiceValues $data['$credit_to'] = ; $data['$your_credit'] = ; $data['$phone'] = ; - + $data['$outstanding'] = ; $data['$invoice_due_date'] = ; $data['$quote_due_date'] = ; @@ -375,13 +372,11 @@ trait MakesInvoiceValues */ public function buildTableHeader($columns) :?string { - $data = $this->makeLabels(); $table_header = ''; foreach ($columns as $key => $column) { - $table_header .= '' . $key . '_label'; } @@ -390,7 +385,6 @@ trait MakesInvoiceValues $table_header = str_replace(array_keys($data), array_values($data), $table_header); return $table_header; - } /** @@ -398,40 +392,35 @@ trait MakesInvoiceValues * @param array $columns The array (or string of column headers) * @return string injectable HTML string */ - public function buildTableBody(array $default_columns, string $user_columns, string $table_prefix) :?string + public function buildTableBody(array $default_columns, $user_columns, string $table_prefix) :?string { $items = $this->transformLineItems($this->line_items, $table_prefix); - if(count($items) == 0) + if (count($items) == 0) { return ''; + } $data = $this->makeValues(); $output = ''; - if(strlen($user_columns) > 1) { - - foreach($items as $key => $item){ + if (strlen($user_columns) > 1) { + foreach ($items as $key => $item) { $tmp = str_replace(array_keys($data), array_values($data), $user_columns); $tmp = str_replace(array_keys($item), array_values($item), $tmp); $output .= $tmp; } - - } - else { - + } else { $table_row = ''; foreach ($default_columns as $key => $column) { - $table_row .= '' . $key . ''; } $table_row .= ''; - foreach($items as $key => $item){ - + foreach ($items as $key => $item) { $tmp = str_replace(array_keys($item), array_values($item), $table_row); $tmp = str_replace(array_keys($data), array_values($data), $tmp); @@ -450,8 +439,9 @@ trait MakesInvoiceValues */ private function transformColumnsForHeader(array $columns) :array { - if(count($columns) == 0) + if (count($columns) == 0) { return []; + } $pre_columns = $columns; $columns = array_intersect($columns, self::$master_columns); @@ -515,16 +505,18 @@ trait MakesInvoiceValues { $data = []; - if(!is_array($items)) + if (!is_array($items)) { $data; + } foreach ($items as $key => $item) { - - if($table_type == '$product' && $item->type_id != 1) + if ($table_type == '$product' && $item->type_id != 1) { continue; + } - if($table_type == '$task' && $item->type_id != 2) + if ($table_type == '$task' && $item->type_id != 2) { continue; + } $data[$key][$table_type.'.product_key'] = $item->product_key; $data[$key][$table_type.'.notes'] = $item->notes; @@ -543,36 +535,36 @@ trait MakesInvoiceValues } else { $data[$key][$table_type.'.discount'] = $item->discount . '%'; } - } - else + } else { $data[$key][$table_type.'.discount'] = ''; + } - if(isset($item->tax_rate1) && $item->tax_rate1 > 0){ - $data[$key][$table_type.'.tax_rate1'] = round($item->tax_rate1,2) . "%"; + if (isset($item->tax_rate1) && $item->tax_rate1 > 0) { + $data[$key][$table_type.'.tax_rate1'] = round($item->tax_rate1, 2) . "%"; $data[$key][$table_type.'.tax1'] = &$data[$key][$table_type.'.tax_rate1']; } - if(isset($item->tax_rate2) && $item->tax_rate2 > 0){ - $data[$key][$table_type.'.tax_rate2'] = round($item->tax_rate2,2) . "%"; + if (isset($item->tax_rate2) && $item->tax_rate2 > 0) { + $data[$key][$table_type.'.tax_rate2'] = round($item->tax_rate2, 2) . "%"; $data[$key][$table_type.'.tax2'] = &$data[$key][$table_type.'.tax_rate2']; } - if(isset($item->tax_rate3) && $item->tax_rate3 > 0){ - $data[$key][$table_type.'.tax_rate3'] = round($item->tax_rate3,2) . "%"; + if (isset($item->tax_rate3) && $item->tax_rate3 > 0) { + $data[$key][$table_type.'.tax_rate3'] = round($item->tax_rate3, 2) . "%"; $data[$key][$table_type.'.tax3'] = &$data[$key][$table_type.'.tax_rate3']; } - if(isset($item->tax_rate1) && $item->tax_rate1 == 0){ + if (isset($item->tax_rate1) && $item->tax_rate1 == 0) { $data[$key][$table_type.'.tax_rate1'] = ''; $data[$key][$table_type.'.tax1'] = &$data[$key][$table_type.'.tax_rate1']; } - if(isset($item->tax_rate2) && $item->tax_rate2 == 0){ + if (isset($item->tax_rate2) && $item->tax_rate2 == 0) { $data[$key][$table_type.'.tax_rate2'] = ''; $data[$key][$table_type.'.tax2'] = &$data[$key][$table_type.'.tax_rate2']; } - if(isset($item->tax_rate3) && $item->tax_rate3 == 0){ + if (isset($item->tax_rate3) && $item->tax_rate3 == 0) { $data[$key][$table_type.'.tax_rate3'] = ''; $data[$key][$table_type.'.tax3'] = &$data[$key][$table_type.'.tax_rate3']; } @@ -664,8 +656,9 @@ trait MakesInvoiceValues $data = ''; - foreach ($tax_map as $tax) + foreach ($tax_map as $tax) { $data .= ''. $tax['name'] .''; + } return $data; } @@ -676,8 +669,9 @@ trait MakesInvoiceValues $data = ''; - foreach ($tax_map as $tax) + foreach ($tax_map as $tax) { $data .= ''. Number::formatMoney($tax['total'], $this->client) .''; + } return $data; } @@ -687,6 +681,6 @@ trait MakesInvoiceValues */ public function generateAppUrl() { - return rtrim(config('ninja.app_url'),"/"); + return rtrim(config('ninja.app_url'), "/"); } } diff --git a/app/Utils/Traits/MakesReminders.php b/app/Utils/Traits/MakesReminders.php index dd2851181f..5b0d3dd663 100644 --- a/app/Utils/Traits/MakesReminders.php +++ b/app/Utils/Traits/MakesReminders.php @@ -189,14 +189,20 @@ trait MakesReminders $client = $this->client; //if the invoice - if ($client->getSetting('enable_reminder1') !== false && $this->inReminderWindow($client->getSetting('schedule_reminder1'), - $client->getSetting('num_days_reminder1'))) { + if ($client->getSetting('enable_reminder1') !== false && $this->inReminderWindow( + $client->getSetting('schedule_reminder1'), + $client->getSetting('num_days_reminder1') + )) { return 'template1'; - } elseif ($client->getSetting('enable_reminder2') !== false && $this->inReminderWindow($client->getSetting('schedule_reminder2'), - $client->getSetting('num_days_reminder2'))) { + } elseif ($client->getSetting('enable_reminder2') !== false && $this->inReminderWindow( + $client->getSetting('schedule_reminder2'), + $client->getSetting('num_days_reminder2') + )) { return 'template2'; - } elseif ($client->getSetting('enable_reminder3') !== false && $this->inReminderWindow($client->getSetting('schedule_reminder3'), - $client->getSetting('num_days_reminder3'))) { + } elseif ($client->getSetting('enable_reminder3') !== false && $this->inReminderWindow( + $client->getSetting('schedule_reminder3'), + $client->getSetting('num_days_reminder3') + )) { return 'template3'; } else { return 'invoice'; diff --git a/app/Utils/Traits/MakesTemplateData.php b/app/Utils/Traits/MakesTemplateData.php index e618689393..53082c6cff 100644 --- a/app/Utils/Traits/MakesTemplateData.php +++ b/app/Utils/Traits/MakesTemplateData.php @@ -18,15 +18,13 @@ namespace App\Utils\Traits; trait MakesTemplateData { - public function makeFakerLabels() :array { $data = []; $values = $this->getFakerData(); - foreach($values as $key => $value) - { + foreach ($values as $key => $value) { $data[$key.'_label'] = $value['label']; } @@ -46,8 +44,7 @@ trait MakesTemplateData $values = $this->getFakerData(); - foreach($values as $key => $value) - { + foreach ($values as $key => $value) { $data[$key] = $value['value']; } @@ -57,209 +54,208 @@ trait MakesTemplateData public function getFakerData() { - $data = []; + $data = []; - $data['$tax'] = ['value' => '', 'label' => ctrans('texts.tax')]; - $data['$app_url'] = ['value' => 'https://example.com', 'label' => '']; - $data['$from'] = ['value' => '', 'label' => ctrans('texts.from')]; - $data['$to'] = ['value' => '', 'label' => ctrans('texts.to')]; - $data['$total_tax_labels'] = ['value' => 'VAT', 'label' => ctrans('texts.taxes')]; - $data['$total_tax_values'] = ['value' => '17.5%', 'label' => ctrans('texts.taxes')]; - $data['$line_tax_labels'] = ['value' => 'VAT', 'label' => ctrans('texts.taxes')]; - $data['$line_tax_values'] = ['value' => '17.5%', 'label' => ctrans('texts.taxes')]; - $data['$date'] = ['value' => '2010-02-02', 'label' => ctrans('texts.date')]; - $data['$invoice_date'] = ['value' => '2010-02-02', 'label' => ctrans('texts.invoice_date')]; - $data['$invoice.date'] = &$data['$date']; - $data['$due_date'] = ['value' => '2010-02-02', 'label' => ctrans('texts.due_date')]; - $data['$invoice.due_date'] = &$data['$due_date']; - $data['$invoice.number'] = ['value' => '#INV-20293', 'label' => ctrans('texts.invoice_number')]; - $data['$invoice.invoice_number'] = &$data['$invoice.number']; - $data['$invoice_number'] = &$data['$invoice.number']; - $data['$po_number'] = ['value' => '#PO-12322', 'label' => ctrans('texts.po_number')]; - $data['$invoice.po_number'] = &$data['$po_number']; - $data['$line_taxes'] = &$data['$line_tax_labels']; - $data['$invoice.line_taxes'] = &$data['$line_tax_labels']; - $data['$total_taxes'] = &$data['$line_tax_labels']; - $data['$invoice.total_taxes'] = &$data['$total_taxes']; - $data['$entity_label'] = ['value' => '', 'label' => ctrans('texts.invoice')]; - $data['$number'] = ['value' => '#ENT-292', 'label' => ctrans('texts.invoice_number')]; - $data['$entity.terms'] = ['value' => 'The terms and conditions are listed below and are non negotiable', 'label' => ctrans('texts.invoice_terms')]; - $data['$terms'] = &$data['$entity.terms']; - $data['$entity_number'] = &$data['$number']; - $data['$discount'] = ['value' => '$10.00', 'label' => ctrans('texts.discount')]; - $data['$invoice.discount'] = &$data['$discount']; - $data['$subtotal'] = ['value' => '$20.00', 'label' => ctrans('texts.subtotal')]; - $data['$invoice.subtotal'] = &$data['$subtotal']; - $data['$balance_due'] = ['value' => '$5.00', 'label' => ctrans('texts.balance_due')]; - $data['$invoice.balance_due'] = &$data['$balance_due']; - $data['$partial_due'] = ['value' => '$5.00', 'label' => ctrans('texts.partial_due')]; - $data['$invoice.partial_due'] = &$data['$partial_due']; - $data['$total'] = ['value' => '$100.00', 'label' => ctrans('texts.total')]; - $data['$invoice.total'] = ['value' => '$100.00', 'label' => ctrans('texts.invoice_total')]; - $data['$amount'] = &$data['$total']; - $data['$invoice_total'] = &$data['$total']; - $data['$invoice.amount'] = &$data['$total']; - $data['$quote_total'] = ['value' => '$100.00', 'label' => ctrans('texts.quote_total')]; - $data['$quote.amount'] = &$data['$quote_total']; - $data['$credit_total'] = ['value' => '$100.00', 'label' => ctrans('texts.credit_total')]; - $data['$credit.amount'] = &$data['$credit_total']; - $data['$balance'] = ['value' => '$100.00', 'label' => ctrans('texts.balance')]; - $data['$invoice.balance'] = &$data['$balance']; - $data['$taxes'] = ['value' => '$10.00', 'label' => ctrans('texts.taxes')]; - $data['$invoice.taxes'] = &$data['$taxes']; - $data['$invoice1'] = ['value' => '10', 'label' => 'invoice1']; - $data['$invoice2'] = ['value' => '10', 'label' => 'invoice2']; - $data['$invoice3'] = ['value' => '10', 'label' => 'invoice3']; - $data['$invoice4'] = ['value' => '10', 'label' => 'invoice4']; - $data['$invoice.public_notes'] = ['value' => '10', 'label' => ctrans('texts.public_notes')]; - $data['$entity.public_notes'] = &$data['$invoice.public_notes']; - $data['$quote_date'] = ['value' => '2010-02-03', 'label' => ctrans('texts.quote_date')]; - $data['$quote_number'] = ['value' => '#QUOTE-19338', 'label' => ctrans('texts.quote_number')]; - $data['$quote.quote_number'] = &$data['$quote_number']; - $data['$quote_no'] = &$data['$quote_number']; - $data['$quote.quote_no'] = &$data['$quote_number']; - $data['$valid_until'] = ['value' => '2010-02-03', 'label' => ctrans('texts.valid_until')]; - $data['$quote_total'] = ['value' => '$20.00', 'label' => ctrans('texts.quote_total')]; - $data['$credit_amount'] = ['value' => '$15.00', 'label' => ctrans('texts.credit_amount')]; - $data['$credit_balance'] = ['value' => '$12.00', 'label' => ctrans('texts.credit_balance')];; - $data['$credit_number'] = &$data['$number']; - $data['$credit_no'] = &$data['$number']; - $data['$credit.credit_no'] = &$data['$number']; - $data['$invoice_no'] = &$data['$number']; - $data['$invoice.invoice_no'] = &$data['$number']; - $data['$client1'] = ['value' => 'Client Custom Values', 'label' => 'client 1']; - $data['$client2'] = ['value' => 'Client Custom Values', 'label' => 'client 2']; - $data['$client3'] = ['value' => 'Client Custom Values', 'label' => 'client 3']; - $data['$client4'] = ['value' => 'Client Custom Values', 'label' => 'client 4']; - $data['$address1'] = ['value' => '5 Jimbuckeroo Way', 'label' => ctrans('texts.address1')]; - $data['$address2'] = ['value' => 'Kalamazoo', 'label' => ctrans('texts.address2')]; - $data['$id_number'] = ['value' => 'ID Number', 'label' => ctrans('texts.id_number')]; - $data['$vat_number'] = ['value' => '555-434-324', 'label' => ctrans('texts.vat_number')]; - $data['$website'] = ['value' => 'https://www.invoiceninja.com', 'label' => ctrans('texts.website')]; - $data['$phone'] = ['value' => '555-12321', 'label' => ctrans('texts.phone')]; - $data['$country'] = ['value' => 'USA', 'label' => ctrans('texts.country')]; - $data['$email'] = ['value' => 'user@example.com', 'label' => ctrans('texts.email')]; - $data['$client_name'] = ['value' => 'Joe Denkins', 'label' => ctrans('texts.client_name')]; - $data['$client.name'] = &$data['$client_name']; - $data['$client.address1'] = &$data['$address1']; - $data['$client.address2'] = &$data['$address2']; - $data['$client_address'] = ['value' => '5 Kalamazoo Way\n Jimbuckeroo\n USA 90210', 'label' => ctrans('texts.address')]; - $data['$client.address'] = &$data['$client_address']; - $data['$client.id_number'] = &$data['$id_number']; - $data['$client.vat_number'] = &$data['$vat_number']; - $data['$client.website'] = &$data['$website']; - $data['$client.phone'] = &$data['$phone']; - $data['$city_state_postal'] = ['value' => 'Los Angeles, CA, 90210', 'label' => ctrans('texts.city_state_postal')]; - $data['$client.city_state_postal'] = &$data['$city_state_postal']; - $data['$postal_city_state'] = ['value' => '90210, Los Angeles, CA', 'label' => ctrans('texts.postal_city_state')]; - $data['$client.postal_city_state'] = &$data['$postal_city_state']; - $data['$client.country'] = &$data['$country']; - $data['$client.email'] = &$data['$email']; - $data['$contact_name'] = ['value' => 'Jimmy Nadel', 'label' => ctrans('texts.contact_name')]; - $data['$contact.name'] = &$data['$contact_name']; - $data['$contact1'] = ['value' => 'Custom Contact Values', 'label' => 'contact 1']; - $data['$contact2'] = ['value' => 'Custom Contact Values', 'label' => 'contact 2']; - $data['$contact3'] = ['value' => 'Custom Contact Values', 'label' => 'contact 3']; - $data['$contact4'] = ['value' => 'Custom Contact Values', 'label' => 'contact 4']; - $data['$company.city_state_postal'] = ['value' => 'Los Angeles, CA, 90210', 'label' => ctrans('texts.city_state_postal')]; - $data['$company.postal_city_state'] = ['value' => '90210, Los Angeles, CA', 'label' => ctrans('texts.postal_city_state')]; - $data['$company.name'] = ['value' => 'ACME co', 'label' => ctrans('texts.company_name')]; - $data['$company.company_name'] = &$data['$company.name']; - $data['$company.address1'] = ['value' => '5 Jimbuckeroo Way', 'label' => ctrans('texts.address1')]; - $data['$company.address2'] = ['value' => 'Kalamazoo', 'label' => ctrans('texts.address2')]; - $data['$company.city'] = ['value' => 'Los Angeles', 'label' => ctrans('texts.city')]; - $data['$company.state'] = ['value' => 'CA', 'label' => ctrans('texts.state')]; - $data['$company.postal_code'] = ['value' => '90210', 'label' => ctrans('texts.postal_code')]; - $data['$company.country'] = ['value' => 'USA', 'label' => ctrans('texts.country')]; - $data['$company.phone'] = ['value' => '555-3432', 'label' => ctrans('texts.phone')]; - $data['$company.email'] = ['value' => 'user@example.com', 'label' => ctrans('texts.email')]; - $data['$company.vat_number'] = ['value' => 'VAT-3344-223', 'label' => ctrans('texts.vat_number')]; - $data['$company.id_number'] = ['value' => 'ID-NO-#434', 'label' => ctrans('texts.id_number')]; - $data['$company.website'] = ['value' => 'https://invoiceninja.com', 'label' => ctrans('texts.website')]; - $data['$company.address'] = ['value' => '5 Kalamazoo Way\n Jimbuckeroo\n USA 90210', 'label' => ctrans('texts.address')]; - $data['$company.logo'] = ['value' => "logo" ?: ' ', 'label' => ctrans('texts.logo')]; - $data['$company_logo'] = &$data['$company.logo']; - $data['$company1'] = ['value' => 'Company Custom Value 1', 'label' => 'company label1']; - $data['$company2'] = ['value' => 'Company Custom Value 2', 'label' => 'company label2']; - $data['$company3'] = ['value' => 'Company Custom Value 3', 'label' => 'company label3']; - $data['$company4'] = ['value' => 'Company Custom Value 4', 'label' => 'company label4']; - $data['$product.date'] = ['value' => '2010-02-03', 'label' => ctrans('texts.date')]; - $data['$product.discount'] = ['value' => '5%', 'label' => ctrans('texts.discount')]; - $data['$product.product_key'] = ['value' => 'key', 'label' => ctrans('texts.product_key')]; - $data['$product.notes'] = ['value' => 'Product Stuff', 'label' => ctrans('texts.notes')]; - $data['$product.cost'] = ['value' => '$10.00', 'label' => ctrans('texts.cost')]; - $data['$product.quantity'] = ['value' => '1', 'label' => ctrans('texts.quantity')]; - $data['$product.tax_name1'] = ['value' => 'GST', 'label' => ctrans('texts.tax')]; - $data['$product.tax_name2'] = ['value' => 'VAT', 'label' => ctrans('texts.tax')]; - $data['$product.tax_name3'] = ['value' => 'Sales TAX', 'label' => ctrans('texts.tax')]; - $data['$product.line_total'] = ['value' => '$20.00', 'label' => ctrans('texts.line_total')]; - $data['$task.date'] = ['value' => '2010-02-03', 'label' => ctrans('texts.date')]; - $data['$task.discount'] = ['value' => '5%', 'label' => ctrans('texts.discount')]; - $data['$task.product_key'] = ['value' => 'key', 'label' => ctrans('texts.product_key')]; - $data['$task.notes'] = ['value' => 'Note for Tasks', 'label' => ctrans('texts.notes')]; - $data['$task.cost'] = ['value' => '$100.00', 'label' => ctrans('texts.cost')]; - $data['$task.quantity'] = ['value' => '1', 'label' => ctrans('texts.quantity')]; - $data['$task.tax_name1'] = ['value' => 'GST', 'label' => ctrans('texts.tax')]; - $data['$task.tax_name2'] = ['value' => 'VAT', 'label' => ctrans('texts.tax')]; - $data['$task.tax_name3'] = ['value' => 'CA Sales Tax', 'label' => ctrans('texts.tax')]; - $data['$task.line_total'] = ['value' => '$100.00', 'label' => ctrans('texts.line_total')]; + $data['$tax'] = ['value' => '', 'label' => ctrans('texts.tax')]; + $data['$app_url'] = ['value' => 'https://example.com', 'label' => '']; + $data['$from'] = ['value' => '', 'label' => ctrans('texts.from')]; + $data['$to'] = ['value' => '', 'label' => ctrans('texts.to')]; + $data['$total_tax_labels'] = ['value' => 'VAT', 'label' => ctrans('texts.taxes')]; + $data['$total_tax_values'] = ['value' => '17.5%', 'label' => ctrans('texts.taxes')]; + $data['$line_tax_labels'] = ['value' => 'VAT', 'label' => ctrans('texts.taxes')]; + $data['$line_tax_values'] = ['value' => '17.5%', 'label' => ctrans('texts.taxes')]; + $data['$date'] = ['value' => '2010-02-02', 'label' => ctrans('texts.date')]; + $data['$invoice_date'] = ['value' => '2010-02-02', 'label' => ctrans('texts.invoice_date')]; + $data['$invoice.date'] = &$data['$date']; + $data['$due_date'] = ['value' => '2010-02-02', 'label' => ctrans('texts.due_date')]; + $data['$invoice.due_date'] = &$data['$due_date']; + $data['$invoice.number'] = ['value' => '#INV-20293', 'label' => ctrans('texts.invoice_number')]; + $data['$invoice.invoice_number'] = &$data['$invoice.number']; + $data['$invoice_number'] = &$data['$invoice.number']; + $data['$po_number'] = ['value' => '#PO-12322', 'label' => ctrans('texts.po_number')]; + $data['$invoice.po_number'] = &$data['$po_number']; + $data['$line_taxes'] = &$data['$line_tax_labels']; + $data['$invoice.line_taxes'] = &$data['$line_tax_labels']; + $data['$total_taxes'] = &$data['$line_tax_labels']; + $data['$invoice.total_taxes'] = &$data['$total_taxes']; + $data['$entity_label'] = ['value' => '', 'label' => ctrans('texts.invoice')]; + $data['$number'] = ['value' => '#ENT-292', 'label' => ctrans('texts.invoice_number')]; + $data['$entity.terms'] = ['value' => 'The terms and conditions are listed below and are non negotiable', 'label' => ctrans('texts.invoice_terms')]; + $data['$terms'] = &$data['$entity.terms']; + $data['$entity_number'] = &$data['$number']; + $data['$discount'] = ['value' => '$10.00', 'label' => ctrans('texts.discount')]; + $data['$invoice.discount'] = &$data['$discount']; + $data['$subtotal'] = ['value' => '$20.00', 'label' => ctrans('texts.subtotal')]; + $data['$invoice.subtotal'] = &$data['$subtotal']; + $data['$balance_due'] = ['value' => '$5.00', 'label' => ctrans('texts.balance_due')]; + $data['$invoice.balance_due'] = &$data['$balance_due']; + $data['$partial_due'] = ['value' => '$5.00', 'label' => ctrans('texts.partial_due')]; + $data['$invoice.partial_due'] = &$data['$partial_due']; + $data['$total'] = ['value' => '$100.00', 'label' => ctrans('texts.total')]; + $data['$invoice.total'] = ['value' => '$100.00', 'label' => ctrans('texts.invoice_total')]; + $data['$amount'] = &$data['$total']; + $data['$invoice_total'] = &$data['$total']; + $data['$invoice.amount'] = &$data['$total']; + $data['$quote_total'] = ['value' => '$100.00', 'label' => ctrans('texts.quote_total')]; + $data['$quote.amount'] = &$data['$quote_total']; + $data['$credit_total'] = ['value' => '$100.00', 'label' => ctrans('texts.credit_total')]; + $data['$credit.amount'] = &$data['$credit_total']; + $data['$balance'] = ['value' => '$100.00', 'label' => ctrans('texts.balance')]; + $data['$invoice.balance'] = &$data['$balance']; + $data['$taxes'] = ['value' => '$10.00', 'label' => ctrans('texts.taxes')]; + $data['$invoice.taxes'] = &$data['$taxes']; + $data['$invoice1'] = ['value' => '10', 'label' => 'invoice1']; + $data['$invoice2'] = ['value' => '10', 'label' => 'invoice2']; + $data['$invoice3'] = ['value' => '10', 'label' => 'invoice3']; + $data['$invoice4'] = ['value' => '10', 'label' => 'invoice4']; + $data['$invoice.public_notes'] = ['value' => '10', 'label' => ctrans('texts.public_notes')]; + $data['$entity.public_notes'] = &$data['$invoice.public_notes']; + $data['$quote_date'] = ['value' => '2010-02-03', 'label' => ctrans('texts.quote_date')]; + $data['$quote_number'] = ['value' => '#QUOTE-19338', 'label' => ctrans('texts.quote_number')]; + $data['$quote.quote_number'] = &$data['$quote_number']; + $data['$quote_no'] = &$data['$quote_number']; + $data['$quote.quote_no'] = &$data['$quote_number']; + $data['$valid_until'] = ['value' => '2010-02-03', 'label' => ctrans('texts.valid_until')]; + $data['$quote_total'] = ['value' => '$20.00', 'label' => ctrans('texts.quote_total')]; + $data['$credit_amount'] = ['value' => '$15.00', 'label' => ctrans('texts.credit_amount')]; + $data['$credit_balance'] = ['value' => '$12.00', 'label' => ctrans('texts.credit_balance')]; + ; + $data['$credit_number'] = &$data['$number']; + $data['$credit_no'] = &$data['$number']; + $data['$credit.credit_no'] = &$data['$number']; + $data['$invoice_no'] = &$data['$number']; + $data['$invoice.invoice_no'] = &$data['$number']; + $data['$client1'] = ['value' => 'Client Custom Values', 'label' => 'client 1']; + $data['$client2'] = ['value' => 'Client Custom Values', 'label' => 'client 2']; + $data['$client3'] = ['value' => 'Client Custom Values', 'label' => 'client 3']; + $data['$client4'] = ['value' => 'Client Custom Values', 'label' => 'client 4']; + $data['$address1'] = ['value' => '5 Jimbuckeroo Way', 'label' => ctrans('texts.address1')]; + $data['$address2'] = ['value' => 'Kalamazoo', 'label' => ctrans('texts.address2')]; + $data['$id_number'] = ['value' => 'ID Number', 'label' => ctrans('texts.id_number')]; + $data['$vat_number'] = ['value' => '555-434-324', 'label' => ctrans('texts.vat_number')]; + $data['$website'] = ['value' => 'https://www.invoiceninja.com', 'label' => ctrans('texts.website')]; + $data['$phone'] = ['value' => '555-12321', 'label' => ctrans('texts.phone')]; + $data['$country'] = ['value' => 'USA', 'label' => ctrans('texts.country')]; + $data['$email'] = ['value' => 'user@example.com', 'label' => ctrans('texts.email')]; + $data['$client_name'] = ['value' => 'Joe Denkins', 'label' => ctrans('texts.client_name')]; + $data['$client.name'] = &$data['$client_name']; + $data['$client.address1'] = &$data['$address1']; + $data['$client.address2'] = &$data['$address2']; + $data['$client_address'] = ['value' => '5 Kalamazoo Way\n Jimbuckeroo\n USA 90210', 'label' => ctrans('texts.address')]; + $data['$client.address'] = &$data['$client_address']; + $data['$client.id_number'] = &$data['$id_number']; + $data['$client.vat_number'] = &$data['$vat_number']; + $data['$client.website'] = &$data['$website']; + $data['$client.phone'] = &$data['$phone']; + $data['$city_state_postal'] = ['value' => 'Los Angeles, CA, 90210', 'label' => ctrans('texts.city_state_postal')]; + $data['$client.city_state_postal'] = &$data['$city_state_postal']; + $data['$postal_city_state'] = ['value' => '90210, Los Angeles, CA', 'label' => ctrans('texts.postal_city_state')]; + $data['$client.postal_city_state'] = &$data['$postal_city_state']; + $data['$client.country'] = &$data['$country']; + $data['$client.email'] = &$data['$email']; + $data['$contact_name'] = ['value' => 'Jimmy Nadel', 'label' => ctrans('texts.contact_name')]; + $data['$contact.name'] = &$data['$contact_name']; + $data['$contact1'] = ['value' => 'Custom Contact Values', 'label' => 'contact 1']; + $data['$contact2'] = ['value' => 'Custom Contact Values', 'label' => 'contact 2']; + $data['$contact3'] = ['value' => 'Custom Contact Values', 'label' => 'contact 3']; + $data['$contact4'] = ['value' => 'Custom Contact Values', 'label' => 'contact 4']; + $data['$company.city_state_postal'] = ['value' => 'Los Angeles, CA, 90210', 'label' => ctrans('texts.city_state_postal')]; + $data['$company.postal_city_state'] = ['value' => '90210, Los Angeles, CA', 'label' => ctrans('texts.postal_city_state')]; + $data['$company.name'] = ['value' => 'ACME co', 'label' => ctrans('texts.company_name')]; + $data['$company.company_name'] = &$data['$company.name']; + $data['$company.address1'] = ['value' => '5 Jimbuckeroo Way', 'label' => ctrans('texts.address1')]; + $data['$company.address2'] = ['value' => 'Kalamazoo', 'label' => ctrans('texts.address2')]; + $data['$company.city'] = ['value' => 'Los Angeles', 'label' => ctrans('texts.city')]; + $data['$company.state'] = ['value' => 'CA', 'label' => ctrans('texts.state')]; + $data['$company.postal_code'] = ['value' => '90210', 'label' => ctrans('texts.postal_code')]; + $data['$company.country'] = ['value' => 'USA', 'label' => ctrans('texts.country')]; + $data['$company.phone'] = ['value' => '555-3432', 'label' => ctrans('texts.phone')]; + $data['$company.email'] = ['value' => 'user@example.com', 'label' => ctrans('texts.email')]; + $data['$company.vat_number'] = ['value' => 'VAT-3344-223', 'label' => ctrans('texts.vat_number')]; + $data['$company.id_number'] = ['value' => 'ID-NO-#434', 'label' => ctrans('texts.id_number')]; + $data['$company.website'] = ['value' => 'https://invoiceninja.com', 'label' => ctrans('texts.website')]; + $data['$company.address'] = ['value' => '5 Kalamazoo Way\n Jimbuckeroo\n USA 90210', 'label' => ctrans('texts.address')]; + $data['$company.logo'] = ['value' => "logo" ?: ' ', 'label' => ctrans('texts.logo')]; + $data['$company_logo'] = &$data['$company.logo']; + $data['$company1'] = ['value' => 'Company Custom Value 1', 'label' => 'company label1']; + $data['$company2'] = ['value' => 'Company Custom Value 2', 'label' => 'company label2']; + $data['$company3'] = ['value' => 'Company Custom Value 3', 'label' => 'company label3']; + $data['$company4'] = ['value' => 'Company Custom Value 4', 'label' => 'company label4']; + $data['$product.date'] = ['value' => '2010-02-03', 'label' => ctrans('texts.date')]; + $data['$product.discount'] = ['value' => '5%', 'label' => ctrans('texts.discount')]; + $data['$product.product_key'] = ['value' => 'key', 'label' => ctrans('texts.product_key')]; + $data['$product.notes'] = ['value' => 'Product Stuff', 'label' => ctrans('texts.notes')]; + $data['$product.cost'] = ['value' => '$10.00', 'label' => ctrans('texts.cost')]; + $data['$product.quantity'] = ['value' => '1', 'label' => ctrans('texts.quantity')]; + $data['$product.tax_name1'] = ['value' => 'GST', 'label' => ctrans('texts.tax')]; + $data['$product.tax_name2'] = ['value' => 'VAT', 'label' => ctrans('texts.tax')]; + $data['$product.tax_name3'] = ['value' => 'Sales TAX', 'label' => ctrans('texts.tax')]; + $data['$product.line_total'] = ['value' => '$20.00', 'label' => ctrans('texts.line_total')]; + $data['$task.date'] = ['value' => '2010-02-03', 'label' => ctrans('texts.date')]; + $data['$task.discount'] = ['value' => '5%', 'label' => ctrans('texts.discount')]; + $data['$task.product_key'] = ['value' => 'key', 'label' => ctrans('texts.product_key')]; + $data['$task.notes'] = ['value' => 'Note for Tasks', 'label' => ctrans('texts.notes')]; + $data['$task.cost'] = ['value' => '$100.00', 'label' => ctrans('texts.cost')]; + $data['$task.quantity'] = ['value' => '1', 'label' => ctrans('texts.quantity')]; + $data['$task.tax_name1'] = ['value' => 'GST', 'label' => ctrans('texts.tax')]; + $data['$task.tax_name2'] = ['value' => 'VAT', 'label' => ctrans('texts.tax')]; + $data['$task.tax_name3'] = ['value' => 'CA Sales Tax', 'label' => ctrans('texts.tax')]; + $data['$task.line_total'] = ['value' => '$100.00', 'label' => ctrans('texts.line_total')]; - //$data['$paid_to_date'] = ; - // $data['$your_invoice'] = ; - // $data['$quote'] = ; - // $data['$your_quote'] = ; - // $data['$invoice_issued_to'] = ; - // $data['$quote_issued_to'] = ; - // $data['$rate'] = ; - // $data['$hours'] = ; - // $data['$from'] = ; - // $data['$to'] = ; - // $data['$invoice_to'] = ; - // $data['$quote_to'] = ; - // $data['$details'] = ; - // $data['custom_label1'] = ['value' => '', 'label' => ctrans('texts.')]; - // $data['custom_label2'] = ['value' => '', 'label' => ctrans('texts.')]; - // $data['custom_label3'] = ['value' => '', 'label' => ctrans('texts.')]; - // $data['custom_label4'] = ['value' => '', 'label' => ctrans('texts.')]; - //$data['$blank'] = ; - //$data['$surcharge'] = ; - /* - $data['$tax_invoice'] = - $data['$tax_quote'] = - $data['$statement'] = ; - $data['$statement_date'] = ; - $data['$your_statement'] = ; - $data['$statement_issued_to'] = ; - $data['$statement_to'] = ; - $data['$credit_note'] = ; - $data['$credit_date'] = ; - $data['$credit_issued_to'] = ; - $data['$credit_to'] = ; - $data['$your_credit'] = ; - $data['$phone'] = ; - - $data['$outstanding'] = ; - $data['$invoice_due_date'] = ; - $data['$quote_due_date'] = ; - $data['$service'] = ; - $data['$product_key'] = ; - $data['$unit_cost'] = ; - $data['$custom_value1'] = ; - $data['$custom_value2'] = ; - $data['$delivery_note'] = ; - $data['$date'] = ; - $data['$method'] = ; - $data['$payment_date'] = ; - $data['$reference'] = ; - $data['$amount'] = ; - $data['$amount_paid'] =; - */ + //$data['$paid_to_date'] = ; + // $data['$your_invoice'] = ; + // $data['$quote'] = ; + // $data['$your_quote'] = ; + // $data['$invoice_issued_to'] = ; + // $data['$quote_issued_to'] = ; + // $data['$rate'] = ; + // $data['$hours'] = ; + // $data['$from'] = ; + // $data['$to'] = ; + // $data['$invoice_to'] = ; + // $data['$quote_to'] = ; + // $data['$details'] = ; + // $data['custom_label1'] = ['value' => '', 'label' => ctrans('texts.')]; + // $data['custom_label2'] = ['value' => '', 'label' => ctrans('texts.')]; + // $data['custom_label3'] = ['value' => '', 'label' => ctrans('texts.')]; + // $data['custom_label4'] = ['value' => '', 'label' => ctrans('texts.')]; + //$data['$blank'] = ; + //$data['$surcharge'] = ; + /* + $data['$tax_invoice'] = + $data['$tax_quote'] = + $data['$statement'] = ; + $data['$statement_date'] = ; + $data['$your_statement'] = ; + $data['$statement_issued_to'] = ; + $data['$statement_to'] = ; + $data['$credit_note'] = ; + $data['$credit_date'] = ; + $data['$credit_issued_to'] = ; + $data['$credit_to'] = ; + $data['$your_credit'] = ; + $data['$phone'] = ; - $arrKeysLength = array_map('strlen', array_keys($data)); - array_multisort($arrKeysLength, SORT_DESC, $data); + $data['$outstanding'] = ; + $data['$invoice_due_date'] = ; + $data['$quote_due_date'] = ; + $data['$service'] = ; + $data['$product_key'] = ; + $data['$unit_cost'] = ; + $data['$custom_value1'] = ; + $data['$custom_value2'] = ; + $data['$delivery_note'] = ; + $data['$date'] = ; + $data['$method'] = ; + $data['$payment_date'] = ; + $data['$reference'] = ; + $data['$amount'] = ; + $data['$amount_paid'] =; + */ - return $data; + $arrKeysLength = array_map('strlen', array_keys($data)); + array_multisort($arrKeysLength, SORT_DESC, $data); + return $data; } - -} \ No newline at end of file +} diff --git a/app/Utils/Traits/Notifications/UserNotifies.php b/app/Utils/Traits/Notifications/UserNotifies.php index 6b41ce2220..9637712028 100644 --- a/app/Utils/Traits/Notifications/UserNotifies.php +++ b/app/Utils/Traits/Notifications/UserNotifies.php @@ -17,24 +17,22 @@ namespace App\Utils\Traits\Notifications; */ trait UserNotifies { - - public function findUserNotificationTypes($invitation, $company_user, $entity_name, $required_permissions) :array { $notifiable_methods = []; $notifications = $company_user->notifications; - if($invitation->{$entity_name}->user_id == $company_user->_user_id || $invitation->{$entity_name}->assigned_user_id == $company_user->user_id) + if ($invitation->{$entity_name}->user_id == $company_user->_user_id || $invitation->{$entity_name}->assigned_user_id == $company_user->user_id) { array_push($required_permissions, "all_user_notifications"); + } - if(count(array_intersect($required_permissions, $notifications->email)) >=1) + if (count(array_intersect($required_permissions, $notifications->email)) >=1) { array_push($notifiable_methods, 'mail'); + } // if(count(array_intersect($required_permissions, $notifications->slack)) >=1) // array_push($notifiable_methods, 'slack'); return $notifiable_methods; - } - -} \ No newline at end of file +} diff --git a/app/Utils/Traits/Payment/Refundable.php b/app/Utils/Traits/Payment/Refundable.php index 2b3038e7b5..52917fcd9b 100644 --- a/app/Utils/Traits/Payment/Refundable.php +++ b/app/Utils/Traits/Payment/Refundable.php @@ -22,178 +22,166 @@ use App\Repositories\ActivityRepository; trait Refundable { - /** - * Entry point for processing of refunds - */ - public function processRefund(array $data) - { + /** + * Entry point for processing of refunds + */ + public function processRefund(array $data) + { + if (isset($data['invoices']) && count($data['invoices']) > 0) { + return $this->refundPaymentWithInvoices($data); + } - if(isset($data['invoices']) && count($data['invoices']) > 0) - return $this->refundPaymentWithInvoices($data); + return $this->refundPaymentWithNoInvoices($data); + } - return $this->refundPaymentWithNoInvoices($data); - } + private function refundPaymentWithNoInvoices(array $data) + { + //adjust payment refunded column amount + $this->refunded = $data['amount']; - private function refundPaymentWithNoInvoices(array $data) - { - //adjust payment refunded column amount - $this->refunded = $data['amount']; + if ($data['amount'] == $this->amount) { + $this->status_id = Payment::STATUS_REFUNDED; + } else { + $this->status_id = Payment::STATUS_PARTIALLY_REFUNDED; + } - if($data['amount'] == $this->amount) - $this->status_id = Payment::STATUS_REFUNDED; - else - $this->status_id = Payment::STATUS_PARTIALLY_REFUNDED; + $credit_note = $this->buildCreditNote($data); - $credit_note = $this->buildCreditNote($data); + $credit_line_item = InvoiceItemFactory::create(); + $credit_line_item->quantity = 1; + $credit_line_item->cost = $data['amount']; + $credit_line_item->product_key = ctrans('texts.credit'); + $credit_line_item->notes = ctrans('texts.credit_created_by', ['transaction_reference' => $this->number]); + $credit_line_item->line_total = $data['amount']; + $credit_line_item->date = $data['date']; - $credit_line_item = InvoiceItemFactory::create(); - $credit_line_item->quantity = 1; - $credit_line_item->cost = $data['amount']; - $credit_line_item->product_key = ctrans('texts.credit'); - $credit_line_item->notes = ctrans('texts.credit_created_by', ['transaction_reference' => $this->number]); - $credit_line_item->line_total = $data['amount']; - $credit_line_item->date = $data['date']; + $line_items = []; + $line_items[] = $credit_line_item; - $line_items = []; - $line_items[] = $credit_line_item; + $credit_note->save(); + $credit_note->number = $this->client->getNextCreditNumber($this->client); + $credit_note->save(); + + $this->createActivity($data, $credit_note->id); - $credit_note->save(); - $credit_note->number = $this->client->getNextCreditNumber($this->client); - $credit_note->save(); - - $this->createActivity($data, $credit_note->id); + //determine if we need to refund via gateway + if ($data['gateway_refund'] !== false) { + //todo process gateway refund, on success, reduce the credit note balance to 0 + } - //determine if we need to refund via gateway - if($data['gateway_refund'] !== false) - { - //todo process gateway refund, on success, reduce the credit note balance to 0 - } + $this->save(); - $this->save(); + //$this->client->paid_to_date -= $data['amount']; + $this->client->save(); - //$this->client->paid_to_date -= $data['amount']; - $this->client->save(); - - return $this->fresh(); - } + return $this->fresh(); + } - private function refundPaymentWithInvoices($data) - { + private function refundPaymentWithInvoices($data) + { + $total_refund = 0; - $total_refund = 0; + foreach ($data['invoices'] as $invoice) { + $total_refund += $invoice['amount']; + } - foreach($data['invoices'] as $invoice) - $total_refund += $invoice['amount']; + $data['amount'] = $total_refund; - $data['amount'] = $total_refund; + /* Set Payment Status*/ + if ($total_refund == $this->amount) { + $this->status_id = Payment::STATUS_REFUNDED; + } else { + $this->status_id = Payment::STATUS_PARTIALLY_REFUNDED; + } - /* Set Payment Status*/ - if($total_refund == $this->amount) - $this->status_id = Payment::STATUS_REFUNDED; - else - $this->status_id = Payment::STATUS_PARTIALLY_REFUNDED; + /* Build Credit Note*/ + $credit_note = $this->buildCreditNote($data); - /* Build Credit Note*/ - $credit_note = $this->buildCreditNote($data); + $line_items = []; - $line_items = []; + foreach ($data['invoices'] as $invoice) { + $inv = Invoice::find($invoice['invoice_id']); - foreach($data['invoices'] as $invoice) - { - $inv = Invoice::find($invoice['invoice_id']); + $credit_line_item = InvoiceItemFactory::create(); + $credit_line_item->quantity = 1; + $credit_line_item->cost = $invoice['amount']; + $credit_line_item->product_key = ctrans('texts.invoice'); + $credit_line_item->notes = ctrans('texts.refund_body', ['amount' => $data['amount'], 'invoice_number' => $inv->number]); + $credit_line_item->line_total = $invoice['amount']; + $credit_line_item->date = $data['date']; - $credit_line_item = InvoiceItemFactory::create(); - $credit_line_item->quantity = 1; - $credit_line_item->cost = $invoice['amount']; - $credit_line_item->product_key = ctrans('texts.invoice'); - $credit_line_item->notes = ctrans('texts.refund_body', ['amount' => $data['amount'], 'invoice_number' => $inv->number]); - $credit_line_item->line_total = $invoice['amount']; - $credit_line_item->date = $data['date']; - - $line_items[] = $credit_line_item; - } - - /* Update paymentable record */ - foreach($this->invoices as $paymentable_invoice) - { - - foreach($data['invoices'] as $refunded_invoice) - { - - if($refunded_invoice['invoice_id'] == $paymentable_invoice->id) - { - $paymentable_invoice->pivot->refunded += $refunded_invoice['amount']; - $paymentable_invoice->pivot->save(); - } - - } + $line_items[] = $credit_line_item; + } + /* Update paymentable record */ + foreach ($this->invoices as $paymentable_invoice) { + foreach ($data['invoices'] as $refunded_invoice) { + if ($refunded_invoice['invoice_id'] == $paymentable_invoice->id) { + $paymentable_invoice->pivot->refunded += $refunded_invoice['amount']; + $paymentable_invoice->pivot->save(); + } } + } - if($this->credits()->exists()) - { - //Adjust credits first!!! - foreach($this->credits as $paymentable_credit) - { - $available_credit = $paymentable_credit->pivot->amount - $paymentable_credit->pivot->refunded; + if ($this->credits()->exists()) { + //Adjust credits first!!! + foreach ($this->credits as $paymentable_credit) { + $available_credit = $paymentable_credit->pivot->amount - $paymentable_credit->pivot->refunded; - if($available_credit > $total_refund){ - $paymentable_credit->pivot->refunded += $total_refund; - $paymentable_credit->pivot->save(); + if ($available_credit > $total_refund) { + $paymentable_credit->pivot->refunded += $total_refund; + $paymentable_credit->pivot->save(); - $paymentable_credit->balance += $total_refund; - $paymentable_credit->save(); + $paymentable_credit->balance += $total_refund; + $paymentable_credit->save(); - $total_refund = 0; + $total_refund = 0; + } else { + $paymentable_credit->pivot->refunded += $available_credit; + $paymentable_credit->pivot->save(); - } - else { - $paymentable_credit->pivot->refunded += $available_credit; - $paymentable_credit->pivot->save(); + $paymentable_credit->balance += $available_credit; + $paymentable_credit->save(); - $paymentable_credit->balance += $available_credit; - $paymentable_credit->save(); - - $total_refund -= $available_credit; - } - - if($total_refund == 0) - break; - } + $total_refund -= $available_credit; + } + if ($total_refund == 0) { + break; + } } + } - $credit_note->line_items = $line_items; - $credit_note->save(); + $credit_note->line_items = $line_items; + $credit_note->save(); - $credit_note->number = $this->client->getNextCreditNumber($this->client); - $credit_note->save(); + $credit_note->number = $this->client->getNextCreditNumber($this->client); + $credit_note->save(); - //determine if we need to refund via gateway - if($data['gateway_refund'] !== false) - { - //todo process gateway refund, on success, reduce the credit note balance to 0 - } + //determine if we need to refund via gateway + if ($data['gateway_refund'] !== false) { + //todo process gateway refund, on success, reduce the credit note balance to 0 + } - if($total_refund > 0) - $this->refunded += $total_refund; + if ($total_refund > 0) { + $this->refunded += $total_refund; + } - $this->save(); + $this->save(); - $this->adjustInvoices($data); + $this->adjustInvoices($data); - $this->client->paid_to_date -= $data['amount']; - $this->client->save(); + $this->client->paid_to_date -= $data['amount']; + $this->client->save(); - return $this; - } - - private function createActivity(array $data, int $credit_id) - { + return $this; + } + private function createActivity(array $data, int $credit_id) + { $fields = new \stdClass; $activity_repo = new ActivityRepository(); @@ -203,57 +191,52 @@ trait Refundable $fields->activity_type_id = Activity::REFUNDED_PAYMENT; $fields->credit_id = $credit_id; - if(isset($data['invoices'])) - { - foreach ($data['invoices'] as $invoice) - { - $fields->invoice_id = $invoice->id; - - $activity_repo->save($fields, $this); - - } + if (isset($data['invoices'])) { + foreach ($data['invoices'] as $invoice) { + $fields->invoice_id = $invoice->id; + + $activity_repo->save($fields, $this); + } + } else { + $activity_repo->save($fields, $this); } - else - $activity_repo->save($fields, $this); - - } + } - private function buildCreditNote(array $data) :?Credit - { - $credit_note = CreditFactory::create($this->company_id, $this->user_id); - $credit_note->assigned_user_id = isset($this->assigned_user_id) ?: null; - $credit_note->date = $data['date']; - $credit_note->status_id = Credit::STATUS_SENT; - $credit_note->client_id = $this->client->id; - $credit_note->amount = $data['amount']; - $credit_note->balance = $data['amount']; + private function buildCreditNote(array $data) :?Credit + { + $credit_note = CreditFactory::create($this->company_id, $this->user_id); + $credit_note->assigned_user_id = isset($this->assigned_user_id) ?: null; + $credit_note->date = $data['date']; + $credit_note->status_id = Credit::STATUS_SENT; + $credit_note->client_id = $this->client->id; + $credit_note->amount = $data['amount']; + $credit_note->balance = $data['amount']; - return $credit_note; - } + return $credit_note; + } - private function adjustInvoices(array $data) :void - { - foreach($data['invoices'] as $refunded_invoice) - { - $invoice = Invoice::find($refunded_invoice['invoice_id']); + private function adjustInvoices(array $data) :void + { + foreach ($data['invoices'] as $refunded_invoice) { + $invoice = Invoice::find($refunded_invoice['invoice_id']); - $invoice->service()->updateBalance($refunded_invoice['amount'])->save(); + $invoice->service()->updateBalance($refunded_invoice['amount'])->save(); - if($invoice->amount == $invoice->balance) - $invoice->service()->setStatus(Invoice::STATUS_SENT); - else - $invoice->service()->setStatus(Invoice::STATUS_PARTIAL); + if ($invoice->amount == $invoice->balance) { + $invoice->service()->setStatus(Invoice::STATUS_SENT); + } else { + $invoice->service()->setStatus(Invoice::STATUS_PARTIAL); + } - $client = $invoice->client; + $client = $invoice->client; - $client->balance += $refunded_invoice['amount']; - ///$client->paid_to_date -= $refunded_invoice['amount']; + $client->balance += $refunded_invoice['amount']; + ///$client->paid_to_date -= $refunded_invoice['amount']; - $client->save(); - - //todo adjust ledger balance here? or after and reference the credit and its total + $client->save(); + //todo adjust ledger balance here? or after and reference the credit and its total } - } -} \ No newline at end of file + } +} diff --git a/app/Utils/Traits/Pdf/PdfMaker.php b/app/Utils/Traits/Pdf/PdfMaker.php index 4636cb3c38..f3c80b9297 100644 --- a/app/Utils/Traits/Pdf/PdfMaker.php +++ b/app/Utils/Traits/Pdf/PdfMaker.php @@ -25,22 +25,23 @@ trait PdfMaker * * @return string The PDF string */ - public function makePdf($header, $footer, $html) { + public function makePdf($header, $footer, $html) + { // if($header && $footer){ // $browser = Browsershot::html($html) - // ->headerHtml($header) - // ->footerHtml($footer); + // ->headerHtml($header) + // ->footerHtml($footer); // } // elseif($header){ // $browser = Browsershot::html($html) - // ->headerHtml($header); + // ->headerHtml($header); // } // else if($footer){ // $browser = Browsershot::html($html) - // ->footerHtml($footer); + // ->footerHtml($footer); // } // else { // $browser = Browsershot::html($html); @@ -65,5 +66,4 @@ trait PdfMaker // //->margins(10,10,10,10) // //->savePdf('test.pdf'); } - } diff --git a/app/Utils/Traits/SettingsSaver.php b/app/Utils/Traits/SettingsSaver.php index 5cd31e09df..27a26bf9d3 100644 --- a/app/Utils/Traits/SettingsSaver.php +++ b/app/Utils/Traits/SettingsSaver.php @@ -76,8 +76,7 @@ trait SettingsSaver ksort($casts); foreach ($casts as $key => $value) { - - if(in_array($key, self::$string_casts)){ + if (in_array($key, self::$string_casts)) { $value = "string"; if (!property_exists($settings, $key)) { continue; @@ -97,8 +96,7 @@ trait SettingsSaver } continue; - } - elseif($key == 'pdf_variables') { + } elseif ($key == 'pdf_variables') { continue; } @@ -133,14 +131,14 @@ trait SettingsSaver $settings = (object)$settings; /* Because of the object casting we cannot check pdf_variables */ - if(property_exists($settings, 'pdf_variables')) + if (property_exists($settings, 'pdf_variables')) { unset($settings->pdf_variables); + } $casts = CompanySettings::$casts; foreach ($casts as $key => $value) { - - if (substr($key, -3) == '_id' || substr($key, -14) == 'number_counter') { + if (substr($key, -3) == '_id' || substr($key, -14) == 'number_counter') { $value = "integer"; if (!property_exists($settings, $key)) { diff --git a/config/former.php b/config/former.php index dbdfa666bf..d054ff2b0b 100644 --- a/config/former.php +++ b/config/former.php @@ -1,207 +1,207 @@ true, + // Whether labels should be automatically computed from name + 'automatic_label' => true, - // The default form type - 'default_form_type' => 'horizontal', + // The default form type + 'default_form_type' => 'horizontal', - // Validation - //////////////////////////////////////////////////////////////////// + // Validation + //////////////////////////////////////////////////////////////////// - // Whether Former should fetch errors from Session - 'fetch_errors' => true, + // Whether Former should fetch errors from Session + 'fetch_errors' => true, - // Whether Former should try to apply Validator rules as attributes - 'live_validation' => true, + // Whether Former should try to apply Validator rules as attributes + 'live_validation' => true, - // Whether Former should automatically fetch error messages and - // display them next to the matching fields - 'error_messages' => true, + // Whether Former should automatically fetch error messages and + // display them next to the matching fields + 'error_messages' => true, - // Checkables - //////////////////////////////////////////////////////////////////// + // Checkables + //////////////////////////////////////////////////////////////////// - // Whether checkboxes should always be present in the POST data, - // no matter if you checked them or not - 'push_checkboxes' => false, + // Whether checkboxes should always be present in the POST data, + // no matter if you checked them or not + 'push_checkboxes' => false, - // The value a checkbox will have in the POST array if unchecked - 'unchecked_value' => 0, + // The value a checkbox will have in the POST array if unchecked + 'unchecked_value' => 0, - // Required fields - //////////////////////////////////////////////////////////////////// + // Required fields + //////////////////////////////////////////////////////////////////// - // The class to be added to required fields - 'required_class' => 'required', + // The class to be added to required fields + 'required_class' => 'required', - // A facultative text to append to the labels of required fields - 'required_text' => '*', + // A facultative text to append to the labels of required fields + 'required_text' => '*', - // Translations - //////////////////////////////////////////////////////////////////// + // Translations + //////////////////////////////////////////////////////////////////// - // Where Former should look for translations - 'translate_from' => 'validation.attributes', + // Where Former should look for translations + 'translate_from' => 'validation.attributes', - // Whether text that comes out of the translated - // should be capitalized (ex: email => Email) automatically - 'capitalize_translations' => true, + // Whether text that comes out of the translated + // should be capitalized (ex: email => Email) automatically + 'capitalize_translations' => true, - // An array of attributes to automatically translate - 'translatable' => array( - 'help', - 'inlineHelp', - 'blockHelp', - 'placeholder', - 'data_placeholder', - 'label', - ), + // An array of attributes to automatically translate + 'translatable' => array( + 'help', + 'inlineHelp', + 'blockHelp', + 'placeholder', + 'data_placeholder', + 'label', + ), - // Framework - //////////////////////////////////////////////////////////////////// + // Framework + //////////////////////////////////////////////////////////////////// - // The framework to be used by Former - 'framework' => 'TwitterBootstrap4', + // The framework to be used by Former + 'framework' => 'TwitterBootstrap4', - 'TwitterBootstrap4' => array( + 'TwitterBootstrap4' => array( - // Map Former-supported viewports to Bootstrap 4 equivalents - 'viewports' => array( - 'large' => 'lg', - 'medium' => 'md', - 'small' => 'sm', - 'mini' => 'xs', - ), - // Width of labels for horizontal forms expressed as viewport => grid columns - 'labelWidths' => array( - 'large' => 2, - 'small' => 4, - ), - // HTML markup and classes used by Bootstrap 5 for icons - 'icon' => array( - 'tag' => 'i', - 'set' => 'fa', - 'prefix' => 'fa', - ), + // Map Former-supported viewports to Bootstrap 4 equivalents + 'viewports' => array( + 'large' => 'lg', + 'medium' => 'md', + 'small' => 'sm', + 'mini' => 'xs', + ), + // Width of labels for horizontal forms expressed as viewport => grid columns + 'labelWidths' => array( + 'large' => 2, + 'small' => 4, + ), + // HTML markup and classes used by Bootstrap 5 for icons + 'icon' => array( + 'tag' => 'i', + 'set' => 'fa', + 'prefix' => 'fa', + ), - ), + ), - 'TwitterBootstrap3' => array( + 'TwitterBootstrap3' => array( - // Map Former-supported viewports to Bootstrap 3 equivalents - 'viewports' => array( - 'large' => 'lg', - 'medium' => 'md', - 'small' => 'sm', - 'mini' => 'xs', - ), - // Width of labels for horizontal forms expressed as viewport => grid columns - 'labelWidths' => array( - 'large' => 2, - 'small' => 4, - ), - // HTML markup and classes used by Bootstrap 3 for icons - 'icon' => array( - 'tag' => 'span', - 'set' => 'glyphicon', - 'prefix' => 'glyphicon', - ), + // Map Former-supported viewports to Bootstrap 3 equivalents + 'viewports' => array( + 'large' => 'lg', + 'medium' => 'md', + 'small' => 'sm', + 'mini' => 'xs', + ), + // Width of labels for horizontal forms expressed as viewport => grid columns + 'labelWidths' => array( + 'large' => 2, + 'small' => 4, + ), + // HTML markup and classes used by Bootstrap 3 for icons + 'icon' => array( + 'tag' => 'span', + 'set' => 'glyphicon', + 'prefix' => 'glyphicon', + ), - ), + ), - 'Nude' => array( // No-framework markup - 'icon' => array( - 'tag' => 'i', - 'set' => null, - 'prefix' => 'icon', - ), - ), + 'Nude' => array( // No-framework markup + 'icon' => array( + 'tag' => 'i', + 'set' => null, + 'prefix' => 'icon', + ), + ), - 'TwitterBootstrap' => array( // Twitter Bootstrap version 2 - 'icon' => array( - 'tag' => 'i', - 'set' => null, - 'prefix' => 'icon', - ), - ), + 'TwitterBootstrap' => array( // Twitter Bootstrap version 2 + 'icon' => array( + 'tag' => 'i', + 'set' => null, + 'prefix' => 'icon', + ), + ), - 'ZurbFoundation5' => array( - // Map Former-supported viewports to Foundation 5 equivalents - 'viewports' => array( - 'large' => 'large', - 'medium' => null, - 'small' => 'small', - 'mini' => null, - ), - // Width of labels for horizontal forms expressed as viewport => grid columns - 'labelWidths' => array( - 'small' => 3, - ), - // Classes to be applied to wrapped labels in horizontal forms - 'wrappedLabelClasses' => array('right', 'inline'), - // HTML markup and classes used by Foundation 5 for icons - 'icon' => array( - 'tag' => 'i', - 'set' => null, - 'prefix' => 'fi', - ), - // CSS for inline validation errors - 'error_classes' => array('class' => 'error'), - ), + 'ZurbFoundation5' => array( + // Map Former-supported viewports to Foundation 5 equivalents + 'viewports' => array( + 'large' => 'large', + 'medium' => null, + 'small' => 'small', + 'mini' => null, + ), + // Width of labels for horizontal forms expressed as viewport => grid columns + 'labelWidths' => array( + 'small' => 3, + ), + // Classes to be applied to wrapped labels in horizontal forms + 'wrappedLabelClasses' => array('right', 'inline'), + // HTML markup and classes used by Foundation 5 for icons + 'icon' => array( + 'tag' => 'i', + 'set' => null, + 'prefix' => 'fi', + ), + // CSS for inline validation errors + 'error_classes' => array('class' => 'error'), + ), - 'ZurbFoundation4' => array( - // Foundation 4 also has an experimental "medium" breakpoint - // explained at http://foundation.zurb.com/docs/components/grid.html - 'viewports' => array( - 'large' => 'large', - 'medium' => null, - 'small' => 'small', - 'mini' => null, - ), - // Width of labels for horizontal forms expressed as viewport => grid columns - 'labelWidths' => array( - 'small' => 3, - ), - // Classes to be applied to wrapped labels in horizontal forms - 'wrappedLabelClasses' => array('right', 'inline'), - // HTML markup and classes used by Foundation 4 for icons - 'icon' => array( - 'tag' => 'i', - 'set' => 'general', - 'prefix' => 'foundicon', - ), - // CSS for inline validation errors - 'error_classes' => array('class' => 'alert-box radius warning'), - ), + 'ZurbFoundation4' => array( + // Foundation 4 also has an experimental "medium" breakpoint + // explained at http://foundation.zurb.com/docs/components/grid.html + 'viewports' => array( + 'large' => 'large', + 'medium' => null, + 'small' => 'small', + 'mini' => null, + ), + // Width of labels for horizontal forms expressed as viewport => grid columns + 'labelWidths' => array( + 'small' => 3, + ), + // Classes to be applied to wrapped labels in horizontal forms + 'wrappedLabelClasses' => array('right', 'inline'), + // HTML markup and classes used by Foundation 4 for icons + 'icon' => array( + 'tag' => 'i', + 'set' => 'general', + 'prefix' => 'foundicon', + ), + // CSS for inline validation errors + 'error_classes' => array('class' => 'alert-box radius warning'), + ), - 'ZurbFoundation' => array( // Foundation 3 - 'viewports' => array( - 'large' => '', - 'medium' => null, - 'small' => 'mobile-', - 'mini' => null, - ), - // Width of labels for horizontal forms expressed as viewport => grid columns - 'labelWidths' => array( - 'large' => 2, - 'small' => 4, - ), - // Classes to be applied to wrapped labels in horizontal forms - 'wrappedLabelClasses' => array('right', 'inline'), - // HTML markup and classes used by Foundation 3 for icons - 'icon' => array( - 'tag' => 'i', - 'set' => null, - 'prefix' => 'fi', - ), - // CSS for inline validation errors - // should work for Zurb 2 and 3 - 'error_classes' => array('class' => 'alert-box alert error'), - ), + 'ZurbFoundation' => array( // Foundation 3 + 'viewports' => array( + 'large' => '', + 'medium' => null, + 'small' => 'mobile-', + 'mini' => null, + ), + // Width of labels for horizontal forms expressed as viewport => grid columns + 'labelWidths' => array( + 'large' => 2, + 'small' => 4, + ), + // Classes to be applied to wrapped labels in horizontal forms + 'wrappedLabelClasses' => array('right', 'inline'), + // HTML markup and classes used by Foundation 3 for icons + 'icon' => array( + 'tag' => 'i', + 'set' => null, + 'prefix' => 'fi', + ), + // CSS for inline validation errors + // should work for Zurb 2 and 3 + 'error_classes' => array('class' => 'alert-box alert error'), + ), ); diff --git a/config/ninja.php b/config/ninja.php index ef85b5d68b..8c5b55de6d 100644 --- a/config/ninja.php +++ b/config/ninja.php @@ -54,7 +54,7 @@ return [ 'map_zoom' => env('DEFAULT_MAP_ZOOM', 10), 'payment_terms' => env('DEFAULT_PAYMENT_TERMS', -1), 'military_time' => env('MILITARY_TIME', 0), - 'first_day_of_week' => env('FIRST_DATE_OF_WEEK',0), + 'first_day_of_week' => env('FIRST_DATE_OF_WEEK', 0), 'first_month_of_year' => env('FIRST_MONTH_OF_YEAR', '2000-01-01') ], @@ -62,10 +62,10 @@ return [ 'username' => 'user@example.com', 'clientname' => 'client@example.com', 'password' => 'password', - 'stripe' => env('STRIPE_KEYS',''), + 'stripe' => env('STRIPE_KEYS', ''), 'paypal' => env('PAYPAL_KEYS', ''), 'travis' => env('TRAVIS', false), - 'test_email' => env('TEST_EMAIL','test@example.com'), + 'test_email' => env('TEST_EMAIL', 'test@example.com'), ], 'contact' => [ 'email' => env('MAIL_FROM_ADDRESS'), @@ -91,8 +91,8 @@ return [ //'fonts' => 'App\Models\Font', ], 'notification' => [ - 'slack' => env('SLACK_WEBHOOK_URL',''), - 'mail' => env('HOSTED_EMAIL',''), + 'slack' => env('SLACK_WEBHOOK_URL', ''), + 'mail' => env('HOSTED_EMAIL', ''), ], 'payment_terms' => [ [ diff --git a/config/self-update.php b/config/self-update.php index e1b6c07283..fcbcbb15d4 100644 --- a/config/self-update.php +++ b/config/self-update.php @@ -2,129 +2,129 @@ return [ - /* - |-------------------------------------------------------------------------- - | Default source repository type - |-------------------------------------------------------------------------- - | - | The default source repository type you want to pull your updates from. - | - */ + /* + |-------------------------------------------------------------------------- + | Default source repository type + |-------------------------------------------------------------------------- + | + | The default source repository type you want to pull your updates from. + | + */ - 'default' => env('SELF_UPDATER_SOURCE', 'github'), + 'default' => env('SELF_UPDATER_SOURCE', 'github'), - /* - |-------------------------------------------------------------------------- - | Version installed - |-------------------------------------------------------------------------- - | - | Set this to the version of your software installed on your system. - | - */ + /* + |-------------------------------------------------------------------------- + | Version installed + |-------------------------------------------------------------------------- + | + | Set this to the version of your software installed on your system. + | + */ - 'version_installed' => env('SELF_UPDATER_VERSION_INSTALLED', ''), + 'version_installed' => env('SELF_UPDATER_VERSION_INSTALLED', ''), - /* - |-------------------------------------------------------------------------- - | Repository types - |-------------------------------------------------------------------------- - | - | A repository can be of different types, which can be specified here. - | Current options: - | - github - | - http - | - */ + /* + |-------------------------------------------------------------------------- + | Repository types + |-------------------------------------------------------------------------- + | + | A repository can be of different types, which can be specified here. + | Current options: + | - github + | - http + | + */ - 'repository_types' => [ - 'github' => [ - 'type' => 'github', - 'repository_vendor' => env('SELF_UPDATER_REPO_VENDOR', ''), - 'repository_name' => env('SELF_UPDATER_REPO_NAME', ''), - 'repository_url' => '', - 'download_path' => env('SELF_UPDATER_DOWNLOAD_PATH', '/tmp'), - 'private_access_token' => env('SELF_UPDATER_GITHUB_PRIVATE_ACCESS_TOKEN', ''), - 'use_branch' => env('SELF_UPDATER_BRANCH_NAME', 'v2'), + 'repository_types' => [ + 'github' => [ + 'type' => 'github', + 'repository_vendor' => env('SELF_UPDATER_REPO_VENDOR', ''), + 'repository_name' => env('SELF_UPDATER_REPO_NAME', ''), + 'repository_url' => '', + 'download_path' => env('SELF_UPDATER_DOWNLOAD_PATH', '/tmp'), + 'private_access_token' => env('SELF_UPDATER_GITHUB_PRIVATE_ACCESS_TOKEN', ''), + 'use_branch' => env('SELF_UPDATER_BRANCH_NAME', 'v2'), - ], - 'http' => [ - 'type' => 'http', - 'repository_url' => env('SELF_UPDATER_REPO_URL', ''), - 'pkg_filename_format' => env('SELF_UPDATER_PKG_FILENAME_FORMAT', 'v_VERSION_'), - 'download_path' => env('SELF_UPDATER_DOWNLOAD_PATH', '/tmp'), - 'private_access_token' => env('SELF_UPDATER_HTTP_PRIVATE_ACCESS_TOKEN', ''), - ], - ], + ], + 'http' => [ + 'type' => 'http', + 'repository_url' => env('SELF_UPDATER_REPO_URL', ''), + 'pkg_filename_format' => env('SELF_UPDATER_PKG_FILENAME_FORMAT', 'v_VERSION_'), + 'download_path' => env('SELF_UPDATER_DOWNLOAD_PATH', '/tmp'), + 'private_access_token' => env('SELF_UPDATER_HTTP_PRIVATE_ACCESS_TOKEN', ''), + ], + ], - /* - |-------------------------------------------------------------------------- - | Exclude folders from update - |-------------------------------------------------------------------------- - | - | Specifiy folders which should not be updated and will be skipped during the - | update process. - | - | Here's already a list of good examples to skip. You may want to keep those. - | - */ + /* + |-------------------------------------------------------------------------- + | Exclude folders from update + |-------------------------------------------------------------------------- + | + | Specifiy folders which should not be updated and will be skipped during the + | update process. + | + | Here's already a list of good examples to skip. You may want to keep those. + | + */ - 'exclude_folders' => [ - 'node_modules', - 'bootstrap/cache', - 'bower', - 'storage/app', - 'storage/framework', - 'storage/logs', - 'storage/self-update', - 'vendor', - ], + 'exclude_folders' => [ + 'node_modules', + 'bootstrap/cache', + 'bower', + 'storage/app', + 'storage/framework', + 'storage/logs', + 'storage/self-update', + 'vendor', + ], - /* - |-------------------------------------------------------------------------- - | Event Logging - |-------------------------------------------------------------------------- - | - | Configure if fired events should be logged - | - */ + /* + |-------------------------------------------------------------------------- + | Event Logging + |-------------------------------------------------------------------------- + | + | Configure if fired events should be logged + | + */ - 'log_events' => env('SELF_UPDATER_LOG_EVENTS', false), + 'log_events' => env('SELF_UPDATER_LOG_EVENTS', false), - /* - |-------------------------------------------------------------------------- - | Mail To Settings - |-------------------------------------------------------------------------- - | - | Configure if fired events should be logged - | - */ + /* + |-------------------------------------------------------------------------- + | Mail To Settings + |-------------------------------------------------------------------------- + | + | Configure if fired events should be logged + | + */ - 'mail_to' => [ - 'address' => env('SELF_UPDATER_MAILTO_ADDRESS', ''), - 'name' => env('SELF_UPDATER_MAILTO_NAME', ''), - 'subject_update_available' => env('SELF_UPDATER_MAILTO_UPDATE_AVAILABLE_SUBJECT', 'Update available'), - 'subject_update_succeeded' => env('SELF_UPDATER_MAILTO_UPDATE_SUCCEEDED_SUBJECT', 'Update succeeded'), - ], + 'mail_to' => [ + 'address' => env('SELF_UPDATER_MAILTO_ADDRESS', ''), + 'name' => env('SELF_UPDATER_MAILTO_NAME', ''), + 'subject_update_available' => env('SELF_UPDATER_MAILTO_UPDATE_AVAILABLE_SUBJECT', 'Update available'), + 'subject_update_succeeded' => env('SELF_UPDATER_MAILTO_UPDATE_SUCCEEDED_SUBJECT', 'Update succeeded'), + ], - /* - |--------------------------------------------------------------------------- - | Register custom artisan commands - |--------------------------------------------------------------------------- - */ + /* + |--------------------------------------------------------------------------- + | Register custom artisan commands + |--------------------------------------------------------------------------- + */ - 'artisan_commands' => [ - 'pre_update' => [ - //'command:signature' => [ - // 'class' => Command class - // 'params' => [] - //] - ], - 'post_update' => [ - 'ninja:post-update' => [ - 'class' => \App\Console\Commands\ArtisanUpgrade::class, - 'params' => [], - ], - ], - ], + 'artisan_commands' => [ + 'pre_update' => [ + //'command:signature' => [ + // 'class' => Command class + // 'params' => [] + //] + ], + 'post_update' => [ + 'ninja:post-update' => [ + 'class' => \App\Console\Commands\ArtisanUpgrade::class, + 'params' => [], + ], + ], + ], ]; diff --git a/config/services.php b/config/services.php index 06204558c3..5179186288 100644 --- a/config/services.php +++ b/config/services.php @@ -81,4 +81,4 @@ return [ 'client_secret' => env('BITBUCKET_CLIENT_SECRET'), 'redirect' => env('BITBUCKET_OAUTH_REDIRECT'), ], -]; \ No newline at end of file +]; diff --git a/database/factories/ClientContactFactory.php b/database/factories/ClientContactFactory.php index 23be366c43..1f0b6dea58 100644 --- a/database/factories/ClientContactFactory.php +++ b/database/factories/ClientContactFactory.php @@ -24,5 +24,4 @@ $factory->define(App\Models\ClientContact::class, function (Faker $faker) { 'remember_token' => \Illuminate\Support\Str::random(10), 'contact_key' => \Illuminate\Support\Str::random(40), ]; - }); diff --git a/database/factories/CreditFactory.php b/database/factories/CreditFactory.php index 79f1766d45..57534089fb 100644 --- a/database/factories/CreditFactory.php +++ b/database/factories/CreditFactory.php @@ -7,25 +7,25 @@ use Faker\Generator as Faker; $factory->define(App\Models\Credit::class, function (Faker $faker) { return [ - 'status_id' => App\Models\Credit::STATUS_DRAFT, - 'number' => $faker->ean13(), - 'discount' => $faker->numberBetween(1,10), - 'is_amount_discount' => (bool)random_int(0,1), - 'tax_name1' => 'GST', - 'tax_rate1' => 10, - 'tax_name2' => 'VAT', - 'tax_rate2' => 17.5, - //'tax_name3' => 'THIRDTAX', - //'tax_rate3' => 5, - // 'custom_value1' => $faker->numberBetween(1,4), - // 'custom_value2' => $faker->numberBetween(1,4), - // 'custom_value3' => $faker->numberBetween(1,4), - // 'custom_value4' => $faker->numberBetween(1,4), - 'is_deleted' => false, - 'po_number' => $faker->text(10), - 'date' => $faker->date(), - 'due_date' => $faker->date(), - 'line_items' => InvoiceItemFactory::generateCredit(5), - 'terms' => $faker->text(500), + 'status_id' => App\Models\Credit::STATUS_DRAFT, + 'number' => $faker->ean13(), + 'discount' => $faker->numberBetween(1, 10), + 'is_amount_discount' => (bool)random_int(0, 1), + 'tax_name1' => 'GST', + 'tax_rate1' => 10, + 'tax_name2' => 'VAT', + 'tax_rate2' => 17.5, + //'tax_name3' => 'THIRDTAX', + //'tax_rate3' => 5, + // 'custom_value1' => $faker->numberBetween(1,4), + // 'custom_value2' => $faker->numberBetween(1,4), + // 'custom_value3' => $faker->numberBetween(1,4), + // 'custom_value4' => $faker->numberBetween(1,4), + 'is_deleted' => false, + 'po_number' => $faker->text(10), + 'date' => $faker->date(), + 'due_date' => $faker->date(), + 'line_items' => InvoiceItemFactory::generateCredit(5), + 'terms' => $faker->text(500), ]; -}); \ No newline at end of file +}); diff --git a/database/factories/ExpenseFactory.php b/database/factories/ExpenseFactory.php index 19cc77ccc8..31ad21ab0f 100644 --- a/database/factories/ExpenseFactory.php +++ b/database/factories/ExpenseFactory.php @@ -7,16 +7,16 @@ use Faker\Generator as Faker; $factory->define(App\Models\Expense::class, function (Faker $faker) { return [ - 'amount' => $faker->numberBetween(1,10), - 'custom_value1' => $faker->text(10), - 'custom_value2' => $faker->text(10), - 'custom_value3' => $faker->text(10), - 'custom_value4' => $faker->text(10), - 'exchange_rate' => $faker->randomFloat(2,0,1), - 'expense_date' => $faker->date(), - 'is_deleted' => false, - 'public_notes' => $faker->text(50), - 'private_notes' => $faker->text(50), - 'transaction_reference' => $faker->text(5), + 'amount' => $faker->numberBetween(1, 10), + 'custom_value1' => $faker->text(10), + 'custom_value2' => $faker->text(10), + 'custom_value3' => $faker->text(10), + 'custom_value4' => $faker->text(10), + 'exchange_rate' => $faker->randomFloat(2, 0, 1), + 'expense_date' => $faker->date(), + 'is_deleted' => false, + 'public_notes' => $faker->text(50), + 'private_notes' => $faker->text(50), + 'transaction_reference' => $faker->text(5), ]; -}); \ No newline at end of file +}); diff --git a/database/factories/InvoiceFactory.php b/database/factories/InvoiceFactory.php index a1e9b1c02f..31b5199b9b 100644 --- a/database/factories/InvoiceFactory.php +++ b/database/factories/InvoiceFactory.php @@ -7,25 +7,25 @@ use Faker\Generator as Faker; $factory->define(App\Models\Invoice::class, function (Faker $faker) { return [ - 'status_id' => App\Models\Invoice::STATUS_SENT, - 'number' => $faker->ean13(), - 'discount' => $faker->numberBetween(1,10), - 'is_amount_discount' => (bool)random_int(0,1), - 'tax_name1' => 'GST', - 'tax_rate1' => 10, - 'tax_name2' => 'VAT', - 'tax_rate2' => 17.5, - //'tax_name3' => 'THIRDTAX', - //'tax_rate3' => 5, - // 'custom_value1' => $faker->numberBetween(1,4), - // 'custom_value2' => $faker->numberBetween(1,4), - // 'custom_value3' => $faker->numberBetween(1,4), - // 'custom_value4' => $faker->numberBetween(1,4), - 'is_deleted' => false, - 'po_number' => $faker->text(10), - 'date' => $faker->date(), - 'due_date' => $faker->date(), - 'line_items' => InvoiceItemFactory::generate(5), - 'terms' => $faker->text(500), + 'status_id' => App\Models\Invoice::STATUS_SENT, + 'number' => $faker->ean13(), + 'discount' => $faker->numberBetween(1, 10), + 'is_amount_discount' => (bool)random_int(0, 1), + 'tax_name1' => 'GST', + 'tax_rate1' => 10, + 'tax_name2' => 'VAT', + 'tax_rate2' => 17.5, + //'tax_name3' => 'THIRDTAX', + //'tax_rate3' => 5, + // 'custom_value1' => $faker->numberBetween(1,4), + // 'custom_value2' => $faker->numberBetween(1,4), + // 'custom_value3' => $faker->numberBetween(1,4), + // 'custom_value4' => $faker->numberBetween(1,4), + 'is_deleted' => false, + 'po_number' => $faker->text(10), + 'date' => $faker->date(), + 'due_date' => $faker->date(), + 'line_items' => InvoiceItemFactory::generate(5), + 'terms' => $faker->text(500), ]; -}); \ No newline at end of file +}); diff --git a/database/factories/PaymentFactory.php b/database/factories/PaymentFactory.php index a37b872c3b..f5721965f3 100644 --- a/database/factories/PaymentFactory.php +++ b/database/factories/PaymentFactory.php @@ -6,16 +6,12 @@ use App\Models\Payment; use Faker\Generator as Faker; $factory->define(App\Models\Payment::class, function (Faker $faker) { - return [ - 'is_deleted' => false, - 'amount' => $faker->numberBetween(1,10), - 'date' => $faker->date(), - 'transaction_reference' => $faker->text(10), - 'type_id' => Payment::TYPE_CREDIT_CARD, - 'status_id' => Payment::STATUS_COMPLETED + 'is_deleted' => false, + 'amount' => $faker->numberBetween(1, 10), + 'date' => $faker->date(), + 'transaction_reference' => $faker->text(10), + 'type_id' => Payment::TYPE_CREDIT_CARD, + 'status_id' => Payment::STATUS_COMPLETED ]; - }); - - \ No newline at end of file diff --git a/database/factories/ProductFactory.php b/database/factories/ProductFactory.php index fdedf25929..342cbe52a6 100644 --- a/database/factories/ProductFactory.php +++ b/database/factories/ProductFactory.php @@ -6,9 +6,9 @@ $factory->define(App\Models\Product::class, function (Faker $faker) { return [ 'product_key' => $faker->text(7), 'notes' => $faker->text(20), - 'cost' => $faker->numberBetween(1,1000), - 'price' => $faker->numberBetween(1,1000), - 'quantity' => $faker->numberBetween(1,100), + 'cost' => $faker->numberBetween(1, 1000), + 'price' => $faker->numberBetween(1, 1000), + 'quantity' => $faker->numberBetween(1, 100), 'tax_name1' => 'GST', 'tax_rate1' => 10, 'tax_name2' => 'VAT', diff --git a/database/factories/QuoteFactory.php b/database/factories/QuoteFactory.php index 78237cd91e..04f7910414 100644 --- a/database/factories/QuoteFactory.php +++ b/database/factories/QuoteFactory.php @@ -6,24 +6,24 @@ use Faker\Generator as Faker; $factory->define(App\Models\Quote::class, function (Faker $faker) { return [ - 'status_id' => App\Models\Quote::STATUS_DRAFT, - 'number' => '', - 'discount' => $faker->numberBetween(1,10), - 'is_amount_discount' => $faker->boolean(), - 'tax_name1' => 'GST', - 'tax_rate1' => 10, - 'tax_name2' => 'VAT', - 'tax_rate2' => 17.5, - 'tax_name3' => 'THIRDTAX', - 'tax_rate3' => 5, - 'custom_value1' => $faker->numberBetween(1,4), - 'custom_value2' => $faker->numberBetween(1,4), - 'custom_value3' => $faker->numberBetween(1,4), - 'custom_value4' => $faker->numberBetween(1,4), - 'is_deleted' => false, - 'po_number' => $faker->text(10), - 'date' => $faker->date(), - 'due_date' => $faker->date(), - 'line_items' => false, + 'status_id' => App\Models\Quote::STATUS_DRAFT, + 'number' => '', + 'discount' => $faker->numberBetween(1, 10), + 'is_amount_discount' => $faker->boolean(), + 'tax_name1' => 'GST', + 'tax_rate1' => 10, + 'tax_name2' => 'VAT', + 'tax_rate2' => 17.5, + 'tax_name3' => 'THIRDTAX', + 'tax_rate3' => 5, + 'custom_value1' => $faker->numberBetween(1, 4), + 'custom_value2' => $faker->numberBetween(1, 4), + 'custom_value3' => $faker->numberBetween(1, 4), + 'custom_value4' => $faker->numberBetween(1, 4), + 'is_deleted' => false, + 'po_number' => $faker->text(10), + 'date' => $faker->date(), + 'due_date' => $faker->date(), + 'line_items' => false, ]; -}); \ No newline at end of file +}); diff --git a/database/factories/RecurringInvoiceFactory.php b/database/factories/RecurringInvoiceFactory.php index 45760c757b..89635014cc 100644 --- a/database/factories/RecurringInvoiceFactory.php +++ b/database/factories/RecurringInvoiceFactory.php @@ -6,30 +6,30 @@ use Faker\Generator as Faker; $factory->define(App\Models\RecurringInvoice::class, function (Faker $faker) { return [ - 'status_id' => App\Models\RecurringInvoice::STATUS_ACTIVE, - 'discount' => $faker->numberBetween(1,10), - 'is_amount_discount' => $faker->boolean(), - 'tax_name1' => 'GST', - 'tax_rate1' => 10, - 'tax_name2' => 'VAT', - 'tax_rate2' => 17.5, - 'tax_name3' => 'THIRDTAX', - 'tax_rate3' => 5, - 'custom_value1' => $faker->numberBetween(1,4), - 'custom_value2' => $faker->numberBetween(1,4), - 'custom_value3' => $faker->numberBetween(1,4), - 'custom_value4' => $faker->numberBetween(1,4), - 'is_deleted' => false, - 'po_number' => $faker->text(10), - 'date' => $faker->date(), - 'due_date' => $faker->date(), - 'line_items' => false, - 'frequency_id' => App\Models\RecurringInvoice::FREQUENCY_MONTHLY, - 'start_date' => $faker->date(), - 'last_sent_date' => $faker->date(), - 'next_send_date' => $faker->date(), - 'remaining_cycles' => $faker->numberBetween(1,10), - 'amount' => $faker->randomFloat(2, $min = 1, $max = 1000) // 48.8932 + 'status_id' => App\Models\RecurringInvoice::STATUS_ACTIVE, + 'discount' => $faker->numberBetween(1, 10), + 'is_amount_discount' => $faker->boolean(), + 'tax_name1' => 'GST', + 'tax_rate1' => 10, + 'tax_name2' => 'VAT', + 'tax_rate2' => 17.5, + 'tax_name3' => 'THIRDTAX', + 'tax_rate3' => 5, + 'custom_value1' => $faker->numberBetween(1, 4), + 'custom_value2' => $faker->numberBetween(1, 4), + 'custom_value3' => $faker->numberBetween(1, 4), + 'custom_value4' => $faker->numberBetween(1, 4), + 'is_deleted' => false, + 'po_number' => $faker->text(10), + 'date' => $faker->date(), + 'due_date' => $faker->date(), + 'line_items' => false, + 'frequency_id' => App\Models\RecurringInvoice::FREQUENCY_MONTHLY, + 'start_date' => $faker->date(), + 'last_sent_date' => $faker->date(), + 'next_send_date' => $faker->date(), + 'remaining_cycles' => $faker->numberBetween(1, 10), + 'amount' => $faker->randomFloat(2, $min = 1, $max = 1000) // 48.8932 ]; -}); \ No newline at end of file +}); diff --git a/database/factories/RecurringQuoteFactory.php b/database/factories/RecurringQuoteFactory.php index 50dbeef7af..8bbcdd91ae 100644 --- a/database/factories/RecurringQuoteFactory.php +++ b/database/factories/RecurringQuoteFactory.php @@ -6,29 +6,29 @@ use Faker\Generator as Faker; $factory->define(App\Models\RecurringQuote::class, function (Faker $faker) { return [ - 'status_id' => App\Models\RecurringQuote::STATUS_DRAFT, - 'number' => $faker->text(256), - 'discount' => $faker->numberBetween(1,10), - 'is_amount_discount' => $faker->boolean(), - 'tax_name1' => 'GST', - 'tax_rate1' => 10, - 'tax_name2' => 'VAT', - 'tax_rate2' => 17.5, - 'tax_name3' => 'THIRDTAX', - 'tax_rate3' => 5, - 'custom_value1' => $faker->numberBetween(1,4), - 'custom_value2' => $faker->numberBetween(1,4), - 'custom_value3' => $faker->numberBetween(1,4), - 'custom_value4' => $faker->numberBetween(1,4), - 'is_deleted' => false, - 'po_number' => $faker->text(10), - 'date' => $faker->date(), - 'due_date' => $faker->date(), - 'line_items' => false, - 'frequency_id' => App\Models\RecurringQuote::FREQUENCY_MONTHLY, - 'start_date' => $faker->date(), - 'last_sent_date' => $faker->date(), - 'next_send_date' => $faker->date(), - 'remaining_cycles' => $faker->numberBetween(1,10), + 'status_id' => App\Models\RecurringQuote::STATUS_DRAFT, + 'number' => $faker->text(256), + 'discount' => $faker->numberBetween(1, 10), + 'is_amount_discount' => $faker->boolean(), + 'tax_name1' => 'GST', + 'tax_rate1' => 10, + 'tax_name2' => 'VAT', + 'tax_rate2' => 17.5, + 'tax_name3' => 'THIRDTAX', + 'tax_rate3' => 5, + 'custom_value1' => $faker->numberBetween(1, 4), + 'custom_value2' => $faker->numberBetween(1, 4), + 'custom_value3' => $faker->numberBetween(1, 4), + 'custom_value4' => $faker->numberBetween(1, 4), + 'is_deleted' => false, + 'po_number' => $faker->text(10), + 'date' => $faker->date(), + 'due_date' => $faker->date(), + 'line_items' => false, + 'frequency_id' => App\Models\RecurringQuote::FREQUENCY_MONTHLY, + 'start_date' => $faker->date(), + 'last_sent_date' => $faker->date(), + 'next_send_date' => $faker->date(), + 'remaining_cycles' => $faker->numberBetween(1, 10), ]; -}); \ No newline at end of file +}); diff --git a/database/factories/VendorContactFactory.php b/database/factories/VendorContactFactory.php index 8f28c38c94..679a440328 100644 --- a/database/factories/VendorContactFactory.php +++ b/database/factories/VendorContactFactory.php @@ -20,5 +20,4 @@ $factory->define(App\Models\VendorContact::class, function (Faker $faker) { 'phone' => $faker->phoneNumber, 'email' => $faker->unique()->safeEmail, ]; - }); diff --git a/database/migrations/2014_10_13_000000_create_users_table.php b/database/migrations/2014_10_13_000000_create_users_table.php index 26358018a2..5d6a1c1602 100644 --- a/database/migrations/2014_10_13_000000_create_users_table.php +++ b/database/migrations/2014_10_13_000000_create_users_table.php @@ -14,9 +14,8 @@ class CreateUsersTable extends Migration */ public function up() { - - DB::raw("SET GLOBAL innodb_file_per_table=1;"); - DB::raw("SET GLOBAL innodb_file_format=Barracuda;"); + DB::raw("SET GLOBAL innodb_file_per_table=1;"); + DB::raw("SET GLOBAL innodb_file_format=Barracuda;"); Schema::create('languages', function ($table) { $table->increments('id'); @@ -68,7 +67,6 @@ class CreateUsersTable extends Migration $table->string('code'); $table->boolean('swap_currency_symbol')->default(false); $table->decimal('exchange_rate', 13, 6)->default(1); - }); Schema::create('sizes', function ($table) { @@ -98,7 +96,6 @@ class CreateUsersTable extends Migration }); Schema::create('accounts', function ($table) { - $table->increments('id'); $table->enum('plan', ['pro', 'enterprise', 'white_label'])->nullable(); @@ -144,7 +141,7 @@ class CreateUsersTable extends Migration $table->unsignedInteger('account_id')->index(); $table->unsignedInteger('industry_id')->nullable(); $table->string('ip')->nullable(); - $table->string('company_key',100)->unique(); + $table->string('company_key', 100)->unique(); $table->string('logo')->nullable(); $table->boolean('convert_products')->default(false); $table->boolean('fill_products')->default(true); @@ -186,8 +183,6 @@ class CreateUsersTable extends Migration $table->foreign('industry_id')->references('id')->on('industries'); $table->foreign('size_id')->references('id')->on('sizes'); $table->foreign('account_id')->references('id')->on('accounts')->onDelete('cascade')->onUpdate('cascade'); - - }); //DB::statement('ALTER table companies key_block_size=8 row_format=compressed'); @@ -211,14 +206,13 @@ class CreateUsersTable extends Migration $table->foreign('company_id')->references('id')->on('companies')->onDelete('cascade'); $table->foreign('account_id')->references('id')->on('accounts')->onDelete('cascade'); - // $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade'); + // $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade'); $table->unique(['company_id', 'user_id']); $table->index(['account_id', 'company_id']); - }); - Schema::create('documents', function (Blueprint $table){ + Schema::create('documents', function (Blueprint $table) { $table->increments('id'); $table->unsignedInteger('user_id'); $table->unsignedInteger('assigned_user_id'); @@ -246,24 +240,22 @@ class CreateUsersTable extends Migration $table->timestamps(6); $table->foreign('company_id')->references('id')->on('companies')->onDelete('cascade')->onUpdate('cascade'); - }); Schema::create('users', function (Blueprint $table) { - $table->increments('id'); $table->string('first_name')->nullable(); $table->string('last_name')->nullable(); $table->string('phone')->nullable(); $table->string('ip')->nullable(); $table->string('device_token')->nullable(); - $table->string('email',100)->unique(); + $table->string('email', 100)->unique(); $table->timestamp('email_verified_at')->nullable(); $table->string('confirmation_code')->nullable(); $table->integer('theme_id')->nullable(); $table->smallInteger('failed_logins')->nullable(); $table->string('referral_code')->nullable(); - $table->string('oauth_user_id',100)->nullable(); + $table->string('oauth_user_id', 100)->nullable(); $table->string('oauth_user_token')->nullable(); $table->string('oauth_provider_id')->nullable(); $table->string('google_2fa_secret')->nullable(); @@ -288,8 +280,7 @@ class CreateUsersTable extends Migration $table->unique(['oauth_user_id', 'oauth_provider_id']); - // $table->foreign('user_id')->references('user_id')->on('company_users')->onDelete('cascade'); - + // $table->foreign('user_id')->references('user_id')->on('company_users')->onDelete('cascade'); }); @@ -309,7 +300,6 @@ class CreateUsersTable extends Migration }); Schema::create('clients', function (Blueprint $table) { - $table->increments('id'); $table->unsignedInteger('company_id')->index(); $table->unsignedInteger('user_id')->index(); @@ -329,7 +319,7 @@ class CreateUsersTable extends Migration $table->timestamp('last_login')->nullable(); $table->unsignedInteger('industry_id')->nullable(); $table->unsignedInteger('size_id')->nullable(); - // $table->unsignedInteger('currency_id')->nullable(); + // $table->unsignedInteger('currency_id')->nullable(); $table->string('address1')->nullable(); $table->string('address2')->nullable(); @@ -351,7 +341,7 @@ class CreateUsersTable extends Migration $table->mediumText('settings')->nullable(); $table->boolean('is_deleted')->default(false); - $table->unsignedInteger('group_settings_id')->nullable(); + $table->unsignedInteger('group_settings_id')->nullable(); $table->string('vat_number')->nullable(); $table->string('id_number')->nullable(); @@ -361,8 +351,7 @@ class CreateUsersTable extends Migration $table->foreign('company_id')->references('id')->on('companies')->onDelete('cascade')->onUpdate('cascade'); $table->foreign('industry_id')->references('id')->on('industries'); $table->foreign('size_id')->references('id')->on('sizes'); - // $table->foreign('currency_id')->references('id')->on('currencies'); - + // $table->foreign('currency_id')->references('id')->on('currencies'); }); Schema::create('client_contacts', function (Blueprint $table) { @@ -377,20 +366,20 @@ class CreateUsersTable extends Migration $table->string('custom_value2')->nullable(); $table->string('custom_value3')->nullable(); $table->string('custom_value4')->nullable(); - $table->string('email',100)->nullable(); + $table->string('email', 100)->nullable(); $table->timestamp('email_verified_at')->nullable(); $table->string('confirmation_code')->nullable(); $table->boolean('is_primary')->default(false); $table->boolean('confirmed')->default(false); $table->timestamp('last_login')->nullable(); $table->smallInteger('failed_logins')->nullable(); - $table->string('oauth_user_id',100)->nullable()->unique(); + $table->string('oauth_user_id', 100)->nullable()->unique(); $table->unsignedInteger('oauth_provider_id')->nullable()->unique(); $table->string('google_2fa_secret')->nullable(); $table->string('accepted_terms_version')->nullable(); $table->string('avatar', 255)->nullable(); - $table->string('avatar_type',255)->nullable(); - $table->string('avatar_size',255)->nullable(); + $table->string('avatar_type', 255)->nullable(); + $table->string('avatar_size', 255)->nullable(); $table->string('password'); $table->string('token')->nullable(); $table->boolean('is_locked')->default(false); @@ -404,8 +393,7 @@ class CreateUsersTable extends Migration //$table->unique(['company_id', 'email']); }); - Schema::create('company_gateways', function($table) - { + Schema::create('company_gateways', function ($table) { $table->increments('id'); $table->unsignedInteger('company_id'); $table->unsignedInteger('user_id'); @@ -430,7 +418,6 @@ class CreateUsersTable extends Migration $table->foreign('company_id')->references('id')->on('companies')->onDelete('cascade')->onUpdate('cascade'); $table->foreign('gateway_key')->references('key')->on('gateways'); $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade')->onUpdate('cascade'); - }); @@ -612,7 +599,6 @@ class CreateUsersTable extends Migration $t->index(['deleted_at', 'credit_id']); $t->unique(['client_contact_id', 'credit_id']); - }); Schema::create('recurring_invoices', function ($t) { @@ -678,7 +664,6 @@ class CreateUsersTable extends Migration $t->timestamps(6); $t->softDeletes('deleted_at', 6); - }); Schema::create('recurring_quotes', function ($t) { @@ -742,7 +727,6 @@ class CreateUsersTable extends Migration $t->timestamps(6); $t->softDeletes('deleted_at', 6); - }); Schema::create('quotes', function ($t) { @@ -850,7 +834,6 @@ class CreateUsersTable extends Migration $t->index(['deleted_at', 'invoice_id']); $t->unique(['client_contact_id', 'invoice_id']); - }); @@ -882,23 +865,20 @@ class CreateUsersTable extends Migration $t->index(['deleted_at', 'quote_id']); $t->unique(['client_contact_id', 'quote_id']); - }); Schema::create('tax_rates', function ($t) { - $t->increments('id'); $t->unsignedInteger('company_id')->index(); $t->unsignedInteger('user_id')->nullable(); $t->timestamps(6); $t->softDeletes('deleted_at', 6); - $t->string('name',100); + $t->string('name', 100); $t->decimal('rate', 13, 3)->default(0); $t->foreign('company_id')->references('id')->on('companies')->onDelete('cascade')->onUpdate('cascade'); $t->foreign('user_id')->references('id')->on('users')->onDelete('cascade')->onUpdate('cascade'); - }); @@ -939,7 +919,7 @@ class CreateUsersTable extends Migration Schema::create('payments', function ($t) { - $t->increments('id'); + $t->increments('id'); $t->unsignedInteger('company_id')->index(); $t->unsignedInteger('client_id')->index(); $t->unsignedInteger('project_id')->nullable(); @@ -972,7 +952,6 @@ class CreateUsersTable extends Migration $t->foreign('client_contact_id')->references('id')->on('client_contacts')->onDelete('cascade')->onUpdate('cascade'); $t->foreign('company_gateway_id')->references('id')->on('company_gateways')->onDelete('cascade')->onUpdate('cascade'); $t->foreign('user_id')->references('id')->on('users')->onDelete('cascade')->onUpdate('cascade'); - }); Schema::create('paymentables', function ($table) { //allows multiple invoices to one payment @@ -985,7 +964,6 @@ class CreateUsersTable extends Migration $table->timestamps(); $table->foreign('payment_id')->references('id')->on('payments')->onDelete('cascade')->onUpdate('cascade'); - }); @@ -1019,7 +997,6 @@ class CreateUsersTable extends Migration $table->foreign('company_id')->references('id')->on('companies')->onDelete('cascade')->onUpdate('cascade'); $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade')->onUpdate('cascade'); $table->foreign('bank_id')->references('id')->on('banks'); - }); @@ -1039,7 +1016,6 @@ class CreateUsersTable extends Migration $table->foreign('company_id')->references('id')->on('companies')->onDelete('cascade')->onUpdate('cascade'); $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade')->onUpdate('cascade'); $table->foreign('bank_company_id')->references('id')->on('bank_companies')->onDelete('cascade')->onUpdate('cascade'); - }); Schema::create('payment_terms', function ($table) { @@ -1092,7 +1068,6 @@ class CreateUsersTable extends Migration $table->foreign('company_id')->references('id')->on('companies')->onDelete('cascade')->onUpdate('cascade'); //$table->foreign('client_id')->references('id')->on('clients')->onDelete('cascade')->onUpdate('cascade'); - }); Schema::create('backups', function ($table) { @@ -1103,11 +1078,9 @@ class CreateUsersTable extends Migration $table->timestamps(6); $table->foreign('activity_id')->references('id')->on('activities')->onDelete('cascade')->onUpdate('cascade'); - }); Schema::create('company_ledgers', function ($table) { - $table->increments('id'); $table->unsignedInteger('company_id'); $table->unsignedInteger('client_id')->nullable(); @@ -1133,7 +1106,7 @@ class CreateUsersTable extends Migration }); - Schema::create('client_gateway_tokens', function ($table){ + Schema::create('client_gateway_tokens', function ($table) { $table->increments('id'); $table->unsignedInteger('company_id'); $table->unsignedInteger('client_id')->nullable(); @@ -1151,7 +1124,7 @@ class CreateUsersTable extends Migration $table->foreign('client_id')->references('id')->on('clients')->onDelete('cascade')->onUpdate('cascade'); }); - Schema::create('group_settings', function ($table){ + Schema::create('group_settings', function ($table) { $table->increments('id'); $table->unsignedInteger('company_id'); $table->unsignedInteger('user_id')->nullable(); @@ -1178,7 +1151,7 @@ class CreateUsersTable extends Migration $table->string('format_dart'); }); - Schema::create('system_logs', function ($table){ + Schema::create('system_logs', function ($table) { $table->increments('id'); $table->unsignedInteger('company_id'); $table->unsignedInteger('user_id')->nullable(); @@ -1191,7 +1164,6 @@ class CreateUsersTable extends Migration $table->foreign('company_id')->references('id')->on('companies')->onDelete('cascade')->onUpdate('cascade'); $table->foreign('client_id')->references('id')->on('clients')->onDelete('cascade')->onUpdate('cascade'); - }); Schema::create('vendors', function (Blueprint $table) { @@ -1251,7 +1223,6 @@ class CreateUsersTable extends Migration $table->foreign('vendor_id')->references('id')->on('vendors')->onDelete('cascade')->onUpdate('cascade'); $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade')->onUpdate('cascade'); $table->foreign('company_id')->references('id')->on('companies')->onDelete('cascade')->onUpdate('cascade'); - }); Schema::create('expense_categories', function ($table) { @@ -1307,7 +1278,6 @@ class CreateUsersTable extends Migration // Relations $table->foreign('company_id')->references('id')->on('companies')->onDelete('cascade')->onUpdate('cascade'); $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade')->onUpdate('cascade'); - }); @@ -1324,7 +1294,7 @@ class CreateUsersTable extends Migration $t->text('private_notes')->nullable(); $t->float('budgeted_hours'); $t->text('custom_value1')->nullable(); - $t->text('custom_value2')->nullable(); + $t->text('custom_value2')->nullable(); $t->text('custom_value3')->nullable(); $t->text('custom_value4')->nullable(); $t->timestamps(6); @@ -1350,7 +1320,7 @@ class CreateUsersTable extends Migration $table->softDeletes(); $table->text('custom_value1')->nullable(); - $table->text('custom_value2')->nullable(); + $table->text('custom_value2')->nullable(); $table->text('custom_value3')->nullable(); $table->text('custom_value4')->nullable(); @@ -1380,7 +1350,6 @@ class CreateUsersTable extends Migration $table->timestamps(6); $table->softDeletes('deleted_at', 6); $table->foreign('company_id')->references('id')->on('companies')->onDelete('cascade')->onUpdate('cascade'); - }); } @@ -1391,9 +1360,5 @@ class CreateUsersTable extends Migration */ public function down() { - - } - - -} \ No newline at end of file +} diff --git a/database/seeds/ConstantsSeeder.php b/database/seeds/ConstantsSeeder.php index 9cb5ebe2c8..a385d36980 100644 --- a/database/seeds/ConstantsSeeder.php +++ b/database/seeds/ConstantsSeeder.php @@ -9,8 +9,6 @@ class ConstantsSeeder extends Seeder { public function run() { - - Size::create(['name' => '1 - 3']); Size::create(['name' => '4 - 10']); Size::create(['name' => '11 - 50']); @@ -154,6 +152,4 @@ class ConstantsSeeder extends Seeder $x++; } } - - } diff --git a/database/seeds/DatabaseSeeder.php b/database/seeds/DatabaseSeeder.php index 111378d9d7..c22b0498e1 100644 --- a/database/seeds/DatabaseSeeder.php +++ b/database/seeds/DatabaseSeeder.php @@ -32,6 +32,5 @@ class DatabaseSeeder extends Seeder $this->call('GatewayTypesSeeder'); $this->call('DateFormatsSeeder'); $this->call('DesignSeeder'); - } } diff --git a/database/seeds/DesignSeeder.php b/database/seeds/DesignSeeder.php index 90d1295f02..03a191eb71 100644 --- a/database/seeds/DesignSeeder.php +++ b/database/seeds/DesignSeeder.php @@ -15,7 +15,7 @@ class DesignSeeder extends Seeder private function createDesigns() { - $designs = [ + $designs = [ ['id' => 1, 'name' => 'Plain', 'user_id' => null, 'company_id' => null, 'is_custom' => false, 'design' => '', 'is_active' => true], ['id' => 2, 'name' => 'Clean', 'user_id' => null, 'company_id' => null, 'is_custom' => false, 'design' => '', 'is_active' => true], ['id' => 3, 'name' => 'Bold', 'user_id' => null, 'company_id' => null, 'is_custom' => false, 'design' => '', 'is_active' => true], @@ -28,16 +28,15 @@ class DesignSeeder extends Seeder ['id' => 10, 'name' => 'Photo', 'user_id' => null, 'company_id' => null, 'is_custom' => false, 'design' => '', 'is_active' => true], ]; - foreach($designs as $design) { + foreach ($designs as $design) { + $d = Design::find($design['id']); - $d = Design::find($design['id']); - - if(!$d) - Design::create($design); + if (!$d) { + Design::create($design); + } } - foreach(Design::all() as $design){ - + foreach (Design::all() as $design) { $class = 'App\Designs\\'.$design->name; $invoice_design = new $class(); @@ -52,6 +51,5 @@ class DesignSeeder extends Seeder $design->design = $design_object; $design->save(); } - } -} \ No newline at end of file +} diff --git a/database/seeds/PaymentLibrariesSeeder.php b/database/seeds/PaymentLibrariesSeeder.php index dfd99cf9b9..caa4f32b92 100644 --- a/database/seeds/PaymentLibrariesSeeder.php +++ b/database/seeds/PaymentLibrariesSeeder.php @@ -81,6 +81,5 @@ class PaymentLibrariesSeeder extends Seeder Gateway::create($gateway); } } - } } diff --git a/database/seeds/PaymentTypesSeeder.php b/database/seeds/PaymentTypesSeeder.php index 4a76e05e8d..b2c42b9a7c 100644 --- a/database/seeds/PaymentTypesSeeder.php +++ b/database/seeds/PaymentTypesSeeder.php @@ -5,7 +5,6 @@ use Illuminate\Database\Seeder; class PaymentTypesSeeder extends Seeder { - const BANK_LIBRARY_OFX = 1; const GATEWAY_TYPE_CREDIT_CARD = 1; const GATEWAY_TYPE_BANK_TRANSFER = 2; diff --git a/database/seeds/RandomDataSeeder.php b/database/seeds/RandomDataSeeder.php index 136939e709..6125fc8eff 100644 --- a/database/seeds/RandomDataSeeder.php +++ b/database/seeds/RandomDataSeeder.php @@ -123,40 +123,38 @@ class RandomDataSeeder extends Seeder ]); - factory(\App\Models\Client::class, 10)->create(['user_id' => $user->id, 'company_id' => $company->id])->each(function ($c) use ($user, $company){ - - factory(\App\Models\ClientContact::class,1)->create([ + factory(\App\Models\Client::class, 10)->create(['user_id' => $user->id, 'company_id' => $company->id])->each(function ($c) use ($user, $company) { + factory(\App\Models\ClientContact::class, 1)->create([ 'user_id' => $user->id, 'client_id' => $c->id, 'company_id' => $company->id, 'is_primary' => 1 ]); - factory(\App\Models\ClientContact::class,5)->create([ + factory(\App\Models\ClientContact::class, 5)->create([ 'user_id' => $user->id, 'client_id' => $c->id, 'company_id' => $company->id ]); - }); /** Product Factory */ - factory(\App\Models\Product::class,20)->create(['user_id' => $user->id, 'company_id' => $company->id]); + factory(\App\Models\Product::class, 20)->create(['user_id' => $user->id, 'company_id' => $company->id]); /** Invoice Factory */ - factory(\App\Models\Invoice::class,20)->create(['user_id' => $user->id, 'company_id' => $company->id, 'client_id' => $client->id]); + factory(\App\Models\Invoice::class, 20)->create(['user_id' => $user->id, 'company_id' => $company->id, 'client_id' => $client->id]); $invoices = Invoice::cursor(); $invoice_repo = new InvoiceRepository(); - $invoices->each(function ($invoice) use($invoice_repo, $user, $company, $client){ - + $invoices->each(function ($invoice) use ($invoice_repo, $user, $company, $client) { $invoice_calc = null; - if($invoice->uses_inclusive_taxes) + if ($invoice->uses_inclusive_taxes) { $invoice_calc = new InvoiceSumInclusive($invoice); - else + } else { $invoice_calc = new InvoiceSum($invoice); + } $invoice = $invoice_calc->build()->getInvoice(); @@ -170,14 +168,14 @@ class RandomDataSeeder extends Seeder event(new InvoiceWasMarkedSent($invoice, $company)); - if(rand(0, 1)) { + if (rand(0, 1)) { $payment = App\Models\Payment::create([ 'date' => now(), 'user_id' => $user->id, 'company_id' => $company->id, 'client_id' => $client->id, 'amount' => $invoice->balance, - 'transaction_reference' => rand(0,500), + 'transaction_reference' => rand(0, 500), 'type_id' => PaymentType::CREDIT_CARD_OTHER, 'status_id' => Payment::STATUS_COMPLETED, ]); @@ -188,25 +186,24 @@ class RandomDataSeeder extends Seeder $payment->service()->updateInvoicePayment(); - // UpdateInvoicePayment::dispatchNow($payment, $payment->company); + // UpdateInvoicePayment::dispatchNow($payment, $payment->company); } - }); /*Credits*/ - factory(\App\Models\Credit::class,20)->create(['user_id' => $user->id, 'company_id' => $company->id, 'client_id' => $client->id]); + factory(\App\Models\Credit::class, 20)->create(['user_id' => $user->id, 'company_id' => $company->id, 'client_id' => $client->id]); $credits = Credit::cursor(); $credit_repo = new CreditRepository(); - $credits->each(function ($credit) use($credit_repo, $user, $company, $client){ - + $credits->each(function ($credit) use ($credit_repo, $user, $company, $client) { $credit_calc = null; - if($credit->uses_inclusive_taxes) + if ($credit->uses_inclusive_taxes) { $credit_calc = new InvoiceSumInclusive($credit); - else + } else { $credit_calc = new InvoiceSum($credit); + } $credit = $credit_calc->build()->getCredit(); @@ -215,20 +212,18 @@ class RandomDataSeeder extends Seeder event(new CreateCreditInvitation($credit)); //$invoice->markSent()->save(); - }); /** Recurring Invoice Factory */ - factory(\App\Models\RecurringInvoice::class,10)->create(['user_id' => $user->id, 'company_id' => $company->id, 'client_id' => $client->id]); + factory(\App\Models\RecurringInvoice::class, 10)->create(['user_id' => $user->id, 'company_id' => $company->id, 'client_id' => $client->id]); - // factory(\App\Models\Payment::class,20)->create(['user_id' => $user->id, 'company_id' => $company->id, 'client_id' => $client->id, 'settings' => ClientSettings::buildClientSettings($company->settings, $client->settings)]); + // factory(\App\Models\Payment::class,20)->create(['user_id' => $user->id, 'company_id' => $company->id, 'client_id' => $client->id, 'settings' => ClientSettings::buildClientSettings($company->settings, $client->settings)]); $clients = Client::all(); - foreach($clients as $client) - { + foreach ($clients as $client) { //$client->getNextClientNumber($client); $client->id_number = $client->getNextClientNumber($client); $client->save(); @@ -243,9 +238,7 @@ class RandomDataSeeder extends Seeder ]); - if(config('ninja.testvars.stripe')) - { - + if (config('ninja.testvars.stripe')) { $cg = new CompanyGateway; $cg->company_id = $company->id; $cg->user_id = $user->id; @@ -269,8 +262,7 @@ class RandomDataSeeder extends Seeder $cg->save(); } - if(config('ninja.testvars.paypal')) - { + if (config('ninja.testvars.paypal')) { $cg = new CompanyGateway; $cg->company_id = $company->id; $cg->user_id = $user->id; @@ -282,8 +274,5 @@ class RandomDataSeeder extends Seeder $cg->config = encrypt(config('ninja.testvars.paypal')); $cg->save(); } - } - - } diff --git a/database/seeds/UsersTableSeeder.php b/database/seeds/UsersTableSeeder.php index f10cf88222..6ab4004aaf 100644 --- a/database/seeds/UsersTableSeeder.php +++ b/database/seeds/UsersTableSeeder.php @@ -19,7 +19,6 @@ class UsersTableSeeder extends Seeder */ public function run() { - $this->command->info('Running UsersTableSeeder'); Eloquent::unguard(); @@ -77,23 +76,19 @@ class UsersTableSeeder extends Seeder ]); - factory(\App\Models\Client::class, 20)->create(['user_id' => $user->id, 'company_id' => $company->id])->each(function ($c) use ($user, $company){ - - factory(\App\Models\ClientContact::class,1)->create([ + factory(\App\Models\Client::class, 20)->create(['user_id' => $user->id, 'company_id' => $company->id])->each(function ($c) use ($user, $company) { + factory(\App\Models\ClientContact::class, 1)->create([ 'user_id' => $user->id, 'client_id' => $c->id, 'company_id' => $company->id, 'is_primary' => 1 ]); - factory(\App\Models\ClientContact::class,10)->create([ + factory(\App\Models\ClientContact::class, 10)->create([ 'user_id' => $user->id, 'client_id' => $c->id, 'company_id' => $company->id ]); - }); - - } } diff --git a/public/index.php b/public/index.php index c10c09a280..02185aed10 100644 --- a/public/index.php +++ b/public/index.php @@ -61,4 +61,3 @@ $response = $kernel->handle( $response->send(); $kernel->terminate($request, $response); - diff --git a/resources/lang/ca/texts.php b/resources/lang/ca/texts.php index 34e4e19384..9776c718eb 100644 --- a/resources/lang/ca/texts.php +++ b/resources/lang/ca/texts.php @@ -1963,37 +1963,37 @@ $LANG = array( 'authorization' => 'Authorization', 'signed' => 'Signed', - // BlueVine - 'bluevine_promo' => 'Get flexible business lines of credit and invoice factoring using BlueVine.', - 'bluevine_modal_label' => 'Sign up with BlueVine', - 'bluevine_modal_text' => '

Fast funding for your business. No paperwork.

+ // BlueVine + 'bluevine_promo' => 'Get flexible business lines of credit and invoice factoring using BlueVine.', + 'bluevine_modal_label' => 'Sign up with BlueVine', + 'bluevine_modal_text' => '

Fast funding for your business. No paperwork.

  • Flexible business lines of credit and invoice factoring.
', - 'bluevine_create_account' => 'Create an account', - 'quote_types' => 'Get a quote for', - 'invoice_factoring' => 'Invoice factoring', - 'line_of_credit' => 'Line of credit', - 'fico_score' => 'Your FICO score', - 'business_inception' => 'Business Inception Date', - 'average_bank_balance' => 'Average bank account balance', - 'annual_revenue' => 'Annual revenue', - 'desired_credit_limit_factoring' => 'Desired invoice factoring limit', - 'desired_credit_limit_loc' => 'Desired line of credit limit', - 'desired_credit_limit' => 'Desired credit limit', - 'bluevine_credit_line_type_required' => 'You must choose at least one', - 'bluevine_field_required' => 'This field is required', - 'bluevine_unexpected_error' => 'An unexpected error occurred.', - 'bluevine_no_conditional_offer' => 'More information is required before getting a quote. Click continue below.', - 'bluevine_invoice_factoring' => 'Invoice Factoring', - 'bluevine_conditional_offer' => 'Conditional Offer', - 'bluevine_credit_line_amount' => 'Credit Line', - 'bluevine_advance_rate' => 'Advance Rate', - 'bluevine_weekly_discount_rate' => 'Weekly Discount Rate', - 'bluevine_minimum_fee_rate' => 'Minimum Fee', - 'bluevine_line_of_credit' => 'Line of Credit', - 'bluevine_interest_rate' => 'Interest Rate', - 'bluevine_weekly_draw_rate' => 'Weekly Draw Rate', - 'bluevine_continue' => 'Continue to BlueVine', - 'bluevine_completed' => 'BlueVine signup completed', + 'bluevine_create_account' => 'Create an account', + 'quote_types' => 'Get a quote for', + 'invoice_factoring' => 'Invoice factoring', + 'line_of_credit' => 'Line of credit', + 'fico_score' => 'Your FICO score', + 'business_inception' => 'Business Inception Date', + 'average_bank_balance' => 'Average bank account balance', + 'annual_revenue' => 'Annual revenue', + 'desired_credit_limit_factoring' => 'Desired invoice factoring limit', + 'desired_credit_limit_loc' => 'Desired line of credit limit', + 'desired_credit_limit' => 'Desired credit limit', + 'bluevine_credit_line_type_required' => 'You must choose at least one', + 'bluevine_field_required' => 'This field is required', + 'bluevine_unexpected_error' => 'An unexpected error occurred.', + 'bluevine_no_conditional_offer' => 'More information is required before getting a quote. Click continue below.', + 'bluevine_invoice_factoring' => 'Invoice Factoring', + 'bluevine_conditional_offer' => 'Conditional Offer', + 'bluevine_credit_line_amount' => 'Credit Line', + 'bluevine_advance_rate' => 'Advance Rate', + 'bluevine_weekly_discount_rate' => 'Weekly Discount Rate', + 'bluevine_minimum_fee_rate' => 'Minimum Fee', + 'bluevine_line_of_credit' => 'Line of Credit', + 'bluevine_interest_rate' => 'Interest Rate', + 'bluevine_weekly_draw_rate' => 'Weekly Draw Rate', + 'bluevine_continue' => 'Continue to BlueVine', + 'bluevine_completed' => 'BlueVine signup completed', 'vendor_name' => 'Vendor', 'entity_state' => 'State', @@ -2127,16 +2127,16 @@ $LANG = array( 'reports_help' => 'Shift + Click to sort by multiple columns, Ctrl + Click to clear the grouping.', 'this_year' => 'This Year', - // Updated login screen - 'ninja_tagline' => 'Create. Send. Get Paid.', - 'login_or_existing' => 'Or login with a connected account.', - 'sign_up_now' => 'Sign Up Now', - 'not_a_member_yet' => 'Not a member yet?', - 'login_create_an_account' => 'Create an Account!', - 'client_login' => 'Client Login', + // Updated login screen + 'ninja_tagline' => 'Create. Send. Get Paid.', + 'login_or_existing' => 'Or login with a connected account.', + 'sign_up_now' => 'Sign Up Now', + 'not_a_member_yet' => 'Not a member yet?', + 'login_create_an_account' => 'Create an Account!', + 'client_login' => 'Client Login', - // New Client Portal styling - 'invoice_from' => 'Invoices From:', + // New Client Portal styling + 'invoice_from' => 'Invoices From:', 'email_alias_message' => 'We require each company to have a unique email address.
Consider using an alias. ie, email+label@example.com', 'full_name' => 'Full Name', 'month_year' => 'MONTH/YEAR', @@ -2431,7 +2431,7 @@ $LANG = array( 'tax1' => 'First Tax', 'tax2' => 'Second Tax', 'fee_help' => 'Gateway fees are the costs charged for access to the financial networks that handle the processing of online payments.', - 'format_export' => 'Exporting format', + 'format_export' => 'Exporting format', 'custom1' => 'First Custom', 'custom2' => 'Second Custom', 'contact_first_name' => 'Contact First Name', @@ -2868,5 +2868,3 @@ $LANG = array( ); return $LANG; - -?> diff --git a/resources/lang/cs/texts.php b/resources/lang/cs/texts.php index 9c7fb93e62..2689e3ba01 100644 --- a/resources/lang/cs/texts.php +++ b/resources/lang/cs/texts.php @@ -1965,37 +1965,37 @@ $LANG = array( 'authorization' => 'Authorization', 'signed' => 'Signed', - // BlueVine - 'bluevine_promo' => 'Get flexible business lines of credit and invoice factoring using BlueVine.', - 'bluevine_modal_label' => 'Sign up with BlueVine', - 'bluevine_modal_text' => '

Fast funding for your business. No paperwork.

+ // BlueVine + 'bluevine_promo' => 'Get flexible business lines of credit and invoice factoring using BlueVine.', + 'bluevine_modal_label' => 'Sign up with BlueVine', + 'bluevine_modal_text' => '

Fast funding for your business. No paperwork.

  • Flexible business lines of credit and invoice factoring.
', - 'bluevine_create_account' => 'Create an account', - 'quote_types' => 'Get a quote for', - 'invoice_factoring' => 'Invoice factoring', - 'line_of_credit' => 'Line of credit', - 'fico_score' => 'Your FICO score', - 'business_inception' => 'Business Inception Date', - 'average_bank_balance' => 'Average bank account balance', - 'annual_revenue' => 'Roční příjmy', - 'desired_credit_limit_factoring' => 'Desired invoice factoring limit', - 'desired_credit_limit_loc' => 'Desired line of credit limit', - 'desired_credit_limit' => 'Desired credit limit', - 'bluevine_credit_line_type_required' => 'You must choose at least one', - 'bluevine_field_required' => 'This field is required', - 'bluevine_unexpected_error' => 'An unexpected error occurred.', - 'bluevine_no_conditional_offer' => 'More information is required before getting a quote. Click continue below.', - 'bluevine_invoice_factoring' => 'Invoice Factoring', - 'bluevine_conditional_offer' => 'Conditional Offer', - 'bluevine_credit_line_amount' => 'Credit Line', - 'bluevine_advance_rate' => 'Advance Rate', - 'bluevine_weekly_discount_rate' => 'Weekly Discount Rate', - 'bluevine_minimum_fee_rate' => 'Minimum Fee', - 'bluevine_line_of_credit' => 'Line of Credit', - 'bluevine_interest_rate' => 'Interest Rate', - 'bluevine_weekly_draw_rate' => 'Weekly Draw Rate', - 'bluevine_continue' => 'Continue to BlueVine', - 'bluevine_completed' => 'BlueVine signup completed', + 'bluevine_create_account' => 'Create an account', + 'quote_types' => 'Get a quote for', + 'invoice_factoring' => 'Invoice factoring', + 'line_of_credit' => 'Line of credit', + 'fico_score' => 'Your FICO score', + 'business_inception' => 'Business Inception Date', + 'average_bank_balance' => 'Average bank account balance', + 'annual_revenue' => 'Roční příjmy', + 'desired_credit_limit_factoring' => 'Desired invoice factoring limit', + 'desired_credit_limit_loc' => 'Desired line of credit limit', + 'desired_credit_limit' => 'Desired credit limit', + 'bluevine_credit_line_type_required' => 'You must choose at least one', + 'bluevine_field_required' => 'This field is required', + 'bluevine_unexpected_error' => 'An unexpected error occurred.', + 'bluevine_no_conditional_offer' => 'More information is required before getting a quote. Click continue below.', + 'bluevine_invoice_factoring' => 'Invoice Factoring', + 'bluevine_conditional_offer' => 'Conditional Offer', + 'bluevine_credit_line_amount' => 'Credit Line', + 'bluevine_advance_rate' => 'Advance Rate', + 'bluevine_weekly_discount_rate' => 'Weekly Discount Rate', + 'bluevine_minimum_fee_rate' => 'Minimum Fee', + 'bluevine_line_of_credit' => 'Line of Credit', + 'bluevine_interest_rate' => 'Interest Rate', + 'bluevine_weekly_draw_rate' => 'Weekly Draw Rate', + 'bluevine_continue' => 'Continue to BlueVine', + 'bluevine_completed' => 'BlueVine signup completed', 'vendor_name' => 'Vendor', 'entity_state' => 'State', @@ -2129,16 +2129,16 @@ $LANG = array( 'reports_help' => 'Shift + Click to sort by multiple columns, Ctrl + Click to clear the grouping.', 'this_year' => 'This Year', - // Updated login screen - 'ninja_tagline' => 'Create. Send. Get Paid.', - 'login_or_existing' => 'Or login with a connected account.', - 'sign_up_now' => 'Sign Up Now', - 'not_a_member_yet' => 'Not a member yet?', - 'login_create_an_account' => 'Create an Account!', - 'client_login' => 'Client Login', + // Updated login screen + 'ninja_tagline' => 'Create. Send. Get Paid.', + 'login_or_existing' => 'Or login with a connected account.', + 'sign_up_now' => 'Sign Up Now', + 'not_a_member_yet' => 'Not a member yet?', + 'login_create_an_account' => 'Create an Account!', + 'client_login' => 'Client Login', - // New Client Portal styling - 'invoice_from' => 'Faktury od:', + // New Client Portal styling + 'invoice_from' => 'Faktury od:', 'email_alias_message' => 'We require each company to have a unique email address.
Consider using an alias. ie, email+label@example.com', 'full_name' => 'Full Name', 'month_year' => 'Měsíc/Rok', @@ -2433,7 +2433,7 @@ $LANG = array( 'tax1' => 'First Tax', 'tax2' => 'Second Tax', 'fee_help' => 'Gateway fees are the costs charged for access to the financial networks that handle the processing of online payments.', - 'format_export' => 'Exporting format', + 'format_export' => 'Exporting format', 'custom1' => 'First Custom', 'custom2' => 'Second Custom', 'contact_first_name' => 'Contact First Name', @@ -2870,5 +2870,3 @@ $LANG = array( ); return $LANG; - -?> diff --git a/resources/lang/da/texts.php b/resources/lang/da/texts.php index 0a87f1ba03..f7502ac9c0 100644 --- a/resources/lang/da/texts.php +++ b/resources/lang/da/texts.php @@ -1962,37 +1962,37 @@ $LANG = array( 'authorization' => 'Autorisation', 'signed' => 'Signed', - // BlueVine - 'bluevine_promo' => 'Get flexible business lines of credit and invoice factoring using BlueVine.', - 'bluevine_modal_label' => 'Sign up with BlueVine', - 'bluevine_modal_text' => '

Fast funding for your business. No paperwork.

+ // BlueVine + 'bluevine_promo' => 'Get flexible business lines of credit and invoice factoring using BlueVine.', + 'bluevine_modal_label' => 'Sign up with BlueVine', + 'bluevine_modal_text' => '

Fast funding for your business. No paperwork.

  • Flexible business lines of credit and invoice factoring.
', - 'bluevine_create_account' => 'Create an account', - 'quote_types' => 'Get a quote for', - 'invoice_factoring' => 'Invoice factoring', - 'line_of_credit' => 'Line of credit', - 'fico_score' => 'Your FICO score', - 'business_inception' => 'Business Inception Date', - 'average_bank_balance' => 'Average bank account balance', - 'annual_revenue' => 'Annual revenue', - 'desired_credit_limit_factoring' => 'Desired invoice factoring limit', - 'desired_credit_limit_loc' => 'Desired line of credit limit', - 'desired_credit_limit' => 'Desired credit limit', - 'bluevine_credit_line_type_required' => 'You must choose at least one', - 'bluevine_field_required' => 'This field is required', - 'bluevine_unexpected_error' => 'An unexpected error occurred.', - 'bluevine_no_conditional_offer' => 'More information is required before getting a quote. Click continue below.', - 'bluevine_invoice_factoring' => 'Invoice Factoring', - 'bluevine_conditional_offer' => 'Conditional Offer', - 'bluevine_credit_line_amount' => 'Credit Line', - 'bluevine_advance_rate' => 'Advance Rate', - 'bluevine_weekly_discount_rate' => 'Weekly Discount Rate', - 'bluevine_minimum_fee_rate' => 'Minimum Fee', - 'bluevine_line_of_credit' => 'Line of Credit', - 'bluevine_interest_rate' => 'Interest Rate', - 'bluevine_weekly_draw_rate' => 'Weekly Draw Rate', - 'bluevine_continue' => 'Continue to BlueVine', - 'bluevine_completed' => 'BlueVine signup completed', + 'bluevine_create_account' => 'Create an account', + 'quote_types' => 'Get a quote for', + 'invoice_factoring' => 'Invoice factoring', + 'line_of_credit' => 'Line of credit', + 'fico_score' => 'Your FICO score', + 'business_inception' => 'Business Inception Date', + 'average_bank_balance' => 'Average bank account balance', + 'annual_revenue' => 'Annual revenue', + 'desired_credit_limit_factoring' => 'Desired invoice factoring limit', + 'desired_credit_limit_loc' => 'Desired line of credit limit', + 'desired_credit_limit' => 'Desired credit limit', + 'bluevine_credit_line_type_required' => 'You must choose at least one', + 'bluevine_field_required' => 'This field is required', + 'bluevine_unexpected_error' => 'An unexpected error occurred.', + 'bluevine_no_conditional_offer' => 'More information is required before getting a quote. Click continue below.', + 'bluevine_invoice_factoring' => 'Invoice Factoring', + 'bluevine_conditional_offer' => 'Conditional Offer', + 'bluevine_credit_line_amount' => 'Credit Line', + 'bluevine_advance_rate' => 'Advance Rate', + 'bluevine_weekly_discount_rate' => 'Weekly Discount Rate', + 'bluevine_minimum_fee_rate' => 'Minimum Fee', + 'bluevine_line_of_credit' => 'Line of Credit', + 'bluevine_interest_rate' => 'Interest Rate', + 'bluevine_weekly_draw_rate' => 'Weekly Draw Rate', + 'bluevine_continue' => 'Continue to BlueVine', + 'bluevine_completed' => 'BlueVine signup completed', 'vendor_name' => 'Vendor', 'entity_state' => 'State', @@ -2126,16 +2126,16 @@ $LANG = array( 'reports_help' => 'Shift + Click to sort by multiple columns, Ctrl + Click to clear the grouping.', 'this_year' => 'This Year', - // Updated login screen - 'ninja_tagline' => 'Create. Send. Get Paid.', - 'login_or_existing' => 'Or login with a connected account.', - 'sign_up_now' => 'Sign Up Now', - 'not_a_member_yet' => 'Not a member yet?', - 'login_create_an_account' => 'Create an Account!', - 'client_login' => 'Client log ing', + // Updated login screen + 'ninja_tagline' => 'Create. Send. Get Paid.', + 'login_or_existing' => 'Or login with a connected account.', + 'sign_up_now' => 'Sign Up Now', + 'not_a_member_yet' => 'Not a member yet?', + 'login_create_an_account' => 'Create an Account!', + 'client_login' => 'Client log ing', - // New Client Portal styling - 'invoice_from' => 'Fakturaer fra:', + // New Client Portal styling + 'invoice_from' => 'Fakturaer fra:', 'email_alias_message' => 'We require each company to have a unique email address.
Consider using an alias. ie, email+label@example.com', 'full_name' => 'Full Name', 'month_year' => 'MONTH/YEAR', @@ -2430,7 +2430,7 @@ $LANG = array( 'tax1' => 'First Tax', 'tax2' => 'Second Tax', 'fee_help' => 'Gateway fees are the costs charged for access to the financial networks that handle the processing of online payments.', - 'format_export' => 'Exporting format', + 'format_export' => 'Exporting format', 'custom1' => 'First Custom', 'custom2' => 'Second Custom', 'contact_first_name' => 'Contact First Name', @@ -2867,5 +2867,3 @@ $LANG = array( ); return $LANG; - -?> diff --git a/resources/lang/de/texts.php b/resources/lang/de/texts.php index 1246191bda..7c8ba1e8e9 100644 --- a/resources/lang/de/texts.php +++ b/resources/lang/de/texts.php @@ -1963,37 +1963,37 @@ Sobald Sie die Beträge erhalten haben, kommen Sie bitte wieder zurück zu diese 'authorization' => 'Genehmigung', 'signed' => 'unterzeichnet', - // BlueVine - 'bluevine_promo' => 'Factoring und Bonitätsauskünfte von BlueVine bestellen.', - 'bluevine_modal_label' => 'Anmelden mit BlueVine', - 'bluevine_modal_text' => '

Schnelle Finanzierung ohne Papierkram.

+ // BlueVine + 'bluevine_promo' => 'Factoring und Bonitätsauskünfte von BlueVine bestellen.', + 'bluevine_modal_label' => 'Anmelden mit BlueVine', + 'bluevine_modal_text' => '

Schnelle Finanzierung ohne Papierkram.

  • Flexible Bonitätsprüfung und Factoring.
', - 'bluevine_create_account' => 'Konto erstellen', - 'quote_types' => 'Angebot erhalten für', - 'invoice_factoring' => 'Factoring', - 'line_of_credit' => 'Bonitätsprüfung', - 'fico_score' => 'Ihre FICO Bewertung', - 'business_inception' => 'Gründungsdatum', - 'average_bank_balance' => 'durchschnittlicher Kontostand', - 'annual_revenue' => 'Jahresertrag', - 'desired_credit_limit_factoring' => 'Gewünschtes Factoring Limit', - 'desired_credit_limit_loc' => 'gewünschter Kreditrahmen', - 'desired_credit_limit' => 'gewünschtes Kreditlimit', - 'bluevine_credit_line_type_required' => 'Sie müssen mindestens eine auswählen', - 'bluevine_field_required' => 'Dies ist ein Pflichtfeld', - 'bluevine_unexpected_error' => 'Ein unerwarteter Fehler ist aufgetreten.', - 'bluevine_no_conditional_offer' => 'Mehr Information ist vonnöten um ein Angebot erstellen zu können. Bitte klicken Sie unten auf Weiter.', - 'bluevine_invoice_factoring' => 'Factoring', - 'bluevine_conditional_offer' => 'Freibleibendes Angebot', - 'bluevine_credit_line_amount' => 'Kreditline', - 'bluevine_advance_rate' => 'Finanzierungsanteil', - 'bluevine_weekly_discount_rate' => 'Wöchentlicher Rabatt', - 'bluevine_minimum_fee_rate' => 'Minimale Gebühr', - 'bluevine_line_of_credit' => 'Kreditline', - 'bluevine_interest_rate' => 'Zinssatz', - 'bluevine_weekly_draw_rate' => 'Wöchtentliche Rückzahlungsquote', - 'bluevine_continue' => 'Weiter zu BlueVine', - 'bluevine_completed' => 'BlueVine Anmeldung abgeschlossen', + 'bluevine_create_account' => 'Konto erstellen', + 'quote_types' => 'Angebot erhalten für', + 'invoice_factoring' => 'Factoring', + 'line_of_credit' => 'Bonitätsprüfung', + 'fico_score' => 'Ihre FICO Bewertung', + 'business_inception' => 'Gründungsdatum', + 'average_bank_balance' => 'durchschnittlicher Kontostand', + 'annual_revenue' => 'Jahresertrag', + 'desired_credit_limit_factoring' => 'Gewünschtes Factoring Limit', + 'desired_credit_limit_loc' => 'gewünschter Kreditrahmen', + 'desired_credit_limit' => 'gewünschtes Kreditlimit', + 'bluevine_credit_line_type_required' => 'Sie müssen mindestens eine auswählen', + 'bluevine_field_required' => 'Dies ist ein Pflichtfeld', + 'bluevine_unexpected_error' => 'Ein unerwarteter Fehler ist aufgetreten.', + 'bluevine_no_conditional_offer' => 'Mehr Information ist vonnöten um ein Angebot erstellen zu können. Bitte klicken Sie unten auf Weiter.', + 'bluevine_invoice_factoring' => 'Factoring', + 'bluevine_conditional_offer' => 'Freibleibendes Angebot', + 'bluevine_credit_line_amount' => 'Kreditline', + 'bluevine_advance_rate' => 'Finanzierungsanteil', + 'bluevine_weekly_discount_rate' => 'Wöchentlicher Rabatt', + 'bluevine_minimum_fee_rate' => 'Minimale Gebühr', + 'bluevine_line_of_credit' => 'Kreditline', + 'bluevine_interest_rate' => 'Zinssatz', + 'bluevine_weekly_draw_rate' => 'Wöchtentliche Rückzahlungsquote', + 'bluevine_continue' => 'Weiter zu BlueVine', + 'bluevine_completed' => 'BlueVine Anmeldung abgeschlossen', 'vendor_name' => 'Lieferant', 'entity_state' => 'Status', @@ -2127,16 +2127,16 @@ Sobald Sie die Beträge erhalten haben, kommen Sie bitte wieder zurück zu diese 'reports_help' => 'Shift + Click to sort by multiple columns, Ctrl + Click to clear the grouping.', 'this_year' => 'Dieses Jahr', - // Updated login screen - 'ninja_tagline' => 'Erstelle. Sende. Werde bezahlt.', - 'login_or_existing' => 'Oder melde dich mit einem verbundenen Konto an.', - 'sign_up_now' => 'Jetzt anmelden', - 'not_a_member_yet' => 'Noch kein Mitglied?', - 'login_create_an_account' => 'Konto erstellen!', - 'client_login' => 'Kundenanmeldung', + // Updated login screen + 'ninja_tagline' => 'Erstelle. Sende. Werde bezahlt.', + 'login_or_existing' => 'Oder melde dich mit einem verbundenen Konto an.', + 'sign_up_now' => 'Jetzt anmelden', + 'not_a_member_yet' => 'Noch kein Mitglied?', + 'login_create_an_account' => 'Konto erstellen!', + 'client_login' => 'Kundenanmeldung', - // New Client Portal styling - 'invoice_from' => 'Rechnungen von:', + // New Client Portal styling + 'invoice_from' => 'Rechnungen von:', 'email_alias_message' => 'Wir benötigen von jedem Benutzer eine einzigartige E-Mail-Adresse. Verwenden Sie einen Alias, z.B.: email+label@example.com', 'full_name' => 'Voller Name', 'month_year' => 'Monat/Jahr', @@ -2431,7 +2431,7 @@ Sobald Sie die Beträge erhalten haben, kommen Sie bitte wieder zurück zu diese 'tax1' => 'Steuern', 'tax2' => 'Aufschlag', 'fee_help' => 'Gateway-Gebühren sind die Kosten, die für die Nutzung der Finanznetzwerke anfallen, über die Online-Bezahlungen abgewickelt werden.', - 'format_export' => 'Export-Format', + 'format_export' => 'Export-Format', 'custom1' => 'Benutzerdefiniert 1', 'custom2' => 'Benutzerdefiniert 2', 'contact_first_name' => 'Kontakt Vorname', @@ -2868,5 +2868,3 @@ Sobald Sie die Beträge erhalten haben, kommen Sie bitte wieder zurück zu diese ); return $LANG; - -?> diff --git a/resources/lang/el/texts.php b/resources/lang/el/texts.php index 44c7206c90..465513d6e0 100644 --- a/resources/lang/el/texts.php +++ b/resources/lang/el/texts.php @@ -1963,37 +1963,37 @@ email που είναι συνδεδεμένη με το λογαριασμό σ 'authorization' => 'Εξουσιοδότηση', 'signed' => 'Υπογεγραμμένο', - // BlueVine - 'bluevine_promo' => 'Δεχθείτε ευέλικτες πιστωτικές λύσεις και factoring τιμολογίων με χρήση της BlueVine.', - 'bluevine_modal_label' => 'Εγγραφείτε στη BlueVine', - 'bluevine_modal_text' => '

Γρήγορη χρηματοδότηση της εταιρίας σας χωρίς γραφειοκρατία.

+ // BlueVine + 'bluevine_promo' => 'Δεχθείτε ευέλικτες πιστωτικές λύσεις και factoring τιμολογίων με χρήση της BlueVine.', + 'bluevine_modal_label' => 'Εγγραφείτε στη BlueVine', + 'bluevine_modal_text' => '

Γρήγορη χρηματοδότηση της εταιρίας σας χωρίς γραφειοκρατία.

  • Ευέλικτες πιστωτικές λύσεις και factoring τιμολογίων.
', - 'bluevine_create_account' => 'Δημιουργήστε λογαριασμό', - 'quote_types' => 'Λάβετε προσφορά για', - 'invoice_factoring' => 'Factoring τιμολογίων', - 'line_of_credit' => 'Πιστωτικές λύσεις', - 'fico_score' => 'Το FICO σκορ σας', - 'business_inception' => 'Ημερομηνία Έναρξης Επιχείρησης', - 'average_bank_balance' => 'Μέσο υπόλοιπο τραπεζικού λογαριασμού', - 'annual_revenue' => 'Ετήσια έσοδα', - 'desired_credit_limit_factoring' => 'Επιθυμητό όριο factoring τιμολογίων', - 'desired_credit_limit_loc' => 'Επιθυμητό όριο πιστωτικων λύσεων', - 'desired_credit_limit' => 'Επιθυμητό όριο πίστωσης', - 'bluevine_credit_line_type_required' => 'Πρέπει να επιλέξετε τουλάχιστον ένα', - 'bluevine_field_required' => 'Αυτό το πεδίο είναι απαραίτητο', - 'bluevine_unexpected_error' => 'Εμφανίστηκε μη αναμενόμενο σφάλμα.', - 'bluevine_no_conditional_offer' => 'Απαιτούνται περισσότερες πληροφορίες πριν τη λήψη προσφοράς. Πατήστε συνέχεια παρακάτω.', - 'bluevine_invoice_factoring' => 'Factoring Τιμολογίων', - 'bluevine_conditional_offer' => 'Προσφορά υπό όρους', - 'bluevine_credit_line_amount' => 'Πιστωτική Λύση', - 'bluevine_advance_rate' => 'Ποσοστό Επόμενου Βήματος', - 'bluevine_weekly_discount_rate' => 'Εβδομαδιαίο Ποσοστό Έκπτωσης', - 'bluevine_minimum_fee_rate' => 'Ελάχιστη Χρέωση', - 'bluevine_line_of_credit' => 'Πιστωτικές Λύσεις', - 'bluevine_interest_rate' => 'Επιτόκιο', - 'bluevine_weekly_draw_rate' => 'Εβδομαδιαίο Ποσοστό Εξισορρόπησης', - 'bluevine_continue' => 'Συνεχίστε στη BlueVine', - 'bluevine_completed' => 'Η εγγραφή στη BlueVine ολοκληρώθηκε', + 'bluevine_create_account' => 'Δημιουργήστε λογαριασμό', + 'quote_types' => 'Λάβετε προσφορά για', + 'invoice_factoring' => 'Factoring τιμολογίων', + 'line_of_credit' => 'Πιστωτικές λύσεις', + 'fico_score' => 'Το FICO σκορ σας', + 'business_inception' => 'Ημερομηνία Έναρξης Επιχείρησης', + 'average_bank_balance' => 'Μέσο υπόλοιπο τραπεζικού λογαριασμού', + 'annual_revenue' => 'Ετήσια έσοδα', + 'desired_credit_limit_factoring' => 'Επιθυμητό όριο factoring τιμολογίων', + 'desired_credit_limit_loc' => 'Επιθυμητό όριο πιστωτικων λύσεων', + 'desired_credit_limit' => 'Επιθυμητό όριο πίστωσης', + 'bluevine_credit_line_type_required' => 'Πρέπει να επιλέξετε τουλάχιστον ένα', + 'bluevine_field_required' => 'Αυτό το πεδίο είναι απαραίτητο', + 'bluevine_unexpected_error' => 'Εμφανίστηκε μη αναμενόμενο σφάλμα.', + 'bluevine_no_conditional_offer' => 'Απαιτούνται περισσότερες πληροφορίες πριν τη λήψη προσφοράς. Πατήστε συνέχεια παρακάτω.', + 'bluevine_invoice_factoring' => 'Factoring Τιμολογίων', + 'bluevine_conditional_offer' => 'Προσφορά υπό όρους', + 'bluevine_credit_line_amount' => 'Πιστωτική Λύση', + 'bluevine_advance_rate' => 'Ποσοστό Επόμενου Βήματος', + 'bluevine_weekly_discount_rate' => 'Εβδομαδιαίο Ποσοστό Έκπτωσης', + 'bluevine_minimum_fee_rate' => 'Ελάχιστη Χρέωση', + 'bluevine_line_of_credit' => 'Πιστωτικές Λύσεις', + 'bluevine_interest_rate' => 'Επιτόκιο', + 'bluevine_weekly_draw_rate' => 'Εβδομαδιαίο Ποσοστό Εξισορρόπησης', + 'bluevine_continue' => 'Συνεχίστε στη BlueVine', + 'bluevine_completed' => 'Η εγγραφή στη BlueVine ολοκληρώθηκε', 'vendor_name' => 'Προμηθευτής', 'entity_state' => 'Περιοχή', @@ -2127,16 +2127,16 @@ email που είναι συνδεδεμένη με το λογαριασμό σ 'reports_help' => 'Shift + Click για να γίνει ταξινόμηση με βάση πολλές στήλες, Ctrl + Click για εκκαθάριση της ομαδοποίησης.', 'this_year' => 'Τρέχον Χρόνος', - // Updated login screen - 'ninja_tagline' => 'Δημιουργήστε. Αποστείλετε. Εξοφληθείτε.', - 'login_or_existing' => 'Ή συνδεθείτε με ένα συνδεδεμένο λογαριασμό.', - 'sign_up_now' => 'Εγγραφή Τώρα', - 'not_a_member_yet' => 'Δεν είστε ακόμη μέλη;', - 'login_create_an_account' => 'Δημιουργία Λογαριασμού', - 'client_login' => 'Εισαγωγή Πελάτη', + // Updated login screen + 'ninja_tagline' => 'Δημιουργήστε. Αποστείλετε. Εξοφληθείτε.', + 'login_or_existing' => 'Ή συνδεθείτε με ένα συνδεδεμένο λογαριασμό.', + 'sign_up_now' => 'Εγγραφή Τώρα', + 'not_a_member_yet' => 'Δεν είστε ακόμη μέλη;', + 'login_create_an_account' => 'Δημιουργία Λογαριασμού', + 'client_login' => 'Εισαγωγή Πελάτη', - // New Client Portal styling - 'invoice_from' => 'Τιμολόγια Από:', + // New Client Portal styling + 'invoice_from' => 'Τιμολόγια Από:', 'email_alias_message' => 'Απαιτείται από τον κάθε εταιρία να έχει μία μοναδική διεύθυνση email.
Σκεφτείτε τη χρήση ενός ψευδώνυμου. Πχ, email+label@example.com', 'full_name' => 'Πλήρες Όνομα', 'month_year' => 'ΜΗΝΑΣ/ΕΤΟΣ', @@ -2431,7 +2431,7 @@ email που είναι συνδεδεμένη με το λογαριασμό σ 'tax1' => 'Πρώτο; Φόρος', 'tax2' => 'Δεύτερος Φόρος', 'fee_help' => 'Προμήθειες της πύλης πληρωμής (Gateway) είναι τα κόστη για την πρόσβαση στα δίκτυα που αναλαμβάνουν την επεξεργασία των online πληρωμών', - 'format_export' => 'Μορφή εξαγωγής', + 'format_export' => 'Μορφή εξαγωγής', 'custom1' => 'Πρώτη Προσαρμογή', 'custom2' => 'Δεύτερη Προσαρμογή', 'contact_first_name' => 'Όνομα Επαφής', @@ -2868,5 +2868,3 @@ email που είναι συνδεδεμένη με το λογαριασμό σ ); return $LANG; - -?> diff --git a/resources/lang/en/help.php b/resources/lang/en/help.php index 51b6860272..a2f0470816 100644 --- a/resources/lang/en/help.php +++ b/resources/lang/en/help.php @@ -5,9 +5,9 @@ $lang = [ 'client_currency' => 'The client currency.', 'client_language' => 'The client language.', 'client_payment_terms' => 'The client payment terms.', - 'client_paid_invoice' => 'Message to be displayed on a clients paid invoice screen', - 'client_unpaid_invoice' => 'Message to be displayed on a clients unpaid invoice screen', - 'client_unapproved_quote' => 'Message to be displayed on a clients unapproved quote screen', + 'client_paid_invoice' => 'Message to be displayed on a clients paid invoice screen', + 'client_unpaid_invoice' => 'Message to be displayed on a clients unpaid invoice screen', + 'client_unapproved_quote' => 'Message to be displayed on a clients unapproved quote screen', ]; -return $lang; \ No newline at end of file +return $lang; diff --git a/resources/lang/en/t.php b/resources/lang/en/t.php index 9971e7e275..a40e1b46e5 100644 --- a/resources/lang/en/t.php +++ b/resources/lang/en/t.php @@ -4,4 +4,4 @@ $lang = [ 'client_settings' => 'Client Settings', ]; -return $lang; \ No newline at end of file +return $lang; diff --git a/resources/lang/en/texts.php b/resources/lang/en/texts.php index b6f9c8f2bc..e1d2c748f3 100644 --- a/resources/lang/en/texts.php +++ b/resources/lang/en/texts.php @@ -1994,37 +1994,37 @@ return [ 'authorization' => 'Authorization', 'signed' => 'Signed', - // BlueVine - 'bluevine_promo' => 'Get flexible business lines of credit and invoice factoring using BlueVine.', - 'bluevine_modal_label' => 'Sign up with BlueVine', - 'bluevine_modal_text' => '

Fast funding for your business. No paperwork.

+ // BlueVine + 'bluevine_promo' => 'Get flexible business lines of credit and invoice factoring using BlueVine.', + 'bluevine_modal_label' => 'Sign up with BlueVine', + 'bluevine_modal_text' => '

Fast funding for your business. No paperwork.

  • Flexible business lines of credit and invoice factoring.
', - 'bluevine_create_account' => 'Create an account', - 'quote_types' => 'Get a quote for', - 'invoice_factoring' => 'Invoice factoring', - 'line_of_credit' => 'Line of credit', - 'fico_score' => 'Your FICO score', - 'business_inception' => 'Business Inception Date', - 'average_bank_balance' => 'Average bank account balance', - 'annual_revenue' => 'Annual revenue', - 'desired_credit_limit_factoring' => 'Desired invoice factoring limit', - 'desired_credit_limit_loc' => 'Desired line of credit limit', - 'desired_credit_limit' => 'Desired credit limit', - 'bluevine_credit_line_type_required' => 'You must choose at least one', - 'bluevine_field_required' => 'This field is required', - 'bluevine_unexpected_error' => 'An unexpected error occurred.', - 'bluevine_no_conditional_offer' => 'More information is required before getting a quote. Click continue below.', - 'bluevine_invoice_factoring' => 'Invoice Factoring', - 'bluevine_conditional_offer' => 'Conditional Offer', - 'bluevine_credit_line_amount' => 'Credit Line', - 'bluevine_advance_rate' => 'Advance Rate', - 'bluevine_weekly_discount_rate' => 'Weekly Discount Rate', - 'bluevine_minimum_fee_rate' => 'Minimum Fee', - 'bluevine_line_of_credit' => 'Line of Credit', - 'bluevine_interest_rate' => 'Interest Rate', - 'bluevine_weekly_draw_rate' => 'Weekly Draw Rate', - 'bluevine_continue' => 'Continue to BlueVine', - 'bluevine_completed' => 'BlueVine signup completed', + 'bluevine_create_account' => 'Create an account', + 'quote_types' => 'Get a quote for', + 'invoice_factoring' => 'Invoice factoring', + 'line_of_credit' => 'Line of credit', + 'fico_score' => 'Your FICO score', + 'business_inception' => 'Business Inception Date', + 'average_bank_balance' => 'Average bank account balance', + 'annual_revenue' => 'Annual revenue', + 'desired_credit_limit_factoring' => 'Desired invoice factoring limit', + 'desired_credit_limit_loc' => 'Desired line of credit limit', + 'desired_credit_limit' => 'Desired credit limit', + 'bluevine_credit_line_type_required' => 'You must choose at least one', + 'bluevine_field_required' => 'This field is required', + 'bluevine_unexpected_error' => 'An unexpected error occurred.', + 'bluevine_no_conditional_offer' => 'More information is required before getting a quote. Click continue below.', + 'bluevine_invoice_factoring' => 'Invoice Factoring', + 'bluevine_conditional_offer' => 'Conditional Offer', + 'bluevine_credit_line_amount' => 'Credit Line', + 'bluevine_advance_rate' => 'Advance Rate', + 'bluevine_weekly_discount_rate' => 'Weekly Discount Rate', + 'bluevine_minimum_fee_rate' => 'Minimum Fee', + 'bluevine_line_of_credit' => 'Line of Credit', + 'bluevine_interest_rate' => 'Interest Rate', + 'bluevine_weekly_draw_rate' => 'Weekly Draw Rate', + 'bluevine_continue' => 'Continue to BlueVine', + 'bluevine_completed' => 'BlueVine signup completed', 'vendor_name' => 'Vendor', 'entity_state' => 'State', @@ -2158,16 +2158,16 @@ return [ 'reports_help' => 'Shift + Click to sort by multiple columns, Ctrl + Click to clear the grouping.', 'this_year' => 'This Year', - // Updated login screen - 'ninja_tagline' => 'Create. Send. Get Paid.', - 'login_or_existing' => 'Or login with a connected account.', - 'sign_up_now' => 'Sign Up Now', - 'not_a_member_yet' => 'Not a member yet?', - 'login_create_an_account' => 'Create an Account!', - 'client_login' => 'Client Login', + // Updated login screen + 'ninja_tagline' => 'Create. Send. Get Paid.', + 'login_or_existing' => 'Or login with a connected account.', + 'sign_up_now' => 'Sign Up Now', + 'not_a_member_yet' => 'Not a member yet?', + 'login_create_an_account' => 'Create an Account!', + 'client_login' => 'Client Login', - // New Client Portal styling - 'invoice_from' => 'Invoices From:', + // New Client Portal styling + 'invoice_from' => 'Invoices From:', 'email_alias_message' => 'We require each company to have a unique email address.
Consider using an alias. ie, email+label@example.com', 'full_name' => 'Full Name', 'month_year' => 'MONTH/YEAR', @@ -2463,7 +2463,7 @@ return [ 'tax1' => 'First Tax', 'tax2' => 'Second Tax', 'fee_help' => 'Gateway fees are the costs charged for access to the financial networks that handle the processing of online payments.', - 'format_export' => 'Exporting format', + 'format_export' => 'Exporting format', 'custom1' => 'First Custom', 'custom2' => 'Second Custom', 'contact_first_name' => 'Contact First Name', diff --git a/resources/lang/en_GB/texts.php b/resources/lang/en_GB/texts.php index a099d75c47..9141fa078d 100644 --- a/resources/lang/en_GB/texts.php +++ b/resources/lang/en_GB/texts.php @@ -1965,37 +1965,37 @@ $LANG = array( 'authorization' => 'Authorization', 'signed' => 'Signed', - // BlueVine - 'bluevine_promo' => 'Get flexible business lines of credit and invoice factoring using BlueVine.', - 'bluevine_modal_label' => 'Sign up with BlueVine', - 'bluevine_modal_text' => '

Fast funding for your business. No paperwork.

+ // BlueVine + 'bluevine_promo' => 'Get flexible business lines of credit and invoice factoring using BlueVine.', + 'bluevine_modal_label' => 'Sign up with BlueVine', + 'bluevine_modal_text' => '

Fast funding for your business. No paperwork.

  • Flexible business lines of credit and invoice factoring.
', - 'bluevine_create_account' => 'Create an account', - 'quote_types' => 'Get a quote for', - 'invoice_factoring' => 'Invoice factoring', - 'line_of_credit' => 'Line of credit', - 'fico_score' => 'Your FICO score', - 'business_inception' => 'Business Inception Date', - 'average_bank_balance' => 'Average bank account balance', - 'annual_revenue' => 'Annual revenue', - 'desired_credit_limit_factoring' => 'Desired invoice factoring limit', - 'desired_credit_limit_loc' => 'Desired line of credit limit', - 'desired_credit_limit' => 'Desired credit limit', - 'bluevine_credit_line_type_required' => 'You must choose at least one', - 'bluevine_field_required' => 'This field is required', - 'bluevine_unexpected_error' => 'An unexpected error occurred.', - 'bluevine_no_conditional_offer' => 'More information is required before getting a quote. Click continue below.', - 'bluevine_invoice_factoring' => 'Invoice Factoring', - 'bluevine_conditional_offer' => 'Conditional Offer', - 'bluevine_credit_line_amount' => 'Credit Line', - 'bluevine_advance_rate' => 'Advance Rate', - 'bluevine_weekly_discount_rate' => 'Weekly Discount Rate', - 'bluevine_minimum_fee_rate' => 'Minimum Fee', - 'bluevine_line_of_credit' => 'Line of Credit', - 'bluevine_interest_rate' => 'Interest Rate', - 'bluevine_weekly_draw_rate' => 'Weekly Draw Rate', - 'bluevine_continue' => 'Continue to BlueVine', - 'bluevine_completed' => 'BlueVine signup completed', + 'bluevine_create_account' => 'Create an account', + 'quote_types' => 'Get a quote for', + 'invoice_factoring' => 'Invoice factoring', + 'line_of_credit' => 'Line of credit', + 'fico_score' => 'Your FICO score', + 'business_inception' => 'Business Inception Date', + 'average_bank_balance' => 'Average bank account balance', + 'annual_revenue' => 'Annual revenue', + 'desired_credit_limit_factoring' => 'Desired invoice factoring limit', + 'desired_credit_limit_loc' => 'Desired line of credit limit', + 'desired_credit_limit' => 'Desired credit limit', + 'bluevine_credit_line_type_required' => 'You must choose at least one', + 'bluevine_field_required' => 'This field is required', + 'bluevine_unexpected_error' => 'An unexpected error occurred.', + 'bluevine_no_conditional_offer' => 'More information is required before getting a quote. Click continue below.', + 'bluevine_invoice_factoring' => 'Invoice Factoring', + 'bluevine_conditional_offer' => 'Conditional Offer', + 'bluevine_credit_line_amount' => 'Credit Line', + 'bluevine_advance_rate' => 'Advance Rate', + 'bluevine_weekly_discount_rate' => 'Weekly Discount Rate', + 'bluevine_minimum_fee_rate' => 'Minimum Fee', + 'bluevine_line_of_credit' => 'Line of Credit', + 'bluevine_interest_rate' => 'Interest Rate', + 'bluevine_weekly_draw_rate' => 'Weekly Draw Rate', + 'bluevine_continue' => 'Continue to BlueVine', + 'bluevine_completed' => 'BlueVine signup completed', 'vendor_name' => 'Vendor', 'entity_state' => 'State', @@ -2129,16 +2129,16 @@ $LANG = array( 'reports_help' => 'Shift + Click to sort by multiple columns, Ctrl + Click to clear the grouping.', 'this_year' => 'This Year', - // Updated login screen - 'ninja_tagline' => 'Create. Send. Get Paid.', - 'login_or_existing' => 'Or login with a connected account.', - 'sign_up_now' => 'Sign Up Now', - 'not_a_member_yet' => 'Not a member yet?', - 'login_create_an_account' => 'Create an Account!', - 'client_login' => 'Client Login', + // Updated login screen + 'ninja_tagline' => 'Create. Send. Get Paid.', + 'login_or_existing' => 'Or login with a connected account.', + 'sign_up_now' => 'Sign Up Now', + 'not_a_member_yet' => 'Not a member yet?', + 'login_create_an_account' => 'Create an Account!', + 'client_login' => 'Client Login', - // New Client Portal styling - 'invoice_from' => 'Invoices From:', + // New Client Portal styling + 'invoice_from' => 'Invoices From:', 'email_alias_message' => 'We require each company to have a unique email address.
Consider using an alias. ie, email+label@example.com', 'full_name' => 'Full Name', 'month_year' => 'MONTH/YEAR', @@ -2433,7 +2433,7 @@ $LANG = array( 'tax1' => 'First Tax', 'tax2' => 'Second Tax', 'fee_help' => 'Gateway fees are the costs charged for access to the financial networks that handle the processing of online payments.', - 'format_export' => 'Exporting format', + 'format_export' => 'Exporting format', 'custom1' => 'First Custom', 'custom2' => 'Second Custom', 'contact_first_name' => 'Contact First Name', @@ -2870,5 +2870,3 @@ $LANG = array( ); return $LANG; - -?> diff --git a/resources/lang/es/texts.php b/resources/lang/es/texts.php index c1d3ad04e0..c93c1d7958 100644 --- a/resources/lang/es/texts.php +++ b/resources/lang/es/texts.php @@ -1961,37 +1961,37 @@ $LANG = array( 'authorization' => 'Autorización', 'signed' => 'Firmado', - // BlueVine - 'bluevine_promo' => 'Obtenga líneas de cŕedito flexibles y factoring de facturas usando BlueVine.', - 'bluevine_modal_label' => 'Inscríbase con BlueVine', - 'bluevine_modal_text' => '

Rápida financiación para su Negocio. Sin papeleo.

+ // BlueVine + 'bluevine_promo' => 'Obtenga líneas de cŕedito flexibles y factoring de facturas usando BlueVine.', + 'bluevine_modal_label' => 'Inscríbase con BlueVine', + 'bluevine_modal_text' => '

Rápida financiación para su Negocio. Sin papeleo.

  • Líneas de cŕedito flexibles y factoring.
', - 'bluevine_create_account' => 'Cree una cuenta', - 'quote_types' => 'Obtenga una cotización para', - 'invoice_factoring' => 'Factoring de facturas', - 'line_of_credit' => 'Línea de crédito', - 'fico_score' => 'Su puntuación FICO', - 'business_inception' => 'Fecha de Creación del Negocio', - 'average_bank_balance' => 'Promedio del saldo de la cuenta bancaria', - 'annual_revenue' => 'Ingresos anuales', - 'desired_credit_limit_factoring' => 'Límite de factoring de facturas deseado', - 'desired_credit_limit_loc' => 'Límite de línea de crédito deseado', - 'desired_credit_limit' => 'Límite de crédito deseado', - 'bluevine_credit_line_type_required' => 'Debe seleccionar al menos una', - 'bluevine_field_required' => 'Este campo es requerido', - 'bluevine_unexpected_error' => 'Un error inesperado ha ocurrido.', - 'bluevine_no_conditional_offer' => 'Más información es requerida para obtener una cotización. Haga clic en continuar a continuación.', - 'bluevine_invoice_factoring' => 'Factoring de facturas', - 'bluevine_conditional_offer' => 'Oferta Condicional', - 'bluevine_credit_line_amount' => 'Línea de Crédito', - 'bluevine_advance_rate' => 'Tasa Avanzada', - 'bluevine_weekly_discount_rate' => 'Tasa de Descuento Semanal', - 'bluevine_minimum_fee_rate' => 'Cuota Mínima', - 'bluevine_line_of_credit' => 'Línea de Crédito ', - 'bluevine_interest_rate' => 'Tasa de Interéz', - 'bluevine_weekly_draw_rate' => 'Tasa de Retiro Semanal', - 'bluevine_continue' => 'Continúe a BlueVine', - 'bluevine_completed' => 'Inscripción en BlueVine completa', + 'bluevine_create_account' => 'Cree una cuenta', + 'quote_types' => 'Obtenga una cotización para', + 'invoice_factoring' => 'Factoring de facturas', + 'line_of_credit' => 'Línea de crédito', + 'fico_score' => 'Su puntuación FICO', + 'business_inception' => 'Fecha de Creación del Negocio', + 'average_bank_balance' => 'Promedio del saldo de la cuenta bancaria', + 'annual_revenue' => 'Ingresos anuales', + 'desired_credit_limit_factoring' => 'Límite de factoring de facturas deseado', + 'desired_credit_limit_loc' => 'Límite de línea de crédito deseado', + 'desired_credit_limit' => 'Límite de crédito deseado', + 'bluevine_credit_line_type_required' => 'Debe seleccionar al menos una', + 'bluevine_field_required' => 'Este campo es requerido', + 'bluevine_unexpected_error' => 'Un error inesperado ha ocurrido.', + 'bluevine_no_conditional_offer' => 'Más información es requerida para obtener una cotización. Haga clic en continuar a continuación.', + 'bluevine_invoice_factoring' => 'Factoring de facturas', + 'bluevine_conditional_offer' => 'Oferta Condicional', + 'bluevine_credit_line_amount' => 'Línea de Crédito', + 'bluevine_advance_rate' => 'Tasa Avanzada', + 'bluevine_weekly_discount_rate' => 'Tasa de Descuento Semanal', + 'bluevine_minimum_fee_rate' => 'Cuota Mínima', + 'bluevine_line_of_credit' => 'Línea de Crédito ', + 'bluevine_interest_rate' => 'Tasa de Interéz', + 'bluevine_weekly_draw_rate' => 'Tasa de Retiro Semanal', + 'bluevine_continue' => 'Continúe a BlueVine', + 'bluevine_completed' => 'Inscripción en BlueVine completa', 'vendor_name' => 'Vendedor', 'entity_state' => 'Estado', @@ -2125,16 +2125,16 @@ $LANG = array( 'reports_help' => 'Shift + Click para ordenar por múltiples columnas, Ctrl + Click para desactivar la agrupación.', 'this_year' => 'Este Año', - // Updated login screen - 'ninja_tagline' => 'Crear. Enviar. Recibir Pago.', - 'login_or_existing' => 'O ingrese con una cuenta conectada.', - 'sign_up_now' => 'Cree Una Cuenta Ahora', - 'not_a_member_yet' => 'Aún no tiene una cuenta?', - 'login_create_an_account' => 'Crear una Cuenta!', - 'client_login' => 'Inicio de Sesión del Cliente', + // Updated login screen + 'ninja_tagline' => 'Crear. Enviar. Recibir Pago.', + 'login_or_existing' => 'O ingrese con una cuenta conectada.', + 'sign_up_now' => 'Cree Una Cuenta Ahora', + 'not_a_member_yet' => 'Aún no tiene una cuenta?', + 'login_create_an_account' => 'Crear una Cuenta!', + 'client_login' => 'Inicio de Sesión del Cliente', - // New Client Portal styling - 'invoice_from' => 'Facturas de:', + // New Client Portal styling + 'invoice_from' => 'Facturas de:', 'email_alias_message' => 'Requerimos que cada compañía tenga una dirección de correo electrónico única
Considera usar un alias ej, email+label@example.com', 'full_name' => 'Nombre Completo', 'month_year' => 'MES/AÑO', @@ -2429,7 +2429,7 @@ $LANG = array( 'tax1' => 'Primera Impuesto', 'tax2' => 'Segundo Impuesto', 'fee_help' => 'Las tarifas de Pasarela de Pago son los costos que se cobran por el acceso a las redes financieras que manejan el procesamiento de pagos en línea.', - 'format_export' => 'Exportando formato', + 'format_export' => 'Exportando formato', 'custom1' => 'First Custom', 'custom2' => 'Second Custom', 'contact_first_name' => 'Primer Nombre de Contacto', @@ -2866,5 +2866,3 @@ $LANG = array( ); return $LANG; - -?> diff --git a/resources/lang/es_ES/texts.php b/resources/lang/es_ES/texts.php index 69671c29f6..bdd4fabfde 100644 --- a/resources/lang/es_ES/texts.php +++ b/resources/lang/es_ES/texts.php @@ -1953,37 +1953,37 @@ Una vez que tenga los montos, vuelva a esta página de métodos de pago y haga c 'authorization' => 'Autorización', 'signed' => 'Frimado', - // BlueVine - 'bluevine_promo' => 'Obtenga líneas de crédito comerciales flexibles y factoraje de facturas usando BlueVine.', - 'bluevine_modal_label' => 'Registrarse con BlueVine', - 'bluevine_modal_text' => '

Financiamiento rápido para su negocio. Sin papeleo

+ // BlueVine + 'bluevine_promo' => 'Obtenga líneas de crédito comerciales flexibles y factoraje de facturas usando BlueVine.', + 'bluevine_modal_label' => 'Registrarse con BlueVine', + 'bluevine_modal_text' => '

Financiamiento rápido para su negocio. Sin papeleo

  • Líneas de crédito flexibles y factoraje de facturas.
', - 'bluevine_create_account' => 'Crea una cuenta', - 'quote_types' => 'Obtenga un presupuesto para', - 'invoice_factoring' => 'Factorización de facturas', - 'line_of_credit' => 'Línea de crédito', - 'fico_score' => 'Su puntuación FICO', - 'business_inception' => 'Fecha de inicio del negocio', - 'average_bank_balance' => 'Saldo promedio de la cuenta bancaria', - 'annual_revenue' => 'Ingresos anuales', - 'desired_credit_limit_factoring' => 'Límite deseado de factorización de factura', - 'desired_credit_limit_loc' => 'Límite deseado de línea de crédito ', - 'desired_credit_limit' => 'Límite deseado de crédito ', - 'bluevine_credit_line_type_required' => 'Debe elegir al menos uno', - 'bluevine_field_required' => 'Este campo es obligatorio', - 'bluevine_unexpected_error' => 'Ocurrió un error inesperado.', - 'bluevine_no_conditional_offer' => 'Se requiere más información antes de obtener un presupuesto . Haga clic en continuar', - 'bluevine_invoice_factoring' => 'Factorización de Facturas', - 'bluevine_conditional_offer' => 'Oferta Condicional', - 'bluevine_credit_line_amount' => 'Línea de Crédito', - 'bluevine_advance_rate' => 'Tasa de avance', - 'bluevine_weekly_discount_rate' => 'Tasa de descuento semanal', - 'bluevine_minimum_fee_rate' => 'Tarifa mínima', - 'bluevine_line_of_credit' => 'Línea de crédito', - 'bluevine_interest_rate' => 'Tasa de interés', - 'bluevine_weekly_draw_rate' => 'Tasa de Sorteo semanal', - 'bluevine_continue' => 'Ir a BlueVine', - 'bluevine_completed' => 'Registro en BlueVine completado', + 'bluevine_create_account' => 'Crea una cuenta', + 'quote_types' => 'Obtenga un presupuesto para', + 'invoice_factoring' => 'Factorización de facturas', + 'line_of_credit' => 'Línea de crédito', + 'fico_score' => 'Su puntuación FICO', + 'business_inception' => 'Fecha de inicio del negocio', + 'average_bank_balance' => 'Saldo promedio de la cuenta bancaria', + 'annual_revenue' => 'Ingresos anuales', + 'desired_credit_limit_factoring' => 'Límite deseado de factorización de factura', + 'desired_credit_limit_loc' => 'Límite deseado de línea de crédito ', + 'desired_credit_limit' => 'Límite deseado de crédito ', + 'bluevine_credit_line_type_required' => 'Debe elegir al menos uno', + 'bluevine_field_required' => 'Este campo es obligatorio', + 'bluevine_unexpected_error' => 'Ocurrió un error inesperado.', + 'bluevine_no_conditional_offer' => 'Se requiere más información antes de obtener un presupuesto . Haga clic en continuar', + 'bluevine_invoice_factoring' => 'Factorización de Facturas', + 'bluevine_conditional_offer' => 'Oferta Condicional', + 'bluevine_credit_line_amount' => 'Línea de Crédito', + 'bluevine_advance_rate' => 'Tasa de avance', + 'bluevine_weekly_discount_rate' => 'Tasa de descuento semanal', + 'bluevine_minimum_fee_rate' => 'Tarifa mínima', + 'bluevine_line_of_credit' => 'Línea de crédito', + 'bluevine_interest_rate' => 'Tasa de interés', + 'bluevine_weekly_draw_rate' => 'Tasa de Sorteo semanal', + 'bluevine_continue' => 'Ir a BlueVine', + 'bluevine_completed' => 'Registro en BlueVine completado', 'vendor_name' => 'Proveedor', 'entity_state' => 'Estado', @@ -2117,16 +2117,16 @@ Una vez que tenga los montos, vuelva a esta página de métodos de pago y haga c 'reports_help' => 'May + Click para ordenar por múltiples columnas, Ctrl + click para quitar agrupamiento.', 'this_year' => 'Este Año', - // Updated login screen - 'ninja_tagline' => 'Crea. Envia. Recibe tus Pagos.', - 'login_or_existing' => 'O inicie sesión con una cuenta existente.', - 'sign_up_now' => 'Registrarse Ahora', - 'not_a_member_yet' => '¿No eres miembro todavía?', - 'login_create_an_account' => 'Crea una Cuenta!', - 'client_login' => 'Acceso de Clientes', + // Updated login screen + 'ninja_tagline' => 'Crea. Envia. Recibe tus Pagos.', + 'login_or_existing' => 'O inicie sesión con una cuenta existente.', + 'sign_up_now' => 'Registrarse Ahora', + 'not_a_member_yet' => '¿No eres miembro todavía?', + 'login_create_an_account' => 'Crea una Cuenta!', + 'client_login' => 'Acceso de Clientes', - // New Client Portal styling - 'invoice_from' => 'Facturas desde:', + // New Client Portal styling + 'invoice_from' => 'Facturas desde:', 'email_alias_message' => 'Requerimos que cada compañía tenga una dirección de correo electrónico única.
Considere el uso de un alias. es decir, email+label@example.com', 'full_name' => 'Nombre completo', 'month_year' => 'MES/AÑO', @@ -2421,7 +2421,7 @@ Una vez que tenga los montos, vuelva a esta página de métodos de pago y haga c 'tax1' => 'Primer impuesto', 'tax2' => 'Segundo impuesto', 'fee_help' => 'Las tarifas de Gateway son los costos que se cobran por el acceso a las redes financieras que manejan el procesamiento de pagos en línea.', - 'format_export' => 'Formato de exportación', + 'format_export' => 'Formato de exportación', 'custom1' => 'Primera personalización', 'custom2' => 'Segunda personalización', 'contact_first_name' => 'Nombre del Contacto', @@ -2858,5 +2858,3 @@ Una vez que tenga los montos, vuelva a esta página de métodos de pago y haga c ); return $LANG; - -?> diff --git a/resources/lang/fi/texts.php b/resources/lang/fi/texts.php index 1e71bfcc87..e5e9be1986 100644 --- a/resources/lang/fi/texts.php +++ b/resources/lang/fi/texts.php @@ -1965,37 +1965,37 @@ Lasku poistettiin (if only one, alternative)', 'authorization' => 'Authorization', 'signed' => 'Signed', - // BlueVine - 'bluevine_promo' => 'Get flexible business lines of credit and invoice factoring using BlueVine.', - 'bluevine_modal_label' => 'Sign up with BlueVine', - 'bluevine_modal_text' => '

Fast funding for your business. No paperwork.

+ // BlueVine + 'bluevine_promo' => 'Get flexible business lines of credit and invoice factoring using BlueVine.', + 'bluevine_modal_label' => 'Sign up with BlueVine', + 'bluevine_modal_text' => '

Fast funding for your business. No paperwork.

  • Flexible business lines of credit and invoice factoring.
', - 'bluevine_create_account' => 'Create an account', - 'quote_types' => 'Get a quote for', - 'invoice_factoring' => 'Invoice factoring', - 'line_of_credit' => 'Line of credit', - 'fico_score' => 'Your FICO score', - 'business_inception' => 'Business Inception Date', - 'average_bank_balance' => 'Average bank account balance', - 'annual_revenue' => 'Annual revenue', - 'desired_credit_limit_factoring' => 'Desired invoice factoring limit', - 'desired_credit_limit_loc' => 'Desired line of credit limit', - 'desired_credit_limit' => 'Desired credit limit', - 'bluevine_credit_line_type_required' => 'You must choose at least one', - 'bluevine_field_required' => 'This field is required', - 'bluevine_unexpected_error' => 'An unexpected error occurred.', - 'bluevine_no_conditional_offer' => 'More information is required before getting a quote. Click continue below.', - 'bluevine_invoice_factoring' => 'Invoice Factoring', - 'bluevine_conditional_offer' => 'Conditional Offer', - 'bluevine_credit_line_amount' => 'Credit Line', - 'bluevine_advance_rate' => 'Advance Rate', - 'bluevine_weekly_discount_rate' => 'Weekly Discount Rate', - 'bluevine_minimum_fee_rate' => 'Minimum Fee', - 'bluevine_line_of_credit' => 'Line of Credit', - 'bluevine_interest_rate' => 'Interest Rate', - 'bluevine_weekly_draw_rate' => 'Weekly Draw Rate', - 'bluevine_continue' => 'Continue to BlueVine', - 'bluevine_completed' => 'BlueVine signup completed', + 'bluevine_create_account' => 'Create an account', + 'quote_types' => 'Get a quote for', + 'invoice_factoring' => 'Invoice factoring', + 'line_of_credit' => 'Line of credit', + 'fico_score' => 'Your FICO score', + 'business_inception' => 'Business Inception Date', + 'average_bank_balance' => 'Average bank account balance', + 'annual_revenue' => 'Annual revenue', + 'desired_credit_limit_factoring' => 'Desired invoice factoring limit', + 'desired_credit_limit_loc' => 'Desired line of credit limit', + 'desired_credit_limit' => 'Desired credit limit', + 'bluevine_credit_line_type_required' => 'You must choose at least one', + 'bluevine_field_required' => 'This field is required', + 'bluevine_unexpected_error' => 'An unexpected error occurred.', + 'bluevine_no_conditional_offer' => 'More information is required before getting a quote. Click continue below.', + 'bluevine_invoice_factoring' => 'Invoice Factoring', + 'bluevine_conditional_offer' => 'Conditional Offer', + 'bluevine_credit_line_amount' => 'Credit Line', + 'bluevine_advance_rate' => 'Advance Rate', + 'bluevine_weekly_discount_rate' => 'Weekly Discount Rate', + 'bluevine_minimum_fee_rate' => 'Minimum Fee', + 'bluevine_line_of_credit' => 'Line of Credit', + 'bluevine_interest_rate' => 'Interest Rate', + 'bluevine_weekly_draw_rate' => 'Weekly Draw Rate', + 'bluevine_continue' => 'Continue to BlueVine', + 'bluevine_completed' => 'BlueVine signup completed', 'vendor_name' => 'Vendor', 'entity_state' => 'State', @@ -2129,16 +2129,16 @@ Lasku poistettiin (if only one, alternative)', 'reports_help' => 'Shift + Click to sort by multiple columns, Ctrl + Click to clear the grouping.', 'this_year' => 'This Year', - // Updated login screen - 'ninja_tagline' => 'Create. Send. Get Paid.', - 'login_or_existing' => 'Or login with a connected account.', - 'sign_up_now' => 'Sign Up Now', - 'not_a_member_yet' => 'Not a member yet?', - 'login_create_an_account' => 'Create an Account!', - 'client_login' => 'Client Login', + // Updated login screen + 'ninja_tagline' => 'Create. Send. Get Paid.', + 'login_or_existing' => 'Or login with a connected account.', + 'sign_up_now' => 'Sign Up Now', + 'not_a_member_yet' => 'Not a member yet?', + 'login_create_an_account' => 'Create an Account!', + 'client_login' => 'Client Login', - // New Client Portal styling - 'invoice_from' => 'Invoices From:', + // New Client Portal styling + 'invoice_from' => 'Invoices From:', 'email_alias_message' => 'We require each company to have a unique email address.
Consider using an alias. ie, email+label@example.com', 'full_name' => 'Full Name', 'month_year' => 'MONTH/YEAR', @@ -2433,7 +2433,7 @@ Lasku poistettiin (if only one, alternative)', 'tax1' => 'First Tax', 'tax2' => 'Second Tax', 'fee_help' => 'Gateway fees are the costs charged for access to the financial networks that handle the processing of online payments.', - 'format_export' => 'Exporting format', + 'format_export' => 'Exporting format', 'custom1' => 'First Custom', 'custom2' => 'Second Custom', 'contact_first_name' => 'Contact First Name', @@ -2870,5 +2870,3 @@ Lasku poistettiin (if only one, alternative)', ); return $LANG; - -?> diff --git a/resources/lang/fr/texts.php b/resources/lang/fr/texts.php index 91e83b5746..a9f560f7df 100644 --- a/resources/lang/fr/texts.php +++ b/resources/lang/fr/texts.php @@ -1957,37 +1957,37 @@ Lorsque les montant apparaîtront sur votre relevé, veuillez revenir sur cette 'authorization' => 'Autorisation', 'signed' => 'Signé', - // BlueVine - 'bluevine_promo' => 'Obtenez des marges de crédit et d\'affacturages d\'affaires flexible en utilisant BlueVine.', - 'bluevine_modal_label' => 'Inscrivez-vous avec BlueVineInscrivez-vous avec BlueVine', - 'bluevine_modal_text' => '

Finacement rapide pour votre entreprise. Pas de paperasse.

+ // BlueVine + 'bluevine_promo' => 'Obtenez des marges de crédit et d\'affacturages d\'affaires flexible en utilisant BlueVine.', + 'bluevine_modal_label' => 'Inscrivez-vous avec BlueVineInscrivez-vous avec BlueVine', + 'bluevine_modal_text' => '

Finacement rapide pour votre entreprise. Pas de paperasse.

  • Marges de crédit et affacturage d\'affaires flexibles.
', - 'bluevine_create_account' => 'Créer un compte', - 'quote_types' => 'Obtenir une offre pour', - 'invoice_factoring' => 'Affacturage', - 'line_of_credit' => 'Ligne de crédit', - 'fico_score' => 'Votre pointage de crédit', - 'business_inception' => 'Date de création de l\'entreprise', - 'average_bank_balance' => 'Solde moyen du compte bancaire', - 'annual_revenue' => 'Revenu annuel', - 'desired_credit_limit_factoring' => 'Affacturage désiré', - 'desired_credit_limit_loc' => 'Ligne de crédit désirée', - 'desired_credit_limit' => 'Limite de crédit désirée', - 'bluevine_credit_line_type_required' => 'Faites au moins un choix', - 'bluevine_field_required' => 'Ce champs est requis', - 'bluevine_unexpected_error' => 'Une erreur inattendue s\'est produite.', - 'bluevine_no_conditional_offer' => 'Vous devez fournir plus d\'information afin d\'obtenir une offre. Veuillez cliquer sur continuer ci-dessous.', - 'bluevine_invoice_factoring' => 'Affacturage', - 'bluevine_conditional_offer' => 'Offre conditionnelle', - 'bluevine_credit_line_amount' => 'Ligne de crédit', - 'bluevine_advance_rate' => 'Taux de l\'accompte', - 'bluevine_weekly_discount_rate' => 'Taux de remise hebdomadaire', - 'bluevine_minimum_fee_rate' => 'Frais minimaux', - 'bluevine_line_of_credit' => 'Ligne de crédit', - 'bluevine_interest_rate' => 'Taux d\'intérêts', - 'bluevine_weekly_draw_rate' => 'Taux hebdomadaire de retrait', - 'bluevine_continue' => 'Continuer vers BlueVine', - 'bluevine_completed' => 'Inscription avec BlueVine complétée', + 'bluevine_create_account' => 'Créer un compte', + 'quote_types' => 'Obtenir une offre pour', + 'invoice_factoring' => 'Affacturage', + 'line_of_credit' => 'Ligne de crédit', + 'fico_score' => 'Votre pointage de crédit', + 'business_inception' => 'Date de création de l\'entreprise', + 'average_bank_balance' => 'Solde moyen du compte bancaire', + 'annual_revenue' => 'Revenu annuel', + 'desired_credit_limit_factoring' => 'Affacturage désiré', + 'desired_credit_limit_loc' => 'Ligne de crédit désirée', + 'desired_credit_limit' => 'Limite de crédit désirée', + 'bluevine_credit_line_type_required' => 'Faites au moins un choix', + 'bluevine_field_required' => 'Ce champs est requis', + 'bluevine_unexpected_error' => 'Une erreur inattendue s\'est produite.', + 'bluevine_no_conditional_offer' => 'Vous devez fournir plus d\'information afin d\'obtenir une offre. Veuillez cliquer sur continuer ci-dessous.', + 'bluevine_invoice_factoring' => 'Affacturage', + 'bluevine_conditional_offer' => 'Offre conditionnelle', + 'bluevine_credit_line_amount' => 'Ligne de crédit', + 'bluevine_advance_rate' => 'Taux de l\'accompte', + 'bluevine_weekly_discount_rate' => 'Taux de remise hebdomadaire', + 'bluevine_minimum_fee_rate' => 'Frais minimaux', + 'bluevine_line_of_credit' => 'Ligne de crédit', + 'bluevine_interest_rate' => 'Taux d\'intérêts', + 'bluevine_weekly_draw_rate' => 'Taux hebdomadaire de retrait', + 'bluevine_continue' => 'Continuer vers BlueVine', + 'bluevine_completed' => 'Inscription avec BlueVine complétée', 'vendor_name' => 'Fournisseur', 'entity_state' => 'État', @@ -2121,16 +2121,16 @@ Lorsque les montant apparaîtront sur votre relevé, veuillez revenir sur cette 'reports_help' => 'Shift + Click to sort by multiple columns, Ctrl + Click to clear the grouping.', 'this_year' => 'Cette année', - // Updated login screen - 'ninja_tagline' => 'Créer. Envoyer. Être payé.', - 'login_or_existing' => 'Ou se connecter avec un compte connecté.', - 'sign_up_now' => 'Inscrivez-vous maintenant', - 'not_a_member_yet' => 'Pas encore membre ?', - 'login_create_an_account' => 'Créez un compte !', - 'client_login' => 'Connexion client', + // Updated login screen + 'ninja_tagline' => 'Créer. Envoyer. Être payé.', + 'login_or_existing' => 'Ou se connecter avec un compte connecté.', + 'sign_up_now' => 'Inscrivez-vous maintenant', + 'not_a_member_yet' => 'Pas encore membre ?', + 'login_create_an_account' => 'Créez un compte !', + 'client_login' => 'Connexion client', - // New Client Portal styling - 'invoice_from' => 'Factures de :', + // New Client Portal styling + 'invoice_from' => 'Factures de :', 'email_alias_message' => 'Chaque société doit avoir une adresse email unique.
Envisagez d\'utiliser un alias. ie, email+label@example.com', 'full_name' => 'Nom complet', 'month_year' => 'MOIS/ANNEE', @@ -2425,7 +2425,7 @@ Lorsque les montant apparaîtront sur votre relevé, veuillez revenir sur cette 'tax1' => 'Première taxe', 'tax2' => 'Seconde taxe', 'fee_help' => 'Gateway fees are the costs charged for access to the financial networks that handle the processing of online payments.', - 'format_export' => 'Format d\'exportation', + 'format_export' => 'Format d\'exportation', 'custom1' => 'Personnalisé1', 'custom2' => 'Personnalisé2', 'contact_first_name' => 'Prénom du contact', @@ -2862,5 +2862,3 @@ Lorsque les montant apparaîtront sur votre relevé, veuillez revenir sur cette ); return $LANG; - -?> diff --git a/resources/lang/fr_CA/texts.php b/resources/lang/fr_CA/texts.php index 80aad58c9d..3a4754eac8 100644 --- a/resources/lang/fr_CA/texts.php +++ b/resources/lang/fr_CA/texts.php @@ -1954,37 +1954,37 @@ Lorsque les montant apparaîtront sur votre relevé, veuillez revenir sur cette 'authorization' => 'Autorisation', 'signed' => 'Signé', - // BlueVine - 'bluevine_promo' => 'Obtenez des marges de crédit et d\'affacturages d\'affaires flexible en utilisant BlueVIne.', - 'bluevine_modal_label' => 'Inscrivez-vous avec BlueVine', - 'bluevine_modal_text' => '

Financement rapide pour votre entreprise. Pas de paperasse.

+ // BlueVine + 'bluevine_promo' => 'Obtenez des marges de crédit et d\'affacturages d\'affaires flexible en utilisant BlueVIne.', + 'bluevine_modal_label' => 'Inscrivez-vous avec BlueVine', + 'bluevine_modal_text' => '

Financement rapide pour votre entreprise. Pas de paperasse.

  • Marges de crédit et affacturage d\'affaires flexibles.
', - 'bluevine_create_account' => 'Créer un compte', - 'quote_types' => 'Obtenir une soumission pour', - 'invoice_factoring' => 'Affacturage', - 'line_of_credit' => 'Marge de crédit', - 'fico_score' => 'Votre pointage de crédit', - 'business_inception' => 'Date de création de l\'entreprise', - 'average_bank_balance' => 'Solde moyen de compte bancaire', - 'annual_revenue' => 'Revenu annuel', - 'desired_credit_limit_factoring' => 'Affacturage désiré', - 'desired_credit_limit_loc' => 'Marge de crédit désirée', - 'desired_credit_limit' => 'Limite de crédit désirée', - 'bluevine_credit_line_type_required' => 'Faites au moins un choix', - 'bluevine_field_required' => 'Ce champs est requis', - 'bluevine_unexpected_error' => 'Une erreur inattendue s\'est produite.', - 'bluevine_no_conditional_offer' => 'Vous devez fournir plus d\'information afin d\'obtenir une soumission. Veuillez cliquer ci-dessous.', - 'bluevine_invoice_factoring' => 'Affacturage', - 'bluevine_conditional_offer' => 'Offre conditionnelle', - 'bluevine_credit_line_amount' => 'Marge de crédit', - 'bluevine_advance_rate' => 'Taux de l\'accompte', - 'bluevine_weekly_discount_rate' => 'Taux de remise hebdomadaire', - 'bluevine_minimum_fee_rate' => 'Frais minimaux', - 'bluevine_line_of_credit' => 'Marge de crédit', - 'bluevine_interest_rate' => 'Taux d\'intérêt', - 'bluevine_weekly_draw_rate' => 'Taux hebdomadaire de retrait', - 'bluevine_continue' => 'Continuer vers BlueVine', - 'bluevine_completed' => 'Inscription complètée avec BlueVIne', + 'bluevine_create_account' => 'Créer un compte', + 'quote_types' => 'Obtenir une soumission pour', + 'invoice_factoring' => 'Affacturage', + 'line_of_credit' => 'Marge de crédit', + 'fico_score' => 'Votre pointage de crédit', + 'business_inception' => 'Date de création de l\'entreprise', + 'average_bank_balance' => 'Solde moyen de compte bancaire', + 'annual_revenue' => 'Revenu annuel', + 'desired_credit_limit_factoring' => 'Affacturage désiré', + 'desired_credit_limit_loc' => 'Marge de crédit désirée', + 'desired_credit_limit' => 'Limite de crédit désirée', + 'bluevine_credit_line_type_required' => 'Faites au moins un choix', + 'bluevine_field_required' => 'Ce champs est requis', + 'bluevine_unexpected_error' => 'Une erreur inattendue s\'est produite.', + 'bluevine_no_conditional_offer' => 'Vous devez fournir plus d\'information afin d\'obtenir une soumission. Veuillez cliquer ci-dessous.', + 'bluevine_invoice_factoring' => 'Affacturage', + 'bluevine_conditional_offer' => 'Offre conditionnelle', + 'bluevine_credit_line_amount' => 'Marge de crédit', + 'bluevine_advance_rate' => 'Taux de l\'accompte', + 'bluevine_weekly_discount_rate' => 'Taux de remise hebdomadaire', + 'bluevine_minimum_fee_rate' => 'Frais minimaux', + 'bluevine_line_of_credit' => 'Marge de crédit', + 'bluevine_interest_rate' => 'Taux d\'intérêt', + 'bluevine_weekly_draw_rate' => 'Taux hebdomadaire de retrait', + 'bluevine_continue' => 'Continuer vers BlueVine', + 'bluevine_completed' => 'Inscription complètée avec BlueVIne', 'vendor_name' => 'Fournisseur', 'entity_state' => 'Province', @@ -2118,16 +2118,16 @@ Lorsque les montant apparaîtront sur votre relevé, veuillez revenir sur cette 'reports_help' => 'MAJ + Clic pour filtrer plusieurs colonnes. CRTL + Clic pour annuler le groupement.', 'this_year' => 'Cette année', - // Updated login screen - 'ninja_tagline' => 'Créer, envoyer et encaissez.', - 'login_or_existing' => 'Ou connectez-vous avec un compte connecté.', - 'sign_up_now' => 'Inscrivez-vous maintenant', - 'not_a_member_yet' => 'Pas encore membre?', - 'login_create_an_account' => 'Créer un compte', - 'client_login' => 'Connexion client', + // Updated login screen + 'ninja_tagline' => 'Créer, envoyer et encaissez.', + 'login_or_existing' => 'Ou connectez-vous avec un compte connecté.', + 'sign_up_now' => 'Inscrivez-vous maintenant', + 'not_a_member_yet' => 'Pas encore membre?', + 'login_create_an_account' => 'Créer un compte', + 'client_login' => 'Connexion client', - // New Client Portal styling - 'invoice_from' => 'Factures de:', + // New Client Portal styling + 'invoice_from' => 'Factures de:', 'email_alias_message' => 'Chaque entreprise doit avoir une adresse courriel unique.
Vous pouvez utiliser un alias, ex. email+label@example.com', 'full_name' => 'Nom complet', @@ -2423,7 +2423,7 @@ Lorsque les montant apparaîtront sur votre relevé, veuillez revenir sur cette 'tax1' => 'Première taxe', 'tax2' => 'Deuxième taxe', 'fee_help' => 'Les frais de la passerelle sont les coûts facturés pour l\'accès aux réseaux financiers qui traitent le traitement des paiements en ligne.', - 'format_export' => 'Format d\'exportation', + 'format_export' => 'Format d\'exportation', 'custom1' => 'Personnalisation 1', 'custom2' => 'Personnalisation 2', 'contact_first_name' => 'Prénom du contact', @@ -2860,5 +2860,3 @@ Lorsque les montant apparaîtront sur votre relevé, veuillez revenir sur cette ); return $LANG; - -?> diff --git a/resources/lang/hr/texts.php b/resources/lang/hr/texts.php index c4ec385630..6a15fe84ee 100644 --- a/resources/lang/hr/texts.php +++ b/resources/lang/hr/texts.php @@ -1964,37 +1964,37 @@ Nevažeći kontakt email', 'authorization' => 'Authorization', 'signed' => 'Signed', - // BlueVine - 'bluevine_promo' => 'Get flexible business lines of credit and invoice factoring using BlueVine.', - 'bluevine_modal_label' => 'Sign up with BlueVine', - 'bluevine_modal_text' => '

Fast funding for your business. No paperwork.

+ // BlueVine + 'bluevine_promo' => 'Get flexible business lines of credit and invoice factoring using BlueVine.', + 'bluevine_modal_label' => 'Sign up with BlueVine', + 'bluevine_modal_text' => '

Fast funding for your business. No paperwork.

  • Flexible business lines of credit and invoice factoring.
', - 'bluevine_create_account' => 'Create an account', - 'quote_types' => 'Get a quote for', - 'invoice_factoring' => 'Invoice factoring', - 'line_of_credit' => 'Line of credit', - 'fico_score' => 'Your FICO score', - 'business_inception' => 'Business Inception Date', - 'average_bank_balance' => 'Prosječno stanje na računu banke', - 'annual_revenue' => 'Annual revenue', - 'desired_credit_limit_factoring' => 'Desired invoice factoring limit', - 'desired_credit_limit_loc' => 'Desired line of credit limit', - 'desired_credit_limit' => 'Desired credit limit', - 'bluevine_credit_line_type_required' => 'You must choose at least one', - 'bluevine_field_required' => 'This field is required', - 'bluevine_unexpected_error' => 'An unexpected error occurred.', - 'bluevine_no_conditional_offer' => 'More information is required before getting a quote. Click continue below.', - 'bluevine_invoice_factoring' => 'Invoice Factoring', - 'bluevine_conditional_offer' => 'Conditional Offer', - 'bluevine_credit_line_amount' => 'Credit Line', - 'bluevine_advance_rate' => 'Advance Rate', - 'bluevine_weekly_discount_rate' => 'Weekly Discount Rate', - 'bluevine_minimum_fee_rate' => 'Minimum Fee', - 'bluevine_line_of_credit' => 'Line of Credit', - 'bluevine_interest_rate' => 'Interest Rate', - 'bluevine_weekly_draw_rate' => 'Weekly Draw Rate', - 'bluevine_continue' => 'Continue to BlueVine', - 'bluevine_completed' => 'BlueVine signup completed', + 'bluevine_create_account' => 'Create an account', + 'quote_types' => 'Get a quote for', + 'invoice_factoring' => 'Invoice factoring', + 'line_of_credit' => 'Line of credit', + 'fico_score' => 'Your FICO score', + 'business_inception' => 'Business Inception Date', + 'average_bank_balance' => 'Prosječno stanje na računu banke', + 'annual_revenue' => 'Annual revenue', + 'desired_credit_limit_factoring' => 'Desired invoice factoring limit', + 'desired_credit_limit_loc' => 'Desired line of credit limit', + 'desired_credit_limit' => 'Desired credit limit', + 'bluevine_credit_line_type_required' => 'You must choose at least one', + 'bluevine_field_required' => 'This field is required', + 'bluevine_unexpected_error' => 'An unexpected error occurred.', + 'bluevine_no_conditional_offer' => 'More information is required before getting a quote. Click continue below.', + 'bluevine_invoice_factoring' => 'Invoice Factoring', + 'bluevine_conditional_offer' => 'Conditional Offer', + 'bluevine_credit_line_amount' => 'Credit Line', + 'bluevine_advance_rate' => 'Advance Rate', + 'bluevine_weekly_discount_rate' => 'Weekly Discount Rate', + 'bluevine_minimum_fee_rate' => 'Minimum Fee', + 'bluevine_line_of_credit' => 'Line of Credit', + 'bluevine_interest_rate' => 'Interest Rate', + 'bluevine_weekly_draw_rate' => 'Weekly Draw Rate', + 'bluevine_continue' => 'Continue to BlueVine', + 'bluevine_completed' => 'BlueVine signup completed', 'vendor_name' => 'Dobavljač', 'entity_state' => 'Kanton', @@ -2128,16 +2128,16 @@ Nevažeći kontakt email', 'reports_help' => 'Shift + Click to sort by multiple columns, Ctrl + Click to clear the grouping.', 'this_year' => 'Ova godina', - // Updated login screen - 'ninja_tagline' => 'Create. Send. Get Paid.', - 'login_or_existing' => 'Or login with a connected account.', - 'sign_up_now' => 'Sign Up Now', - 'not_a_member_yet' => 'Not a member yet?', - 'login_create_an_account' => 'Create an Account!', - 'client_login' => 'Client Login', + // Updated login screen + 'ninja_tagline' => 'Create. Send. Get Paid.', + 'login_or_existing' => 'Or login with a connected account.', + 'sign_up_now' => 'Sign Up Now', + 'not_a_member_yet' => 'Not a member yet?', + 'login_create_an_account' => 'Create an Account!', + 'client_login' => 'Client Login', - // New Client Portal styling - 'invoice_from' => 'Invoices From:', + // New Client Portal styling + 'invoice_from' => 'Invoices From:', 'email_alias_message' => 'We require each company to have a unique email address.
Consider using an alias. ie, email+label@example.com', 'full_name' => 'Full Name', 'month_year' => 'MONTH/YEAR', @@ -2432,7 +2432,7 @@ Nevažeći kontakt email', 'tax1' => 'First Tax', 'tax2' => 'Second Tax', 'fee_help' => 'Gateway fees are the costs charged for access to the financial networks that handle the processing of online payments.', - 'format_export' => 'Exporting format', + 'format_export' => 'Exporting format', 'custom1' => 'First Custom', 'custom2' => 'Second Custom', 'contact_first_name' => 'Contact First Name', @@ -2869,5 +2869,3 @@ Nevažeći kontakt email', ); return $LANG; - -?> diff --git a/resources/lang/it/texts.php b/resources/lang/it/texts.php index db85f2891e..6b64efd0f0 100644 --- a/resources/lang/it/texts.php +++ b/resources/lang/it/texts.php @@ -1956,37 +1956,37 @@ $LANG = array( 'authorization' => 'Autorizzazione', 'signed' => 'Firmato', - // BlueVine - 'bluevine_promo' => 'Get flexible business lines of credit and invoice factoring using BlueVine.', - 'bluevine_modal_label' => 'Sign up with BlueVine', - 'bluevine_modal_text' => '

Fast funding for your business. No paperwork.

+ // BlueVine + 'bluevine_promo' => 'Get flexible business lines of credit and invoice factoring using BlueVine.', + 'bluevine_modal_label' => 'Sign up with BlueVine', + 'bluevine_modal_text' => '

Fast funding for your business. No paperwork.

  • Flexible business lines of credit and invoice factoring.
', - 'bluevine_create_account' => 'Crea un account', - 'quote_types' => 'Ricevi un preventivo per', - 'invoice_factoring' => 'Invoice factoring', - 'line_of_credit' => 'Line of credit', - 'fico_score' => 'Your FICO score', - 'business_inception' => 'Business Inception Date', - 'average_bank_balance' => 'Average bank account balance', - 'annual_revenue' => 'Guadagno Annuale', - 'desired_credit_limit_factoring' => 'Desired invoice factoring limit', - 'desired_credit_limit_loc' => 'Desired line of credit limit', - 'desired_credit_limit' => 'Desired credit limit', - 'bluevine_credit_line_type_required' => 'Devi sceglierne almeno uno', - 'bluevine_field_required' => 'Questo campo è obbligatorio', - 'bluevine_unexpected_error' => 'Errore inaspettato!', - 'bluevine_no_conditional_offer' => 'More information is required before getting a quote. Click continue below.', - 'bluevine_invoice_factoring' => 'Invoice Factoring', - 'bluevine_conditional_offer' => 'Conditional Offer', - 'bluevine_credit_line_amount' => 'Credit Line', - 'bluevine_advance_rate' => 'Advance Rate', - 'bluevine_weekly_discount_rate' => 'Weekly Discount Rate', - 'bluevine_minimum_fee_rate' => 'Commissione Minima', - 'bluevine_line_of_credit' => 'Line of Credit', - 'bluevine_interest_rate' => 'Interest Rate', - 'bluevine_weekly_draw_rate' => 'Weekly Draw Rate', - 'bluevine_continue' => 'Continue to BlueVine', - 'bluevine_completed' => 'BlueVine signup completed', + 'bluevine_create_account' => 'Crea un account', + 'quote_types' => 'Ricevi un preventivo per', + 'invoice_factoring' => 'Invoice factoring', + 'line_of_credit' => 'Line of credit', + 'fico_score' => 'Your FICO score', + 'business_inception' => 'Business Inception Date', + 'average_bank_balance' => 'Average bank account balance', + 'annual_revenue' => 'Guadagno Annuale', + 'desired_credit_limit_factoring' => 'Desired invoice factoring limit', + 'desired_credit_limit_loc' => 'Desired line of credit limit', + 'desired_credit_limit' => 'Desired credit limit', + 'bluevine_credit_line_type_required' => 'Devi sceglierne almeno uno', + 'bluevine_field_required' => 'Questo campo è obbligatorio', + 'bluevine_unexpected_error' => 'Errore inaspettato!', + 'bluevine_no_conditional_offer' => 'More information is required before getting a quote. Click continue below.', + 'bluevine_invoice_factoring' => 'Invoice Factoring', + 'bluevine_conditional_offer' => 'Conditional Offer', + 'bluevine_credit_line_amount' => 'Credit Line', + 'bluevine_advance_rate' => 'Advance Rate', + 'bluevine_weekly_discount_rate' => 'Weekly Discount Rate', + 'bluevine_minimum_fee_rate' => 'Commissione Minima', + 'bluevine_line_of_credit' => 'Line of Credit', + 'bluevine_interest_rate' => 'Interest Rate', + 'bluevine_weekly_draw_rate' => 'Weekly Draw Rate', + 'bluevine_continue' => 'Continue to BlueVine', + 'bluevine_completed' => 'BlueVine signup completed', 'vendor_name' => 'Fornitore', 'entity_state' => 'State', @@ -2120,16 +2120,16 @@ $LANG = array( 'reports_help' => 'Shift + Click to sort by multiple columns, Ctrl + Click to clear the grouping.', 'this_year' => 'Quest\'anno', - // Updated login screen - 'ninja_tagline' => 'Create. Send. Get Paid.', - 'login_or_existing' => 'Or login with a connected account.', - 'sign_up_now' => 'Iscriviti ora', - 'not_a_member_yet' => 'Not a member yet?', - 'login_create_an_account' => 'Crea un account!', - 'client_login' => 'Client Login', + // Updated login screen + 'ninja_tagline' => 'Create. Send. Get Paid.', + 'login_or_existing' => 'Or login with a connected account.', + 'sign_up_now' => 'Iscriviti ora', + 'not_a_member_yet' => 'Not a member yet?', + 'login_create_an_account' => 'Crea un account!', + 'client_login' => 'Client Login', - // New Client Portal styling - 'invoice_from' => 'Invoices From:', + // New Client Portal styling + 'invoice_from' => 'Invoices From:', 'email_alias_message' => 'We require each company to have a unique email address.
Consider using an alias. ie, email+label@example.com', 'full_name' => 'Nome Completo', 'month_year' => 'MESE/ANNO', @@ -2424,7 +2424,7 @@ $LANG = array( 'tax1' => 'Prima Tassa', 'tax2' => 'Seconda Tassa', 'fee_help' => 'Gateway fees are the costs charged for access to the financial networks that handle the processing of online payments.', - 'format_export' => 'Exporting format', + 'format_export' => 'Exporting format', 'custom1' => 'First Custom', 'custom2' => 'Second Custom', 'contact_first_name' => 'Contact First Name', @@ -2861,5 +2861,3 @@ $LANG = array( ); return $LANG; - -?> diff --git a/resources/lang/ja/texts.php b/resources/lang/ja/texts.php index 1acca9426f..5f0239178d 100644 --- a/resources/lang/ja/texts.php +++ b/resources/lang/ja/texts.php @@ -1963,37 +1963,37 @@ $LANG = array( 'authorization' => 'Authorization', 'signed' => 'Signed', - // BlueVine - 'bluevine_promo' => 'Get flexible business lines of credit and invoice factoring using BlueVine.', - 'bluevine_modal_label' => 'Sign up with BlueVine', - 'bluevine_modal_text' => '

Fast funding for your business. No paperwork.

+ // BlueVine + 'bluevine_promo' => 'Get flexible business lines of credit and invoice factoring using BlueVine.', + 'bluevine_modal_label' => 'Sign up with BlueVine', + 'bluevine_modal_text' => '

Fast funding for your business. No paperwork.

  • Flexible business lines of credit and invoice factoring.
', - 'bluevine_create_account' => 'Create an account', - 'quote_types' => 'Get a quote for', - 'invoice_factoring' => 'Invoice factoring', - 'line_of_credit' => 'Line of credit', - 'fico_score' => 'Your FICO score', - 'business_inception' => 'Business Inception Date', - 'average_bank_balance' => 'Average bank account balance', - 'annual_revenue' => 'Annual revenue', - 'desired_credit_limit_factoring' => 'Desired invoice factoring limit', - 'desired_credit_limit_loc' => 'Desired line of credit limit', - 'desired_credit_limit' => 'Desired credit limit', - 'bluevine_credit_line_type_required' => 'You must choose at least one', - 'bluevine_field_required' => 'This field is required', - 'bluevine_unexpected_error' => 'An unexpected error occurred.', - 'bluevine_no_conditional_offer' => 'More information is required before getting a quote. Click continue below.', - 'bluevine_invoice_factoring' => 'Invoice Factoring', - 'bluevine_conditional_offer' => 'Conditional Offer', - 'bluevine_credit_line_amount' => 'Credit Line', - 'bluevine_advance_rate' => 'Advance Rate', - 'bluevine_weekly_discount_rate' => 'Weekly Discount Rate', - 'bluevine_minimum_fee_rate' => 'Minimum Fee', - 'bluevine_line_of_credit' => 'Line of Credit', - 'bluevine_interest_rate' => 'Interest Rate', - 'bluevine_weekly_draw_rate' => 'Weekly Draw Rate', - 'bluevine_continue' => 'Continue to BlueVine', - 'bluevine_completed' => 'BlueVine signup completed', + 'bluevine_create_account' => 'Create an account', + 'quote_types' => 'Get a quote for', + 'invoice_factoring' => 'Invoice factoring', + 'line_of_credit' => 'Line of credit', + 'fico_score' => 'Your FICO score', + 'business_inception' => 'Business Inception Date', + 'average_bank_balance' => 'Average bank account balance', + 'annual_revenue' => 'Annual revenue', + 'desired_credit_limit_factoring' => 'Desired invoice factoring limit', + 'desired_credit_limit_loc' => 'Desired line of credit limit', + 'desired_credit_limit' => 'Desired credit limit', + 'bluevine_credit_line_type_required' => 'You must choose at least one', + 'bluevine_field_required' => 'This field is required', + 'bluevine_unexpected_error' => 'An unexpected error occurred.', + 'bluevine_no_conditional_offer' => 'More information is required before getting a quote. Click continue below.', + 'bluevine_invoice_factoring' => 'Invoice Factoring', + 'bluevine_conditional_offer' => 'Conditional Offer', + 'bluevine_credit_line_amount' => 'Credit Line', + 'bluevine_advance_rate' => 'Advance Rate', + 'bluevine_weekly_discount_rate' => 'Weekly Discount Rate', + 'bluevine_minimum_fee_rate' => 'Minimum Fee', + 'bluevine_line_of_credit' => 'Line of Credit', + 'bluevine_interest_rate' => 'Interest Rate', + 'bluevine_weekly_draw_rate' => 'Weekly Draw Rate', + 'bluevine_continue' => 'Continue to BlueVine', + 'bluevine_completed' => 'BlueVine signup completed', 'vendor_name' => 'Vendor', 'entity_state' => 'State', @@ -2127,16 +2127,16 @@ $LANG = array( 'reports_help' => 'Shift + Click to sort by multiple columns, Ctrl + Click to clear the grouping.', 'this_year' => 'This Year', - // Updated login screen - 'ninja_tagline' => 'Create. Send. Get Paid.', - 'login_or_existing' => 'Or login with a connected account.', - 'sign_up_now' => 'Sign Up Now', - 'not_a_member_yet' => 'Not a member yet?', - 'login_create_an_account' => 'Create an Account!', - 'client_login' => 'Client Login', + // Updated login screen + 'ninja_tagline' => 'Create. Send. Get Paid.', + 'login_or_existing' => 'Or login with a connected account.', + 'sign_up_now' => 'Sign Up Now', + 'not_a_member_yet' => 'Not a member yet?', + 'login_create_an_account' => 'Create an Account!', + 'client_login' => 'Client Login', - // New Client Portal styling - 'invoice_from' => 'Invoices From:', + // New Client Portal styling + 'invoice_from' => 'Invoices From:', 'email_alias_message' => 'We require each company to have a unique email address.
Consider using an alias. ie, email+label@example.com', 'full_name' => 'Full Name', 'month_year' => 'MONTH/YEAR', @@ -2431,7 +2431,7 @@ $LANG = array( 'tax1' => 'First Tax', 'tax2' => 'Second Tax', 'fee_help' => 'Gateway fees are the costs charged for access to the financial networks that handle the processing of online payments.', - 'format_export' => 'Exporting format', + 'format_export' => 'Exporting format', 'custom1' => 'First Custom', 'custom2' => 'Second Custom', 'contact_first_name' => 'Contact First Name', @@ -2868,5 +2868,3 @@ $LANG = array( ); return $LANG; - -?> diff --git a/resources/lang/lt/texts.php b/resources/lang/lt/texts.php index caa08362ed..2a6c775d9e 100644 --- a/resources/lang/lt/texts.php +++ b/resources/lang/lt/texts.php @@ -1963,37 +1963,37 @@ $LANG = array( 'authorization' => 'Authorization', 'signed' => 'Signed', - // BlueVine - 'bluevine_promo' => 'Get flexible business lines of credit and invoice factoring using BlueVine.', - 'bluevine_modal_label' => 'Sign up with BlueVine', - 'bluevine_modal_text' => '

Fast funding for your business. No paperwork.

+ // BlueVine + 'bluevine_promo' => 'Get flexible business lines of credit and invoice factoring using BlueVine.', + 'bluevine_modal_label' => 'Sign up with BlueVine', + 'bluevine_modal_text' => '

Fast funding for your business. No paperwork.

  • Flexible business lines of credit and invoice factoring.
', - 'bluevine_create_account' => 'Create an account', - 'quote_types' => 'Get a quote for', - 'invoice_factoring' => 'Invoice factoring', - 'line_of_credit' => 'Line of credit', - 'fico_score' => 'Your FICO score', - 'business_inception' => 'Business Inception Date', - 'average_bank_balance' => 'Average bank account balance', - 'annual_revenue' => 'Annual revenue', - 'desired_credit_limit_factoring' => 'Desired invoice factoring limit', - 'desired_credit_limit_loc' => 'Desired line of credit limit', - 'desired_credit_limit' => 'Desired credit limit', - 'bluevine_credit_line_type_required' => 'You must choose at least one', - 'bluevine_field_required' => 'This field is required', - 'bluevine_unexpected_error' => 'An unexpected error occurred.', - 'bluevine_no_conditional_offer' => 'More information is required before getting a quote. Click continue below.', - 'bluevine_invoice_factoring' => 'Invoice Factoring', - 'bluevine_conditional_offer' => 'Conditional Offer', - 'bluevine_credit_line_amount' => 'Credit Line', - 'bluevine_advance_rate' => 'Advance Rate', - 'bluevine_weekly_discount_rate' => 'Weekly Discount Rate', - 'bluevine_minimum_fee_rate' => 'Minimum Fee', - 'bluevine_line_of_credit' => 'Line of Credit', - 'bluevine_interest_rate' => 'Interest Rate', - 'bluevine_weekly_draw_rate' => 'Weekly Draw Rate', - 'bluevine_continue' => 'Continue to BlueVine', - 'bluevine_completed' => 'BlueVine signup completed', + 'bluevine_create_account' => 'Create an account', + 'quote_types' => 'Get a quote for', + 'invoice_factoring' => 'Invoice factoring', + 'line_of_credit' => 'Line of credit', + 'fico_score' => 'Your FICO score', + 'business_inception' => 'Business Inception Date', + 'average_bank_balance' => 'Average bank account balance', + 'annual_revenue' => 'Annual revenue', + 'desired_credit_limit_factoring' => 'Desired invoice factoring limit', + 'desired_credit_limit_loc' => 'Desired line of credit limit', + 'desired_credit_limit' => 'Desired credit limit', + 'bluevine_credit_line_type_required' => 'You must choose at least one', + 'bluevine_field_required' => 'This field is required', + 'bluevine_unexpected_error' => 'An unexpected error occurred.', + 'bluevine_no_conditional_offer' => 'More information is required before getting a quote. Click continue below.', + 'bluevine_invoice_factoring' => 'Invoice Factoring', + 'bluevine_conditional_offer' => 'Conditional Offer', + 'bluevine_credit_line_amount' => 'Credit Line', + 'bluevine_advance_rate' => 'Advance Rate', + 'bluevine_weekly_discount_rate' => 'Weekly Discount Rate', + 'bluevine_minimum_fee_rate' => 'Minimum Fee', + 'bluevine_line_of_credit' => 'Line of Credit', + 'bluevine_interest_rate' => 'Interest Rate', + 'bluevine_weekly_draw_rate' => 'Weekly Draw Rate', + 'bluevine_continue' => 'Continue to BlueVine', + 'bluevine_completed' => 'BlueVine signup completed', 'vendor_name' => 'Vendor', 'entity_state' => 'State', @@ -2127,16 +2127,16 @@ $LANG = array( 'reports_help' => 'Shift + Click to sort by multiple columns, Ctrl + Click to clear the grouping.', 'this_year' => 'This Year', - // Updated login screen - 'ninja_tagline' => 'Create. Send. Get Paid.', - 'login_or_existing' => 'Or login with a connected account.', - 'sign_up_now' => 'Sign Up Now', - 'not_a_member_yet' => 'Not a member yet?', - 'login_create_an_account' => 'Create an Account!', - 'client_login' => 'Client Login', + // Updated login screen + 'ninja_tagline' => 'Create. Send. Get Paid.', + 'login_or_existing' => 'Or login with a connected account.', + 'sign_up_now' => 'Sign Up Now', + 'not_a_member_yet' => 'Not a member yet?', + 'login_create_an_account' => 'Create an Account!', + 'client_login' => 'Client Login', - // New Client Portal styling - 'invoice_from' => 'Invoices From:', + // New Client Portal styling + 'invoice_from' => 'Invoices From:', 'email_alias_message' => 'We require each company to have a unique email address.
Consider using an alias. ie, email+label@example.com', 'full_name' => 'Full Name', 'month_year' => 'MONTH/YEAR', @@ -2431,7 +2431,7 @@ $LANG = array( 'tax1' => 'First Tax', 'tax2' => 'Second Tax', 'fee_help' => 'Gateway fees are the costs charged for access to the financial networks that handle the processing of online payments.', - 'format_export' => 'Exporting format', + 'format_export' => 'Exporting format', 'custom1' => 'First Custom', 'custom2' => 'Second Custom', 'contact_first_name' => 'Contact First Name', @@ -2868,5 +2868,3 @@ $LANG = array( ); return $LANG; - -?> diff --git a/resources/lang/mk_MK/texts.php b/resources/lang/mk_MK/texts.php index 85b4df132e..c3354774af 100644 --- a/resources/lang/mk_MK/texts.php +++ b/resources/lang/mk_MK/texts.php @@ -1963,37 +1963,37 @@ $LANG = array( 'authorization' => 'Овластување', 'signed' => 'Потпишано', - // BlueVine - 'bluevine_promo' => 'Добијте флексибилни бизнис линии на кредит и факторинг на фактури преку BlueVine.', - 'bluevine_modal_label' => 'Регистрирај се со BlueVine', - 'bluevine_modal_text' => '

Брзо финансирање на вашиот бизнис. Без документи.

+ // BlueVine + 'bluevine_promo' => 'Добијте флексибилни бизнис линии на кредит и факторинг на фактури преку BlueVine.', + 'bluevine_modal_label' => 'Регистрирај се со BlueVine', + 'bluevine_modal_text' => '

Брзо финансирање на вашиот бизнис. Без документи.

  • Флексибилни бизнис линии на кредит и факторинг на фактури
', - 'bluevine_create_account' => 'Креирај сметка', - 'quote_types' => 'Добиј понуда за', - 'invoice_factoring' => 'Факторинг на фактура', - 'line_of_credit' => 'Линија на кредит', - 'fico_score' => 'Вашиот FICO резултат', - 'business_inception' => 'Датум на започнување бизнис', - 'average_bank_balance' => 'Просечна состојба на билансна сметка', - 'annual_revenue' => 'Годишен приход', - 'desired_credit_limit_factoring' => 'Посакувано ограничување на факторинг на фактура ', - 'desired_credit_limit_loc' => 'Посакувано ограничување на линија на кредит', - 'desired_credit_limit' => 'Посакувано ограничување на кредит', - 'bluevine_credit_line_type_required' => 'Мора да изберете баред едно', - 'bluevine_field_required' => 'Ова поле е задолжително', - 'bluevine_unexpected_error' => 'Се случи неочекувана грешка.', - 'bluevine_no_conditional_offer' => 'Потребни се повеќе информации пред да добиете понуда. Кликнете продолжи подоле.', - 'bluevine_invoice_factoring' => 'Факторинг на фактура', - 'bluevine_conditional_offer' => 'Доверлива понуда', - 'bluevine_credit_line_amount' => 'Кредитна линија', - 'bluevine_advance_rate' => 'Стапка на аванс', - 'bluevine_weekly_discount_rate' => 'Неделна стапка на попуст', - 'bluevine_minimum_fee_rate' => 'Минимална провизија', - 'bluevine_line_of_credit' => 'Линија на кредит', - 'bluevine_interest_rate' => 'Каматна стапка', - 'bluevine_weekly_draw_rate' => 'Неделна стапка на повлекување', - 'bluevine_continue' => 'Продолжи на BlueVine', - 'bluevine_completed' => 'Регистрирањето на BlueVine е завршено', + 'bluevine_create_account' => 'Креирај сметка', + 'quote_types' => 'Добиј понуда за', + 'invoice_factoring' => 'Факторинг на фактура', + 'line_of_credit' => 'Линија на кредит', + 'fico_score' => 'Вашиот FICO резултат', + 'business_inception' => 'Датум на започнување бизнис', + 'average_bank_balance' => 'Просечна состојба на билансна сметка', + 'annual_revenue' => 'Годишен приход', + 'desired_credit_limit_factoring' => 'Посакувано ограничување на факторинг на фактура ', + 'desired_credit_limit_loc' => 'Посакувано ограничување на линија на кредит', + 'desired_credit_limit' => 'Посакувано ограничување на кредит', + 'bluevine_credit_line_type_required' => 'Мора да изберете баред едно', + 'bluevine_field_required' => 'Ова поле е задолжително', + 'bluevine_unexpected_error' => 'Се случи неочекувана грешка.', + 'bluevine_no_conditional_offer' => 'Потребни се повеќе информации пред да добиете понуда. Кликнете продолжи подоле.', + 'bluevine_invoice_factoring' => 'Факторинг на фактура', + 'bluevine_conditional_offer' => 'Доверлива понуда', + 'bluevine_credit_line_amount' => 'Кредитна линија', + 'bluevine_advance_rate' => 'Стапка на аванс', + 'bluevine_weekly_discount_rate' => 'Неделна стапка на попуст', + 'bluevine_minimum_fee_rate' => 'Минимална провизија', + 'bluevine_line_of_credit' => 'Линија на кредит', + 'bluevine_interest_rate' => 'Каматна стапка', + 'bluevine_weekly_draw_rate' => 'Неделна стапка на повлекување', + 'bluevine_continue' => 'Продолжи на BlueVine', + 'bluevine_completed' => 'Регистрирањето на BlueVine е завршено', 'vendor_name' => 'Продавач', 'entity_state' => 'Состојба', @@ -2127,16 +2127,16 @@ $LANG = array( 'reports_help' => 'Shift + клик за распределување по повеќе колони, Ctrl + клик за чистење на групирањето.', 'this_year' => 'Оваа година', - // Updated login screen - 'ninja_tagline' => 'Креирај. Прати. Биди платен.', - 'login_or_existing' => 'Или најави се со поврзана сметка.', - 'sign_up_now' => 'Регистрирај се сега', - 'not_a_member_yet' => 'Се уште не си член?', - 'login_create_an_account' => 'Креирај сметка!', - 'client_login' => 'Најава на клиент', + // Updated login screen + 'ninja_tagline' => 'Креирај. Прати. Биди платен.', + 'login_or_existing' => 'Или најави се со поврзана сметка.', + 'sign_up_now' => 'Регистрирај се сега', + 'not_a_member_yet' => 'Се уште не си член?', + 'login_create_an_account' => 'Креирај сметка!', + 'client_login' => 'Најава на клиент', - // New Client Portal styling - 'invoice_from' => 'Фактури од:', + // New Client Portal styling + 'invoice_from' => 'Фактури од:', 'email_alias_message' => 'Бараме од секоја компанијада има уникатна адреса на е-пошта.
Земете го во предвид користењето на псевдоним. На пр. email+label@example.com', 'full_name' => 'Целосно име', 'month_year' => 'МЕСЕЦ/ГОДИНА', @@ -2431,7 +2431,7 @@ $LANG = array( 'tax1' => 'Прв данок', 'tax2' => 'Втор Данок', 'fee_help' => 'Такса за платниот портал е износот кој се наплаќа за пристап до финансиската мрежа која се бави со процесирање на онлан плаќања.', - 'format_export' => 'Формат за експортирање', + 'format_export' => 'Формат за експортирање', 'custom1' => 'Прво прилагодено', 'custom2' => 'Второ прилагодено', 'contact_first_name' => 'Контакт Име', @@ -2868,5 +2868,3 @@ $LANG = array( ); return $LANG; - -?> diff --git a/resources/lang/nb_NO/texts.php b/resources/lang/nb_NO/texts.php index 32b6c5baff..fe239ee18b 100644 --- a/resources/lang/nb_NO/texts.php +++ b/resources/lang/nb_NO/texts.php @@ -1963,37 +1963,37 @@ $LANG = array( 'authorization' => 'Autorisasjon', 'signed' => 'Signert', - // BlueVine - 'bluevine_promo' => 'Get flexible business lines of credit and invoice factoring using BlueVine.', - 'bluevine_modal_label' => 'Sign up with BlueVine', - 'bluevine_modal_text' => '

Fast funding for your business. No paperwork.

+ // BlueVine + 'bluevine_promo' => 'Get flexible business lines of credit and invoice factoring using BlueVine.', + 'bluevine_modal_label' => 'Sign up with BlueVine', + 'bluevine_modal_text' => '

Fast funding for your business. No paperwork.

  • Flexible business lines of credit and invoice factoring.
', - 'bluevine_create_account' => 'Opprett en konto', - 'quote_types' => 'Få et tilbud for', - 'invoice_factoring' => 'Invoice factoring', - 'line_of_credit' => 'Linje av kreditt', - 'fico_score' => 'Din FICO-poengsum', - 'business_inception' => 'Bedriftens stiftelsesdato', - 'average_bank_balance' => 'Average bank account balance', - 'annual_revenue' => 'Årlig omsetning', - 'desired_credit_limit_factoring' => 'Desired invoice factoring limit', - 'desired_credit_limit_loc' => 'Desired line of credit limit', - 'desired_credit_limit' => 'Desired credit limit', - 'bluevine_credit_line_type_required' => 'You must choose at least one', - 'bluevine_field_required' => 'Dette feltet er obligatorisk', - 'bluevine_unexpected_error' => 'An unexpected error occurred.', - 'bluevine_no_conditional_offer' => 'More information is required before getting a quote. Click continue below.', - 'bluevine_invoice_factoring' => 'Invoice Factoring', - 'bluevine_conditional_offer' => 'Conditional Offer', - 'bluevine_credit_line_amount' => 'Kredittlinje', - 'bluevine_advance_rate' => 'Advance Rate', - 'bluevine_weekly_discount_rate' => 'Weekly Discount Rate', - 'bluevine_minimum_fee_rate' => 'Minimum Fee', - 'bluevine_line_of_credit' => 'Linje av Kreditt', - 'bluevine_interest_rate' => 'Rente', - 'bluevine_weekly_draw_rate' => 'Weekly Draw Rate', - 'bluevine_continue' => 'Continue to BlueVine', - 'bluevine_completed' => 'BlueVine signup completed', + 'bluevine_create_account' => 'Opprett en konto', + 'quote_types' => 'Få et tilbud for', + 'invoice_factoring' => 'Invoice factoring', + 'line_of_credit' => 'Linje av kreditt', + 'fico_score' => 'Din FICO-poengsum', + 'business_inception' => 'Bedriftens stiftelsesdato', + 'average_bank_balance' => 'Average bank account balance', + 'annual_revenue' => 'Årlig omsetning', + 'desired_credit_limit_factoring' => 'Desired invoice factoring limit', + 'desired_credit_limit_loc' => 'Desired line of credit limit', + 'desired_credit_limit' => 'Desired credit limit', + 'bluevine_credit_line_type_required' => 'You must choose at least one', + 'bluevine_field_required' => 'Dette feltet er obligatorisk', + 'bluevine_unexpected_error' => 'An unexpected error occurred.', + 'bluevine_no_conditional_offer' => 'More information is required before getting a quote. Click continue below.', + 'bluevine_invoice_factoring' => 'Invoice Factoring', + 'bluevine_conditional_offer' => 'Conditional Offer', + 'bluevine_credit_line_amount' => 'Kredittlinje', + 'bluevine_advance_rate' => 'Advance Rate', + 'bluevine_weekly_discount_rate' => 'Weekly Discount Rate', + 'bluevine_minimum_fee_rate' => 'Minimum Fee', + 'bluevine_line_of_credit' => 'Linje av Kreditt', + 'bluevine_interest_rate' => 'Rente', + 'bluevine_weekly_draw_rate' => 'Weekly Draw Rate', + 'bluevine_continue' => 'Continue to BlueVine', + 'bluevine_completed' => 'BlueVine signup completed', 'vendor_name' => 'Leverandør', 'entity_state' => 'State', @@ -2127,16 +2127,16 @@ $LANG = array( 'reports_help' => 'Shift + Click to sort by multiple columns, Ctrl + Click to clear the grouping.', 'this_year' => 'Dette Året', - // Updated login screen - 'ninja_tagline' => 'Opprett. Send. Få Betalt.', - 'login_or_existing' => 'Or login with a connected account.', - 'sign_up_now' => 'Registrer Nå', - 'not_a_member_yet' => 'Not a member yet?', - 'login_create_an_account' => 'Create an Account!', - 'client_login' => 'Kundeinnlogging', + // Updated login screen + 'ninja_tagline' => 'Opprett. Send. Få Betalt.', + 'login_or_existing' => 'Or login with a connected account.', + 'sign_up_now' => 'Registrer Nå', + 'not_a_member_yet' => 'Not a member yet?', + 'login_create_an_account' => 'Create an Account!', + 'client_login' => 'Kundeinnlogging', - // New Client Portal styling - 'invoice_from' => 'Fakturaer Fra:', + // New Client Portal styling + 'invoice_from' => 'Fakturaer Fra:', 'email_alias_message' => 'We require each company to have a unique email address.
Consider using an alias. ie, email+label@example.com', 'full_name' => 'Fullt Navn', 'month_year' => 'MÅNED/ÅR', @@ -2431,7 +2431,7 @@ $LANG = array( 'tax1' => 'First Tax', 'tax2' => 'Second Tax', 'fee_help' => 'Gateway fees are the costs charged for access to the financial networks that handle the processing of online payments.', - 'format_export' => 'Exporting format', + 'format_export' => 'Exporting format', 'custom1' => 'First Custom', 'custom2' => 'Second Custom', 'contact_first_name' => 'Contact First Name', @@ -2868,5 +2868,3 @@ $LANG = array( ); return $LANG; - -?> diff --git a/resources/lang/nl/texts.php b/resources/lang/nl/texts.php index 8853b2df19..28e03c5663 100644 --- a/resources/lang/nl/texts.php +++ b/resources/lang/nl/texts.php @@ -1955,37 +1955,37 @@ Kom terug naar deze betalingsmethode pagina zodra u de bedragen heeft ontvangen 'authorization' => 'Autorisatie', 'signed' => 'Getekend', - // BlueVine - 'bluevine_promo' => 'Krijg flexibele zakelijke kredietlijnen en factuur factoring met BlueVine.', - 'bluevine_modal_label' => 'Aanmelden met BlueVine', - 'bluevine_modal_text' => '

Snelle financiering voor uw bedrijf. Geen papierwerk.

+ // BlueVine + 'bluevine_promo' => 'Krijg flexibele zakelijke kredietlijnen en factuur factoring met BlueVine.', + 'bluevine_modal_label' => 'Aanmelden met BlueVine', + 'bluevine_modal_text' => '

Snelle financiering voor uw bedrijf. Geen papierwerk.

    Flexibele zakelijke kredietlijnen en factuur factoring.
', - 'bluevine_create_account' => 'Account aanmaken', - 'quote_types' => 'Ontvang een offerte voor', - 'invoice_factoring' => 'Factuur factoring', - 'line_of_credit' => 'Kredietlijn', - 'fico_score' => 'Uw FICO score', - 'business_inception' => 'Zakelijke startdatum', - 'average_bank_balance' => 'Gemiddelde balans bankrekening', - 'annual_revenue' => 'Jaarlijkse inkomsten', - 'desired_credit_limit_factoring' => 'Gewenste factuur factoring limiet', - 'desired_credit_limit_loc' => 'Gewenste kredietlijn limiet', - 'desired_credit_limit' => 'Gewenste krediet limiet', - 'bluevine_credit_line_type_required' => 'Gelieve er minstens één te selecteren', - 'bluevine_field_required' => 'Dit veld is vereist', - 'bluevine_unexpected_error' => 'Er is een onverwachte fout opgetreden.', - 'bluevine_no_conditional_offer' => 'Er is meer informatie nodig om een offerte te verkrijgen. Klik op verdergaan hieronder.', - 'bluevine_invoice_factoring' => 'Factuur factoring', - 'bluevine_conditional_offer' => 'Voorwaardelijk aanbod', - 'bluevine_credit_line_amount' => 'Kredietlijn', - 'bluevine_advance_rate' => 'Voorschot tarief', - 'bluevine_weekly_discount_rate' => 'Wekelijks kortingspercentage', - 'bluevine_minimum_fee_rate' => 'Minimale kosten', - 'bluevine_line_of_credit' => 'Kredietlijn', - 'bluevine_interest_rate' => 'Rente', - 'bluevine_weekly_draw_rate' => 'Wekelijks treksnelheid', - 'bluevine_continue' => 'Ga verder naar BlueVine', - 'bluevine_completed' => 'BlueVine aanmelding voltooid', + 'bluevine_create_account' => 'Account aanmaken', + 'quote_types' => 'Ontvang een offerte voor', + 'invoice_factoring' => 'Factuur factoring', + 'line_of_credit' => 'Kredietlijn', + 'fico_score' => 'Uw FICO score', + 'business_inception' => 'Zakelijke startdatum', + 'average_bank_balance' => 'Gemiddelde balans bankrekening', + 'annual_revenue' => 'Jaarlijkse inkomsten', + 'desired_credit_limit_factoring' => 'Gewenste factuur factoring limiet', + 'desired_credit_limit_loc' => 'Gewenste kredietlijn limiet', + 'desired_credit_limit' => 'Gewenste krediet limiet', + 'bluevine_credit_line_type_required' => 'Gelieve er minstens één te selecteren', + 'bluevine_field_required' => 'Dit veld is vereist', + 'bluevine_unexpected_error' => 'Er is een onverwachte fout opgetreden.', + 'bluevine_no_conditional_offer' => 'Er is meer informatie nodig om een offerte te verkrijgen. Klik op verdergaan hieronder.', + 'bluevine_invoice_factoring' => 'Factuur factoring', + 'bluevine_conditional_offer' => 'Voorwaardelijk aanbod', + 'bluevine_credit_line_amount' => 'Kredietlijn', + 'bluevine_advance_rate' => 'Voorschot tarief', + 'bluevine_weekly_discount_rate' => 'Wekelijks kortingspercentage', + 'bluevine_minimum_fee_rate' => 'Minimale kosten', + 'bluevine_line_of_credit' => 'Kredietlijn', + 'bluevine_interest_rate' => 'Rente', + 'bluevine_weekly_draw_rate' => 'Wekelijks treksnelheid', + 'bluevine_continue' => 'Ga verder naar BlueVine', + 'bluevine_completed' => 'BlueVine aanmelding voltooid', 'vendor_name' => 'Leverancier', 'entity_state' => 'Staat', @@ -2119,16 +2119,16 @@ Kom terug naar deze betalingsmethode pagina zodra u de bedragen heeft ontvangen 'reports_help' => 'Shift + klik om op meerdere kolommen te sorteren, Ctrl + klik om de groepering te wissen.', 'this_year' => 'Dit jaar', - // Updated login screen - 'ninja_tagline' => 'Creëren. Sturen. Betaald worden.', - 'login_or_existing' => 'Of log in met een verbonden account.', - 'sign_up_now' => 'Meld nu aan', - 'not_a_member_yet' => 'Nog geen lid?', - 'login_create_an_account' => 'Maak een account aan!', - 'client_login' => 'Klanten login', + // Updated login screen + 'ninja_tagline' => 'Creëren. Sturen. Betaald worden.', + 'login_or_existing' => 'Of log in met een verbonden account.', + 'sign_up_now' => 'Meld nu aan', + 'not_a_member_yet' => 'Nog geen lid?', + 'login_create_an_account' => 'Maak een account aan!', + 'client_login' => 'Klanten login', - // New Client Portal styling - 'invoice_from' => 'Facturen van:', + // New Client Portal styling + 'invoice_from' => 'Facturen van:', 'email_alias_message' => 'Let op: het is vereist dat iedere gebruiker een uniek e-mailadres gebruikt.
Overweeg een alias te gebruiken, bv. email+label@example.com', 'full_name' => 'Volledige naam', 'month_year' => 'Maand/jaar', @@ -2423,7 +2423,7 @@ Kom terug naar deze betalingsmethode pagina zodra u de bedragen heeft ontvangen 'tax1' => 'Eerste belasting', 'tax2' => 'Tweede belasting', 'fee_help' => 'Gateway vergoedingen zijn de kosten die gelden voor toegang tot de financiële netwerken die de verwerking van online betalingen behandelen.', - 'format_export' => 'Uitvoerformaat', + 'format_export' => 'Uitvoerformaat', 'custom1' => 'Eerste aangepaste', 'custom2' => 'Tweede aangepaste', 'contact_first_name' => 'Contact voornaam', @@ -2860,5 +2860,3 @@ Kom terug naar deze betalingsmethode pagina zodra u de bedragen heeft ontvangen ); return $LANG; - -?> diff --git a/resources/lang/pl/passwords.php b/resources/lang/pl/passwords.php index 28ccb957b3..b820fe5370 100644 --- a/resources/lang/pl/passwords.php +++ b/resources/lang/pl/passwords.php @@ -19,4 +19,4 @@ return [ "sent" => "Link do resetowania hasła został wysłany.", "reset" => "Twoje hasło zostało zresetowane!", -]; \ No newline at end of file +]; diff --git a/resources/lang/pl/reminders.php b/resources/lang/pl/reminders.php index 25824a7f28..f1b084e873 100644 --- a/resources/lang/pl/reminders.php +++ b/resources/lang/pl/reminders.php @@ -21,4 +21,4 @@ return array( "sent" => "Przypomnienie hasła zostało wysłane!", -); \ No newline at end of file +); diff --git a/resources/lang/pl/texts.php b/resources/lang/pl/texts.php index 9e3048ff92..28ca0e9e0e 100644 --- a/resources/lang/pl/texts.php +++ b/resources/lang/pl/texts.php @@ -1963,37 +1963,37 @@ Gdy przelewy zostaną zaksięgowane na Twoim koncie, wróć do tej strony i klik 'authorization' => 'Autoryzacja', 'signed' => 'Podpisano', - // BlueVine - 'bluevine_promo' => 'Otrzymaj elastyczne biznesowe linie kredytowe oraz obsługę faktur dzięki BlueVine.', - 'bluevine_modal_label' => 'Zarejestruj się w BlueVine', - 'bluevine_modal_text' => '

Fast funding for your business. No paperwork.

+ // BlueVine + 'bluevine_promo' => 'Otrzymaj elastyczne biznesowe linie kredytowe oraz obsługę faktur dzięki BlueVine.', + 'bluevine_modal_label' => 'Zarejestruj się w BlueVine', + 'bluevine_modal_text' => '

Fast funding for your business. No paperwork.

  • Flexible business lines of credit and invoice factoring.
', - 'bluevine_create_account' => 'Stwórz konto', - 'quote_types' => 'Otrzymaj ofertę dla', - 'invoice_factoring' => 'Generowanie faktur', - 'line_of_credit' => 'Linia kredytowa', - 'fico_score' => 'Twoja ocena FICO', - 'business_inception' => 'Business Inception Date', - 'average_bank_balance' => 'Średnie saldo bankowe', - 'annual_revenue' => 'Roczny przychód', - 'desired_credit_limit_factoring' => 'Wybrany limit generowania faktur', - 'desired_credit_limit_loc' => 'Wybrany limit linii kredytowej', - 'desired_credit_limit' => 'Wybrany limit kredytowy', - 'bluevine_credit_line_type_required' => 'Musisz wybrać przynajmniej jedną opcję', - 'bluevine_field_required' => 'To pole jest wymagane', - 'bluevine_unexpected_error' => 'Wystąpił nieznany błąd.', - 'bluevine_no_conditional_offer' => 'Do otrzymania oferty wymagane jest więcej informacji. Kliknij "kontynuuj" poniżej.', - 'bluevine_invoice_factoring' => 'Generowanie faktur', - 'bluevine_conditional_offer' => 'Oferta pod określonymi warunkami', - 'bluevine_credit_line_amount' => 'Linia kredytowa', - 'bluevine_advance_rate' => 'Zaawansowany przelicznik', - 'bluevine_weekly_discount_rate' => 'Tygodniowa stopa rabatu', - 'bluevine_minimum_fee_rate' => 'Minimalna opłata', - 'bluevine_line_of_credit' => 'Linia Kredytu', - 'bluevine_interest_rate' => 'Interest Rate', - 'bluevine_weekly_draw_rate' => 'Weekly Draw Rate', - 'bluevine_continue' => 'Przejdź do BlueVine', - 'bluevine_completed' => 'Rejestracja w BlueVine ukończona', + 'bluevine_create_account' => 'Stwórz konto', + 'quote_types' => 'Otrzymaj ofertę dla', + 'invoice_factoring' => 'Generowanie faktur', + 'line_of_credit' => 'Linia kredytowa', + 'fico_score' => 'Twoja ocena FICO', + 'business_inception' => 'Business Inception Date', + 'average_bank_balance' => 'Średnie saldo bankowe', + 'annual_revenue' => 'Roczny przychód', + 'desired_credit_limit_factoring' => 'Wybrany limit generowania faktur', + 'desired_credit_limit_loc' => 'Wybrany limit linii kredytowej', + 'desired_credit_limit' => 'Wybrany limit kredytowy', + 'bluevine_credit_line_type_required' => 'Musisz wybrać przynajmniej jedną opcję', + 'bluevine_field_required' => 'To pole jest wymagane', + 'bluevine_unexpected_error' => 'Wystąpił nieznany błąd.', + 'bluevine_no_conditional_offer' => 'Do otrzymania oferty wymagane jest więcej informacji. Kliknij "kontynuuj" poniżej.', + 'bluevine_invoice_factoring' => 'Generowanie faktur', + 'bluevine_conditional_offer' => 'Oferta pod określonymi warunkami', + 'bluevine_credit_line_amount' => 'Linia kredytowa', + 'bluevine_advance_rate' => 'Zaawansowany przelicznik', + 'bluevine_weekly_discount_rate' => 'Tygodniowa stopa rabatu', + 'bluevine_minimum_fee_rate' => 'Minimalna opłata', + 'bluevine_line_of_credit' => 'Linia Kredytu', + 'bluevine_interest_rate' => 'Interest Rate', + 'bluevine_weekly_draw_rate' => 'Weekly Draw Rate', + 'bluevine_continue' => 'Przejdź do BlueVine', + 'bluevine_completed' => 'Rejestracja w BlueVine ukończona', 'vendor_name' => 'Dostawca', 'entity_state' => 'Stan', @@ -2127,16 +2127,16 @@ Gdy przelewy zostaną zaksięgowane na Twoim koncie, wróć do tej strony i klik 'reports_help' => 'Shift + Click to sort by multiple columns, Ctrl + Click to clear the grouping.', 'this_year' => 'Ten rok', - // Updated login screen - 'ninja_tagline' => 'Twórz. Wysyłaj. Zarabiaj.', - 'login_or_existing' => 'Or login with a connected account.', - 'sign_up_now' => 'Zarejestruj się teraz.', - 'not_a_member_yet' => 'Nie masz konta?', - 'login_create_an_account' => 'Stwórz konto!', - 'client_login' => 'Logowanie klienta', + // Updated login screen + 'ninja_tagline' => 'Twórz. Wysyłaj. Zarabiaj.', + 'login_or_existing' => 'Or login with a connected account.', + 'sign_up_now' => 'Zarejestruj się teraz.', + 'not_a_member_yet' => 'Nie masz konta?', + 'login_create_an_account' => 'Stwórz konto!', + 'client_login' => 'Logowanie klienta', - // New Client Portal styling - 'invoice_from' => 'Sprzedawca:', + // New Client Portal styling + 'invoice_from' => 'Sprzedawca:', 'email_alias_message' => 'We require each company to have a unique email address.
Consider using an alias. ie, email+label@example.com', 'full_name' => 'Pełna nazwa', 'month_year' => 'MIESIĄC/ROK', @@ -2431,7 +2431,7 @@ Gdy przelewy zostaną zaksięgowane na Twoim koncie, wróć do tej strony i klik 'tax1' => 'First Tax', 'tax2' => 'Second Tax', 'fee_help' => 'Gateway fees are the costs charged for access to the financial networks that handle the processing of online payments.', - 'format_export' => 'Exporting format', + 'format_export' => 'Exporting format', 'custom1' => 'First Custom', 'custom2' => 'Second Custom', 'contact_first_name' => 'Contact First Name', @@ -2868,5 +2868,3 @@ Gdy przelewy zostaną zaksięgowane na Twoim koncie, wróć do tej strony i klik ); return $LANG; - -?> diff --git a/resources/lang/pl/validation.php b/resources/lang/pl/validation.php index d3ffdb6a81..10f3c640d3 100644 --- a/resources/lang/pl/validation.php +++ b/resources/lang/pl/validation.php @@ -103,4 +103,4 @@ return array( 'attributes' => array(), -); \ No newline at end of file +); diff --git a/resources/lang/pt_BR/texts.php b/resources/lang/pt_BR/texts.php index 4eb8cc2821..07f2e5334b 100644 --- a/resources/lang/pt_BR/texts.php +++ b/resources/lang/pt_BR/texts.php @@ -1954,37 +1954,37 @@ Quando tiver os valores dos depósitos, volte a esta pagina e complete a verific 'authorization' => 'Authorization', 'signed' => 'Signed', - // BlueVine - 'bluevine_promo' => 'Get flexible business lines of credit and invoice factoring using BlueVine.', - 'bluevine_modal_label' => 'Sign up with BlueVine', - 'bluevine_modal_text' => '

Fast funding for your business. No paperwork.

+ // BlueVine + 'bluevine_promo' => 'Get flexible business lines of credit and invoice factoring using BlueVine.', + 'bluevine_modal_label' => 'Sign up with BlueVine', + 'bluevine_modal_text' => '

Fast funding for your business. No paperwork.

  • Flexible business lines of credit and invoice factoring.
', - 'bluevine_create_account' => 'Create an account', - 'quote_types' => 'Get a quote for', - 'invoice_factoring' => 'Invoice factoring', - 'line_of_credit' => 'Line of credit', - 'fico_score' => 'Your FICO score', - 'business_inception' => 'Business Inception Date', - 'average_bank_balance' => 'Average bank account balance', - 'annual_revenue' => 'Annual revenue', - 'desired_credit_limit_factoring' => 'Desired invoice factoring limit', - 'desired_credit_limit_loc' => 'Desired line of credit limit', - 'desired_credit_limit' => 'Desired credit limit', - 'bluevine_credit_line_type_required' => 'You must choose at least one', - 'bluevine_field_required' => 'This field is required', - 'bluevine_unexpected_error' => 'An unexpected error occurred.', - 'bluevine_no_conditional_offer' => 'More information is required before getting a quote. Click continue below.', - 'bluevine_invoice_factoring' => 'Invoice Factoring', - 'bluevine_conditional_offer' => 'Conditional Offer', - 'bluevine_credit_line_amount' => 'Credit Line', - 'bluevine_advance_rate' => 'Advance Rate', - 'bluevine_weekly_discount_rate' => 'Weekly Discount Rate', - 'bluevine_minimum_fee_rate' => 'Minimum Fee', - 'bluevine_line_of_credit' => 'Line of Credit', - 'bluevine_interest_rate' => 'Interest Rate', - 'bluevine_weekly_draw_rate' => 'Weekly Draw Rate', - 'bluevine_continue' => 'Continue to BlueVine', - 'bluevine_completed' => 'BlueVine signup completed', + 'bluevine_create_account' => 'Create an account', + 'quote_types' => 'Get a quote for', + 'invoice_factoring' => 'Invoice factoring', + 'line_of_credit' => 'Line of credit', + 'fico_score' => 'Your FICO score', + 'business_inception' => 'Business Inception Date', + 'average_bank_balance' => 'Average bank account balance', + 'annual_revenue' => 'Annual revenue', + 'desired_credit_limit_factoring' => 'Desired invoice factoring limit', + 'desired_credit_limit_loc' => 'Desired line of credit limit', + 'desired_credit_limit' => 'Desired credit limit', + 'bluevine_credit_line_type_required' => 'You must choose at least one', + 'bluevine_field_required' => 'This field is required', + 'bluevine_unexpected_error' => 'An unexpected error occurred.', + 'bluevine_no_conditional_offer' => 'More information is required before getting a quote. Click continue below.', + 'bluevine_invoice_factoring' => 'Invoice Factoring', + 'bluevine_conditional_offer' => 'Conditional Offer', + 'bluevine_credit_line_amount' => 'Credit Line', + 'bluevine_advance_rate' => 'Advance Rate', + 'bluevine_weekly_discount_rate' => 'Weekly Discount Rate', + 'bluevine_minimum_fee_rate' => 'Minimum Fee', + 'bluevine_line_of_credit' => 'Line of Credit', + 'bluevine_interest_rate' => 'Interest Rate', + 'bluevine_weekly_draw_rate' => 'Weekly Draw Rate', + 'bluevine_continue' => 'Continue to BlueVine', + 'bluevine_completed' => 'BlueVine signup completed', 'vendor_name' => 'Vendor', 'entity_state' => 'State', @@ -2118,16 +2118,16 @@ Quando tiver os valores dos depósitos, volte a esta pagina e complete a verific 'reports_help' => 'Shift + Click to sort by multiple columns, Ctrl + Click to clear the grouping.', 'this_year' => 'This Year', - // Updated login screen - 'ninja_tagline' => 'Create. Send. Get Paid.', - 'login_or_existing' => 'Or login with a connected account.', - 'sign_up_now' => 'Sign Up Now', - 'not_a_member_yet' => 'Not a member yet?', - 'login_create_an_account' => 'Create an Account!', - 'client_login' => 'Client Login', + // Updated login screen + 'ninja_tagline' => 'Create. Send. Get Paid.', + 'login_or_existing' => 'Or login with a connected account.', + 'sign_up_now' => 'Sign Up Now', + 'not_a_member_yet' => 'Not a member yet?', + 'login_create_an_account' => 'Create an Account!', + 'client_login' => 'Client Login', - // New Client Portal styling - 'invoice_from' => 'Invoices From:', + // New Client Portal styling + 'invoice_from' => 'Invoices From:', 'email_alias_message' => 'We require each company to have a unique email address.
Consider using an alias. ie, email+label@example.com', 'full_name' => 'Full Name', 'month_year' => 'MONTH/YEAR', @@ -2422,7 +2422,7 @@ Quando tiver os valores dos depósitos, volte a esta pagina e complete a verific 'tax1' => 'Primeiro Imposto', 'tax2' => 'Segundo Imposto', 'fee_help' => 'Gateway fees are the costs charged for access to the financial networks that handle the processing of online payments.', - 'format_export' => 'Formato de exportação', + 'format_export' => 'Formato de exportação', 'custom1' => 'First Custom', 'custom2' => 'Second Custom', 'contact_first_name' => 'Contact First Name', @@ -2859,5 +2859,3 @@ Quando tiver os valores dos depósitos, volte a esta pagina e complete a verific ); return $LANG; - -?> diff --git a/resources/lang/pt_PT/texts.php b/resources/lang/pt_PT/texts.php index 6b29fae07c..66a5347ee4 100644 --- a/resources/lang/pt_PT/texts.php +++ b/resources/lang/pt_PT/texts.php @@ -1955,37 +1955,37 @@ Quando tiver os valores dos depósitos, volte a esta página e conclua a verific 'authorization' => 'Autorização', 'signed' => 'Assinado', - // BlueVine - 'bluevine_promo' => 'Tenha uma linha de crédito flexível usando BlueVine.', - 'bluevine_modal_label' => 'Registar com BlueVine', - 'bluevine_modal_text' => '

Capital rápido para o seu negócio. Sem papelada.

+ // BlueVine + 'bluevine_promo' => 'Tenha uma linha de crédito flexível usando BlueVine.', + 'bluevine_modal_label' => 'Registar com BlueVine', + 'bluevine_modal_text' => '

Capital rápido para o seu negócio. Sem papelada.

  • Linhas de crédito flexíveis para o seu negócio.
', - 'bluevine_create_account' => 'Criar uma conta', - 'quote_types' => 'Pedir orçamento para', - 'invoice_factoring' => 'Faturação de contas', - 'line_of_credit' => 'Linha de crédito', - 'fico_score' => 'Pontuação FICO', - 'business_inception' => 'Data de Criação do Negócio', - 'average_bank_balance' => 'Média do balanço das contas bancárias', - 'annual_revenue' => 'Anual faturado', - 'desired_credit_limit_factoring' => 'Limite de crédito desejado', - 'desired_credit_limit_loc' => 'Limite da linha de crédito desejado', - 'desired_credit_limit' => 'Limite de crédito desejado', - 'bluevine_credit_line_type_required' => 'Deve escolher pelo menos uma', - 'bluevine_field_required' => 'O campo é obrigatório', - 'bluevine_unexpected_error' => 'Ocorreu um erro inesperado.', - 'bluevine_no_conditional_offer' => 'É necessário mais informação antes de obter um orçamento. Clique abaixo para continuar.', - 'bluevine_invoice_factoring' => 'Faturação de Contas', - 'bluevine_conditional_offer' => 'Oferta Condicional', - 'bluevine_credit_line_amount' => 'Linha de Crédito', - 'bluevine_advance_rate' => 'Taxa de Avanço', - 'bluevine_weekly_discount_rate' => 'Taxa de Desconto Semanal', - 'bluevine_minimum_fee_rate' => 'Taxa Mínima', - 'bluevine_line_of_credit' => 'Linha de Crédito', - 'bluevine_interest_rate' => 'Taxa de Juro', - 'bluevine_weekly_draw_rate' => 'Weekly Draw Rate', - 'bluevine_continue' => 'Continuar para BlueVine', - 'bluevine_completed' => 'Registo com o BlueVine concluído', + 'bluevine_create_account' => 'Criar uma conta', + 'quote_types' => 'Pedir orçamento para', + 'invoice_factoring' => 'Faturação de contas', + 'line_of_credit' => 'Linha de crédito', + 'fico_score' => 'Pontuação FICO', + 'business_inception' => 'Data de Criação do Negócio', + 'average_bank_balance' => 'Média do balanço das contas bancárias', + 'annual_revenue' => 'Anual faturado', + 'desired_credit_limit_factoring' => 'Limite de crédito desejado', + 'desired_credit_limit_loc' => 'Limite da linha de crédito desejado', + 'desired_credit_limit' => 'Limite de crédito desejado', + 'bluevine_credit_line_type_required' => 'Deve escolher pelo menos uma', + 'bluevine_field_required' => 'O campo é obrigatório', + 'bluevine_unexpected_error' => 'Ocorreu um erro inesperado.', + 'bluevine_no_conditional_offer' => 'É necessário mais informação antes de obter um orçamento. Clique abaixo para continuar.', + 'bluevine_invoice_factoring' => 'Faturação de Contas', + 'bluevine_conditional_offer' => 'Oferta Condicional', + 'bluevine_credit_line_amount' => 'Linha de Crédito', + 'bluevine_advance_rate' => 'Taxa de Avanço', + 'bluevine_weekly_discount_rate' => 'Taxa de Desconto Semanal', + 'bluevine_minimum_fee_rate' => 'Taxa Mínima', + 'bluevine_line_of_credit' => 'Linha de Crédito', + 'bluevine_interest_rate' => 'Taxa de Juro', + 'bluevine_weekly_draw_rate' => 'Weekly Draw Rate', + 'bluevine_continue' => 'Continuar para BlueVine', + 'bluevine_completed' => 'Registo com o BlueVine concluído', 'vendor_name' => 'Fornecedor', 'entity_state' => 'Estado', @@ -2119,16 +2119,16 @@ Quando tiver os valores dos depósitos, volte a esta página e conclua a verific 'reports_help' => 'Shift + Click to sort by multiple columns, Ctrl + Click to clear the grouping.', 'this_year' => 'Este ano', - // Updated login screen - 'ninja_tagline' => 'Criar. Enviar. Ser Pago.', - 'login_or_existing' => 'Or login with a connected account.', - 'sign_up_now' => 'Inicie sessão agora', - 'not_a_member_yet' => 'Ainda não é membro?', - 'login_create_an_account' => 'Criar uma conta!', - 'client_login' => 'Iniciar sessão como cliente', + // Updated login screen + 'ninja_tagline' => 'Criar. Enviar. Ser Pago.', + 'login_or_existing' => 'Or login with a connected account.', + 'sign_up_now' => 'Inicie sessão agora', + 'not_a_member_yet' => 'Ainda não é membro?', + 'login_create_an_account' => 'Criar uma conta!', + 'client_login' => 'Iniciar sessão como cliente', - // New Client Portal styling - 'invoice_from' => 'Notas de pag. From:', + // New Client Portal styling + 'invoice_from' => 'Notas de pag. From:', 'email_alias_message' => 'Cada empresa deve ter um único email.
Consider utilizar um alias. ex, email+label@example.com', 'full_name' => 'Nome completo', 'month_year' => 'MÊS/ANO', @@ -2423,7 +2423,7 @@ Quando tiver os valores dos depósitos, volte a esta página e conclua a verific 'tax1' => 'First Tax', 'tax2' => 'Second Tax', 'fee_help' => 'Gateway fees are the costs charged for access to the financial networks that handle the processing of online payments.', - 'format_export' => 'Exporting format', + 'format_export' => 'Exporting format', 'custom1' => 'First Custom', 'custom2' => 'Second Custom', 'contact_first_name' => 'Contact First Name', @@ -2860,5 +2860,3 @@ Quando tiver os valores dos depósitos, volte a esta página e conclua a verific ); return $LANG; - -?> diff --git a/resources/lang/ro/texts.php b/resources/lang/ro/texts.php index 539671642c..e7b9a86e03 100644 --- a/resources/lang/ro/texts.php +++ b/resources/lang/ro/texts.php @@ -1965,37 +1965,37 @@ Atentie: Folosește Legacy API Key, nu Token API', 'authorization' => 'Authorization', 'signed' => 'Signed', - // BlueVine - 'bluevine_promo' => 'Get flexible business lines of credit and invoice factoring using BlueVine.', - 'bluevine_modal_label' => 'Sign up with BlueVine', - 'bluevine_modal_text' => '

Fast funding for your business. No paperwork.

+ // BlueVine + 'bluevine_promo' => 'Get flexible business lines of credit and invoice factoring using BlueVine.', + 'bluevine_modal_label' => 'Sign up with BlueVine', + 'bluevine_modal_text' => '

Fast funding for your business. No paperwork.

  • Flexible business lines of credit and invoice factoring.
', - 'bluevine_create_account' => 'Create an account', - 'quote_types' => 'Get a quote for', - 'invoice_factoring' => 'Invoice factoring', - 'line_of_credit' => 'Line of credit', - 'fico_score' => 'Your FICO score', - 'business_inception' => 'Business Inception Date', - 'average_bank_balance' => 'Average bank account balance', - 'annual_revenue' => 'Annual revenue', - 'desired_credit_limit_factoring' => 'Desired invoice factoring limit', - 'desired_credit_limit_loc' => 'Desired line of credit limit', - 'desired_credit_limit' => 'Desired credit limit', - 'bluevine_credit_line_type_required' => 'You must choose at least one', - 'bluevine_field_required' => 'This field is required', - 'bluevine_unexpected_error' => 'An unexpected error occurred.', - 'bluevine_no_conditional_offer' => 'More information is required before getting a quote. Click continue below.', - 'bluevine_invoice_factoring' => 'Invoice Factoring', - 'bluevine_conditional_offer' => 'Conditional Offer', - 'bluevine_credit_line_amount' => 'Credit Line', - 'bluevine_advance_rate' => 'Advance Rate', - 'bluevine_weekly_discount_rate' => 'Weekly Discount Rate', - 'bluevine_minimum_fee_rate' => 'Minimum Fee', - 'bluevine_line_of_credit' => 'Line of Credit', - 'bluevine_interest_rate' => 'Interest Rate', - 'bluevine_weekly_draw_rate' => 'Weekly Draw Rate', - 'bluevine_continue' => 'Continue to BlueVine', - 'bluevine_completed' => 'BlueVine signup completed', + 'bluevine_create_account' => 'Create an account', + 'quote_types' => 'Get a quote for', + 'invoice_factoring' => 'Invoice factoring', + 'line_of_credit' => 'Line of credit', + 'fico_score' => 'Your FICO score', + 'business_inception' => 'Business Inception Date', + 'average_bank_balance' => 'Average bank account balance', + 'annual_revenue' => 'Annual revenue', + 'desired_credit_limit_factoring' => 'Desired invoice factoring limit', + 'desired_credit_limit_loc' => 'Desired line of credit limit', + 'desired_credit_limit' => 'Desired credit limit', + 'bluevine_credit_line_type_required' => 'You must choose at least one', + 'bluevine_field_required' => 'This field is required', + 'bluevine_unexpected_error' => 'An unexpected error occurred.', + 'bluevine_no_conditional_offer' => 'More information is required before getting a quote. Click continue below.', + 'bluevine_invoice_factoring' => 'Invoice Factoring', + 'bluevine_conditional_offer' => 'Conditional Offer', + 'bluevine_credit_line_amount' => 'Credit Line', + 'bluevine_advance_rate' => 'Advance Rate', + 'bluevine_weekly_discount_rate' => 'Weekly Discount Rate', + 'bluevine_minimum_fee_rate' => 'Minimum Fee', + 'bluevine_line_of_credit' => 'Line of Credit', + 'bluevine_interest_rate' => 'Interest Rate', + 'bluevine_weekly_draw_rate' => 'Weekly Draw Rate', + 'bluevine_continue' => 'Continue to BlueVine', + 'bluevine_completed' => 'BlueVine signup completed', 'vendor_name' => 'Vendor', 'entity_state' => 'State', @@ -2129,16 +2129,16 @@ Atentie: Folosește Legacy API Key, nu Token API', 'reports_help' => 'Shift + Click to sort by multiple columns, Ctrl + Click to clear the grouping.', 'this_year' => 'This Year', - // Updated login screen - 'ninja_tagline' => 'Create. Send. Get Paid.', - 'login_or_existing' => 'Or login with a connected account.', - 'sign_up_now' => 'Sign Up Now', - 'not_a_member_yet' => 'Not a member yet?', - 'login_create_an_account' => 'Create an Account!', - 'client_login' => 'Client Login', + // Updated login screen + 'ninja_tagline' => 'Create. Send. Get Paid.', + 'login_or_existing' => 'Or login with a connected account.', + 'sign_up_now' => 'Sign Up Now', + 'not_a_member_yet' => 'Not a member yet?', + 'login_create_an_account' => 'Create an Account!', + 'client_login' => 'Client Login', - // New Client Portal styling - 'invoice_from' => 'Invoices From:', + // New Client Portal styling + 'invoice_from' => 'Invoices From:', 'email_alias_message' => 'We require each company to have a unique email address.
Consider using an alias. ie, email+label@example.com', 'full_name' => 'Full Name', 'month_year' => 'MONTH/YEAR', @@ -2433,7 +2433,7 @@ Atentie: Folosește Legacy API Key, nu Token API', 'tax1' => 'First Tax', 'tax2' => 'Second Tax', 'fee_help' => 'Gateway fees are the costs charged for access to the financial networks that handle the processing of online payments.', - 'format_export' => 'Exporting format', + 'format_export' => 'Exporting format', 'custom1' => 'First Custom', 'custom2' => 'Second Custom', 'contact_first_name' => 'Contact First Name', @@ -2870,5 +2870,3 @@ Atentie: Folosește Legacy API Key, nu Token API', ); return $LANG; - -?> diff --git a/resources/lang/sl/texts.php b/resources/lang/sl/texts.php index 11325f8e77..d856d4cf6a 100644 --- a/resources/lang/sl/texts.php +++ b/resources/lang/sl/texts.php @@ -1960,37 +1960,37 @@ Ko imate zneske, se vrnite na to stran plačilnega sredstva in kliknite na "Comp 'authorization' => 'Overovitev', 'signed' => 'Podpisan', - // BlueVine - 'bluevine_promo' => 'Pridobi prilagodljiva poslovna področja kreditiranja in odkup računov z uporabo BlueVine.', - 'bluevine_modal_label' => 'Prijavi se z BlueVine', - 'bluevine_modal_text' => '

Hitro financiranje za vaše podjetje. Brez papirologije

+ // BlueVine + 'bluevine_promo' => 'Pridobi prilagodljiva poslovna področja kreditiranja in odkup računov z uporabo BlueVine.', + 'bluevine_modal_label' => 'Prijavi se z BlueVine', + 'bluevine_modal_text' => '

Hitro financiranje za vaše podjetje. Brez papirologije

  • Prožna poslovna področja kreditiranja in odkup računov.
', - 'bluevine_create_account' => 'Ustvari račun', - 'quote_types' => 'Pridobi predračun za', - 'invoice_factoring' => 'Odkup računov', - 'line_of_credit' => 'Kreditna linija', - 'fico_score' => 'Vaša FICO ocena', - 'business_inception' => 'Datum ustanovitve podjetja', - 'average_bank_balance' => 'Povprečni saldo bančnega računa', - 'annual_revenue' => 'Letni prihodki', - 'desired_credit_limit_factoring' => 'Željena omejitev odkupa računa', - 'desired_credit_limit_loc' => 'Željena omejitev kreditne linije', - 'desired_credit_limit' => 'Željena omejitev kredita', - 'bluevine_credit_line_type_required' => 'Izbrati morate vsaj eno', - 'bluevine_field_required' => 'To polje je obvezno', - 'bluevine_unexpected_error' => 'Zgodila se je nepričakovana napaka.', - 'bluevine_no_conditional_offer' => 'Preden pošljemo predračun potrebujemo več informacij. Kliknite spodaj za nadaljevanje.', - 'bluevine_invoice_factoring' => 'Odkup računov', - 'bluevine_conditional_offer' => 'Pogojno ponudba', - 'bluevine_credit_line_amount' => 'Kreditna linija', - 'bluevine_advance_rate' => 'Izboljšana stopnja', - 'bluevine_weekly_discount_rate' => 'Tedenska stopnja popusta', - 'bluevine_minimum_fee_rate' => 'Minimalna provizija', - 'bluevine_line_of_credit' => 'Kreditna linija', - 'bluevine_interest_rate' => 'Obrestna mera', - 'bluevine_weekly_draw_rate' => 'Tedenska mera', - 'bluevine_continue' => 'Nadaljuj v BlueVine', - 'bluevine_completed' => 'BlueVine prijava končana', + 'bluevine_create_account' => 'Ustvari račun', + 'quote_types' => 'Pridobi predračun za', + 'invoice_factoring' => 'Odkup računov', + 'line_of_credit' => 'Kreditna linija', + 'fico_score' => 'Vaša FICO ocena', + 'business_inception' => 'Datum ustanovitve podjetja', + 'average_bank_balance' => 'Povprečni saldo bančnega računa', + 'annual_revenue' => 'Letni prihodki', + 'desired_credit_limit_factoring' => 'Željena omejitev odkupa računa', + 'desired_credit_limit_loc' => 'Željena omejitev kreditne linije', + 'desired_credit_limit' => 'Željena omejitev kredita', + 'bluevine_credit_line_type_required' => 'Izbrati morate vsaj eno', + 'bluevine_field_required' => 'To polje je obvezno', + 'bluevine_unexpected_error' => 'Zgodila se je nepričakovana napaka.', + 'bluevine_no_conditional_offer' => 'Preden pošljemo predračun potrebujemo več informacij. Kliknite spodaj za nadaljevanje.', + 'bluevine_invoice_factoring' => 'Odkup računov', + 'bluevine_conditional_offer' => 'Pogojno ponudba', + 'bluevine_credit_line_amount' => 'Kreditna linija', + 'bluevine_advance_rate' => 'Izboljšana stopnja', + 'bluevine_weekly_discount_rate' => 'Tedenska stopnja popusta', + 'bluevine_minimum_fee_rate' => 'Minimalna provizija', + 'bluevine_line_of_credit' => 'Kreditna linija', + 'bluevine_interest_rate' => 'Obrestna mera', + 'bluevine_weekly_draw_rate' => 'Tedenska mera', + 'bluevine_continue' => 'Nadaljuj v BlueVine', + 'bluevine_completed' => 'BlueVine prijava končana', 'vendor_name' => 'Prodajalec', 'entity_state' => 'Stanje', @@ -2124,16 +2124,16 @@ Ko imate zneske, se vrnite na to stran plačilnega sredstva in kliknite na "Comp 'reports_help' => 'Shift + Click to sort by multiple columns, Ctrl + Click to clear the grouping.', 'this_year' => 'To leto', - // Updated login screen - 'ninja_tagline' => 'Ustvari. Pošlji. Prejmi Plačilo.', - 'login_or_existing' => 'Ali pa se prijavite s povezanim računom', - 'sign_up_now' => 'Prijavi se', - 'not_a_member_yet' => 'Še nisi član?', - 'login_create_an_account' => 'Ustvari račun!', - 'client_login' => 'Vpis stranke', + // Updated login screen + 'ninja_tagline' => 'Ustvari. Pošlji. Prejmi Plačilo.', + 'login_or_existing' => 'Ali pa se prijavite s povezanim računom', + 'sign_up_now' => 'Prijavi se', + 'not_a_member_yet' => 'Še nisi član?', + 'login_create_an_account' => 'Ustvari račun!', + 'client_login' => 'Vpis stranke', - // New Client Portal styling - 'invoice_from' => 'Računi za:', + // New Client Portal styling + 'invoice_from' => 'Računi za:', 'email_alias_message' => 'Vsako podjetje potrebuje unikaten e-poštni naslov.
Razmislite o uporabi vzdevka, kot na primer: naslov+oznaka@primer.si', 'full_name' => 'Polno ime', 'month_year' => 'MESEC/LETO', @@ -2428,7 +2428,7 @@ Ko imate zneske, se vrnite na to stran plačilnega sredstva in kliknite na "Comp 'tax1' => 'Prvi davek', 'tax2' => 'Drugi davek', 'fee_help' => 'Gateway fees are the costs charged for access to the financial networks that handle the processing of online payments.', - 'format_export' => 'Exporting format', + 'format_export' => 'Exporting format', 'custom1' => 'First Custom', 'custom2' => 'Second Custom', 'contact_first_name' => 'Contact First Name', @@ -2865,5 +2865,3 @@ Ko imate zneske, se vrnite na to stran plačilnega sredstva in kliknite na "Comp ); return $LANG; - -?> diff --git a/resources/lang/sq/texts.php b/resources/lang/sq/texts.php index 12e6753ed3..0b3548edd7 100755 --- a/resources/lang/sq/texts.php +++ b/resources/lang/sq/texts.php @@ -1961,37 +1961,37 @@ Pasi të keni pranuar shumat, kthehuni në faqen e metodave të pagesës dhe kli 'authorization' => 'Authorization', 'signed' => 'Signed', - // BlueVine - 'bluevine_promo' => 'Get flexible business lines of credit and invoice factoring using BlueVine.', - 'bluevine_modal_label' => 'Sign up with BlueVine', - 'bluevine_modal_text' => '

Fast funding for your business. No paperwork.

+ // BlueVine + 'bluevine_promo' => 'Get flexible business lines of credit and invoice factoring using BlueVine.', + 'bluevine_modal_label' => 'Sign up with BlueVine', + 'bluevine_modal_text' => '

Fast funding for your business. No paperwork.

  • Flexible business lines of credit and invoice factoring.
', - 'bluevine_create_account' => 'Create an account', - 'quote_types' => 'Get a quote for', - 'invoice_factoring' => 'Invoice factoring', - 'line_of_credit' => 'Line of credit', - 'fico_score' => 'Your FICO score', - 'business_inception' => 'Business Inception Date', - 'average_bank_balance' => 'Average bank account balance', - 'annual_revenue' => 'Annual revenue', - 'desired_credit_limit_factoring' => 'Desired invoice factoring limit', - 'desired_credit_limit_loc' => 'Desired line of credit limit', - 'desired_credit_limit' => 'Desired credit limit', - 'bluevine_credit_line_type_required' => 'You must choose at least one', - 'bluevine_field_required' => 'This field is required', - 'bluevine_unexpected_error' => 'An unexpected error occurred.', - 'bluevine_no_conditional_offer' => 'More information is required before getting a quote. Click continue below.', - 'bluevine_invoice_factoring' => 'Invoice Factoring', - 'bluevine_conditional_offer' => 'Conditional Offer', - 'bluevine_credit_line_amount' => 'Credit Line', - 'bluevine_advance_rate' => 'Advance Rate', - 'bluevine_weekly_discount_rate' => 'Weekly Discount Rate', - 'bluevine_minimum_fee_rate' => 'Minimum Fee', - 'bluevine_line_of_credit' => 'Line of Credit', - 'bluevine_interest_rate' => 'Interest Rate', - 'bluevine_weekly_draw_rate' => 'Weekly Draw Rate', - 'bluevine_continue' => 'Continue to BlueVine', - 'bluevine_completed' => 'BlueVine signup completed', + 'bluevine_create_account' => 'Create an account', + 'quote_types' => 'Get a quote for', + 'invoice_factoring' => 'Invoice factoring', + 'line_of_credit' => 'Line of credit', + 'fico_score' => 'Your FICO score', + 'business_inception' => 'Business Inception Date', + 'average_bank_balance' => 'Average bank account balance', + 'annual_revenue' => 'Annual revenue', + 'desired_credit_limit_factoring' => 'Desired invoice factoring limit', + 'desired_credit_limit_loc' => 'Desired line of credit limit', + 'desired_credit_limit' => 'Desired credit limit', + 'bluevine_credit_line_type_required' => 'You must choose at least one', + 'bluevine_field_required' => 'This field is required', + 'bluevine_unexpected_error' => 'An unexpected error occurred.', + 'bluevine_no_conditional_offer' => 'More information is required before getting a quote. Click continue below.', + 'bluevine_invoice_factoring' => 'Invoice Factoring', + 'bluevine_conditional_offer' => 'Conditional Offer', + 'bluevine_credit_line_amount' => 'Credit Line', + 'bluevine_advance_rate' => 'Advance Rate', + 'bluevine_weekly_discount_rate' => 'Weekly Discount Rate', + 'bluevine_minimum_fee_rate' => 'Minimum Fee', + 'bluevine_line_of_credit' => 'Line of Credit', + 'bluevine_interest_rate' => 'Interest Rate', + 'bluevine_weekly_draw_rate' => 'Weekly Draw Rate', + 'bluevine_continue' => 'Continue to BlueVine', + 'bluevine_completed' => 'BlueVine signup completed', 'vendor_name' => 'Vendor', 'entity_state' => 'State', @@ -2125,16 +2125,16 @@ Pasi të keni pranuar shumat, kthehuni në faqen e metodave të pagesës dhe kli 'reports_help' => 'Shift + Click to sort by multiple columns, Ctrl + Click to clear the grouping.', 'this_year' => 'This Year', - // Updated login screen - 'ninja_tagline' => 'Create. Send. Get Paid.', - 'login_or_existing' => 'Or login with a connected account.', - 'sign_up_now' => 'Sign Up Now', - 'not_a_member_yet' => 'Not a member yet?', - 'login_create_an_account' => 'Create an Account!', - 'client_login' => 'Client Login', + // Updated login screen + 'ninja_tagline' => 'Create. Send. Get Paid.', + 'login_or_existing' => 'Or login with a connected account.', + 'sign_up_now' => 'Sign Up Now', + 'not_a_member_yet' => 'Not a member yet?', + 'login_create_an_account' => 'Create an Account!', + 'client_login' => 'Client Login', - // New Client Portal styling - 'invoice_from' => 'Invoices From:', + // New Client Portal styling + 'invoice_from' => 'Invoices From:', 'email_alias_message' => 'We require each company to have a unique email address.
Consider using an alias. ie, email+label@example.com', 'full_name' => 'Full Name', 'month_year' => 'MONTH/YEAR', @@ -2429,7 +2429,7 @@ Pasi të keni pranuar shumat, kthehuni në faqen e metodave të pagesës dhe kli 'tax1' => 'First Tax', 'tax2' => 'Second Tax', 'fee_help' => 'Gateway fees are the costs charged for access to the financial networks that handle the processing of online payments.', - 'format_export' => 'Exporting format', + 'format_export' => 'Exporting format', 'custom1' => 'First Custom', 'custom2' => 'Second Custom', 'contact_first_name' => 'Contact First Name', @@ -2866,5 +2866,3 @@ Pasi të keni pranuar shumat, kthehuni në faqen e metodave të pagesës dhe kli ); return $LANG; - -?> diff --git a/resources/lang/sv/texts.php b/resources/lang/sv/texts.php index 37342d9a3d..98f0eb7266 100644 --- a/resources/lang/sv/texts.php +++ b/resources/lang/sv/texts.php @@ -1969,37 +1969,37 @@ Den här funktionen kräver att en produkt skapas och en betalningsgateway är k 'authorization' => 'Tillstånd', 'signed' => 'Signerad', - // BlueVine - 'bluevine_promo' => 'Få flexibla affärssystem krediter och fakturabelåning hjälp BlueVine.', - 'bluevine_modal_label' => 'Registrera med BlueVine', - 'bluevine_modal_text' => '

Snabb finansiering av ditt företag. Inget pappersarbete.

+ // BlueVine + 'bluevine_promo' => 'Få flexibla affärssystem krediter och fakturabelåning hjälp BlueVine.', + 'bluevine_modal_label' => 'Registrera med BlueVine', + 'bluevine_modal_text' => '

Snabb finansiering av ditt företag. Inget pappersarbete.

  • Flexibel kredit och fakturaköp.
', - 'bluevine_create_account' => 'Skapa konto', - 'quote_types' => 'Få offertför', - 'invoice_factoring' => 'Faktura facto', - 'line_of_credit' => 'Kredit', - 'fico_score' => 'Din FICO poäng', - 'business_inception' => 'Affärs startkod', - 'average_bank_balance' => 'Genomsnitt bankkonto balans.', - 'annual_revenue' => 'Årsomsättning', - 'desired_credit_limit_factoring' => 'Önskad faktura factogräns', - 'desired_credit_limit_loc' => 'Önskad kreditgräns', - 'desired_credit_limit' => 'Önskad kreditgräns', - 'bluevine_credit_line_type_required' => 'Du måste välja minst en', - 'bluevine_field_required' => 'Detta fält krävs', - 'bluevine_unexpected_error' => 'Ett oförutsett fel uppkom.', - 'bluevine_no_conditional_offer' => 'Mer information krävs innan ni får en offert. Vänligen klicka nedan.', - 'bluevine_invoice_factoring' => 'Faktura facto', - 'bluevine_conditional_offer' => 'Villkorligt erbjudande', - 'bluevine_credit_line_amount' => 'Kredit linje', - 'bluevine_advance_rate' => 'Matningshastighet', - 'bluevine_weekly_discount_rate' => 'Veckorabattsats', - 'bluevine_minimum_fee_rate' => 'Minimiavgift', - 'bluevine_line_of_credit' => 'Kreditlinje', - 'bluevine_interest_rate' => 'Ränta', - 'bluevine_weekly_draw_rate' => 'Vecko dratakt', - 'bluevine_continue' => 'Fortsätt till BlueVine', - 'bluevine_completed' => 'BlueVine registrering slutförd', + 'bluevine_create_account' => 'Skapa konto', + 'quote_types' => 'Få offertför', + 'invoice_factoring' => 'Faktura facto', + 'line_of_credit' => 'Kredit', + 'fico_score' => 'Din FICO poäng', + 'business_inception' => 'Affärs startkod', + 'average_bank_balance' => 'Genomsnitt bankkonto balans.', + 'annual_revenue' => 'Årsomsättning', + 'desired_credit_limit_factoring' => 'Önskad faktura factogräns', + 'desired_credit_limit_loc' => 'Önskad kreditgräns', + 'desired_credit_limit' => 'Önskad kreditgräns', + 'bluevine_credit_line_type_required' => 'Du måste välja minst en', + 'bluevine_field_required' => 'Detta fält krävs', + 'bluevine_unexpected_error' => 'Ett oförutsett fel uppkom.', + 'bluevine_no_conditional_offer' => 'Mer information krävs innan ni får en offert. Vänligen klicka nedan.', + 'bluevine_invoice_factoring' => 'Faktura facto', + 'bluevine_conditional_offer' => 'Villkorligt erbjudande', + 'bluevine_credit_line_amount' => 'Kredit linje', + 'bluevine_advance_rate' => 'Matningshastighet', + 'bluevine_weekly_discount_rate' => 'Veckorabattsats', + 'bluevine_minimum_fee_rate' => 'Minimiavgift', + 'bluevine_line_of_credit' => 'Kreditlinje', + 'bluevine_interest_rate' => 'Ränta', + 'bluevine_weekly_draw_rate' => 'Vecko dratakt', + 'bluevine_continue' => 'Fortsätt till BlueVine', + 'bluevine_completed' => 'BlueVine registrering slutförd', 'vendor_name' => 'Leverantör', 'entity_state' => 'Tillstånd', @@ -2134,16 +2134,16 @@ Den här funktionen kräver att en produkt skapas och en betalningsgateway är k 'reports_help' => 'Shift + Click to sort by multiple columns, Ctrl + Click to clear the grouping.', 'this_year' => 'Detta året', - // Updated login screen - 'ninja_tagline' => 'Skapa. Skicka. Få betalt.', - 'login_or_existing' => 'Eller logga in med ett kopplat konto.', - 'sign_up_now' => 'Ansök nu', - 'not_a_member_yet' => 'Inte medlem ännu?', - 'login_create_an_account' => 'Skapa ett konto!', - 'client_login' => 'Kund inlogg', + // Updated login screen + 'ninja_tagline' => 'Skapa. Skicka. Få betalt.', + 'login_or_existing' => 'Eller logga in med ett kopplat konto.', + 'sign_up_now' => 'Ansök nu', + 'not_a_member_yet' => 'Inte medlem ännu?', + 'login_create_an_account' => 'Skapa ett konto!', + 'client_login' => 'Kund inlogg', - // New Client Portal styling - 'invoice_from' => 'Fakturor från:', + // New Client Portal styling + 'invoice_from' => 'Fakturor från:', 'email_alias_message' => 'Vi kräver att varje företag har en unik epost.
Överväg att använda ett alias. T.ex. email+label@example.com', 'full_name' => 'Hela namnet', 'month_year' => 'MÅNAD/ÅR', @@ -2438,7 +2438,7 @@ Den här funktionen kräver att en produkt skapas och en betalningsgateway är k 'tax1' => 'Första moms', 'tax2' => 'Andra moms', 'fee_help' => 'Gateway fees are the costs charged for access to the financial networks that handle the processing of online payments.', - 'format_export' => 'Exporteringsformat', + 'format_export' => 'Exporteringsformat', 'custom1' => 'First Custom', 'custom2' => 'Second Custom', 'contact_first_name' => 'Contact First Name', @@ -2875,5 +2875,3 @@ Den här funktionen kräver att en produkt skapas och en betalningsgateway är k ); return $LANG; - -?> diff --git a/resources/lang/th/texts.php b/resources/lang/th/texts.php index d617e6eda3..a5ceefd066 100644 --- a/resources/lang/th/texts.php +++ b/resources/lang/th/texts.php @@ -1965,37 +1965,37 @@ $LANG = array( 'authorization' => 'การอนุญาต', 'signed' => 'ลงนาม', - // BlueVine - 'bluevine_promo' => 'เพิ่มความคล่องตัวในการทำธุรกิจเครดิตและแฟ็กทีฟแฟคตอริ่งโดยใช้ BlueVine', - 'bluevine_modal_label' => 'ลงทะเบียนกับ BlueVine', - 'bluevine_modal_text' => '

การระดมทุนอย่างรวดเร็วสำหรับธุรกิจของคุณ ไม่ต้องมีเอกสาร

+ // BlueVine + 'bluevine_promo' => 'เพิ่มความคล่องตัวในการทำธุรกิจเครดิตและแฟ็กทีฟแฟคตอริ่งโดยใช้ BlueVine', + 'bluevine_modal_label' => 'ลงทะเบียนกับ BlueVine', + 'bluevine_modal_text' => '

การระดมทุนอย่างรวดเร็วสำหรับธุรกิจของคุณ ไม่ต้องมีเอกสาร

  • สายธุรกิจที่ยืดหยุ่นของสินเชื่อและแฟ็กเรียลแฟกเตอริ่ง
', - 'bluevine_create_account' => 'สร้างบัญชี', - 'quote_types' => 'รับใบเสนอราคาสำหรับ', - 'invoice_factoring' => 'Invoice factoring', - 'line_of_credit' => 'วงเงิน', - 'fico_score' => 'คะแนน FICO ของคุณ', - 'business_inception' => 'วันที่จดทะเบียนกองทุน', - 'average_bank_balance' => 'ยอดคงเหลือในบัญชีธนาคารโดยเฉลี่ย', - 'annual_revenue' => 'รายได้ประจำปี', - 'desired_credit_limit_factoring' => 'วงเงินแฟคเตอริ่งที่ต้องการ', - 'desired_credit_limit_loc' => 'วงเงินเครดิตสูงสุดที่ต้องการ', - 'desired_credit_limit' => 'วงเงินเครดิตที่ต้องการ', - 'bluevine_credit_line_type_required' => 'คุณต้องเลือกอย่างน้อยหนึ่งอย่าง', - 'bluevine_field_required' => 'ต้องระบุข้อมูลนี้', - 'bluevine_unexpected_error' => 'เกิดความผิดพลาดอย่างไม่ได้คาดคิด.', - 'bluevine_no_conditional_offer' => 'ต้องการข้อมูลเพิ่มเติมก่อนรับใบเสนอราคา คลิกดำเนินการต่อด้านล่าง.', - 'bluevine_invoice_factoring' => 'Invoice Factoring', - 'bluevine_conditional_offer' => 'ข้อเสนอที่มีเงื่อนไข', - 'bluevine_credit_line_amount' => 'วงเงิน', - 'bluevine_advance_rate' => 'อัตราค่าบริการล่วงหน้า', - 'bluevine_weekly_discount_rate' => 'อัตราส่วนลดรายสัปดาห์', - 'bluevine_minimum_fee_rate' => 'ค่าธรรมเนียมขั้นต่ำ', - 'bluevine_line_of_credit' => 'วงเงินสูงสุด', - 'bluevine_interest_rate' => 'อัตราดอกเบี้ย', - 'bluevine_weekly_draw_rate' => 'Weekly Draw Rate', - 'bluevine_continue' => 'ไปที่ BlueVine', - 'bluevine_completed' => 'สมัคร BlueVine เรียบร้อยแล้ว', + 'bluevine_create_account' => 'สร้างบัญชี', + 'quote_types' => 'รับใบเสนอราคาสำหรับ', + 'invoice_factoring' => 'Invoice factoring', + 'line_of_credit' => 'วงเงิน', + 'fico_score' => 'คะแนน FICO ของคุณ', + 'business_inception' => 'วันที่จดทะเบียนกองทุน', + 'average_bank_balance' => 'ยอดคงเหลือในบัญชีธนาคารโดยเฉลี่ย', + 'annual_revenue' => 'รายได้ประจำปี', + 'desired_credit_limit_factoring' => 'วงเงินแฟคเตอริ่งที่ต้องการ', + 'desired_credit_limit_loc' => 'วงเงินเครดิตสูงสุดที่ต้องการ', + 'desired_credit_limit' => 'วงเงินเครดิตที่ต้องการ', + 'bluevine_credit_line_type_required' => 'คุณต้องเลือกอย่างน้อยหนึ่งอย่าง', + 'bluevine_field_required' => 'ต้องระบุข้อมูลนี้', + 'bluevine_unexpected_error' => 'เกิดความผิดพลาดอย่างไม่ได้คาดคิด.', + 'bluevine_no_conditional_offer' => 'ต้องการข้อมูลเพิ่มเติมก่อนรับใบเสนอราคา คลิกดำเนินการต่อด้านล่าง.', + 'bluevine_invoice_factoring' => 'Invoice Factoring', + 'bluevine_conditional_offer' => 'ข้อเสนอที่มีเงื่อนไข', + 'bluevine_credit_line_amount' => 'วงเงิน', + 'bluevine_advance_rate' => 'อัตราค่าบริการล่วงหน้า', + 'bluevine_weekly_discount_rate' => 'อัตราส่วนลดรายสัปดาห์', + 'bluevine_minimum_fee_rate' => 'ค่าธรรมเนียมขั้นต่ำ', + 'bluevine_line_of_credit' => 'วงเงินสูงสุด', + 'bluevine_interest_rate' => 'อัตราดอกเบี้ย', + 'bluevine_weekly_draw_rate' => 'Weekly Draw Rate', + 'bluevine_continue' => 'ไปที่ BlueVine', + 'bluevine_completed' => 'สมัคร BlueVine เรียบร้อยแล้ว', 'vendor_name' => 'ผู้ขาย', 'entity_state' => 'สถานะ', @@ -2129,16 +2129,16 @@ $LANG = array( 'reports_help' => 'Shift + Click to sort by multiple columns, Ctrl + Click to clear the grouping.', 'this_year' => 'ปีนี้', - // Updated login screen - 'ninja_tagline' => 'สร้าง. ส่ง. รับเงิน', - 'login_or_existing' => 'Or login with a connected account.', - 'sign_up_now' => 'สมัครตอนนี้เลย', - 'not_a_member_yet' => 'ยังไม่เป็นสมาชิก', - 'login_create_an_account' => 'สร้างบัญชี!', - 'client_login' => 'เข้าสู่ระบบลูกค้า', + // Updated login screen + 'ninja_tagline' => 'สร้าง. ส่ง. รับเงิน', + 'login_or_existing' => 'Or login with a connected account.', + 'sign_up_now' => 'สมัครตอนนี้เลย', + 'not_a_member_yet' => 'ยังไม่เป็นสมาชิก', + 'login_create_an_account' => 'สร้างบัญชี!', + 'client_login' => 'เข้าสู่ระบบลูกค้า', - // New Client Portal styling - 'invoice_from' => 'ใบแจ้งหนี้จาก:', + // New Client Portal styling + 'invoice_from' => 'ใบแจ้งหนี้จาก:', 'email_alias_message' => 'เราต้องการให้ บริษัท แต่ละแห่งมีที่อยู่อีเมลที่ไม่ซ้ำกัน.
พิจารณาใช้นามแฝง เช่น email+label@example.com', 'full_name' => 'ชื่อเต็ม', 'month_year' => 'เดือน/ปี', @@ -2433,7 +2433,7 @@ $LANG = array( 'tax1' => 'ภาษีส่วนที่หนึ่ง', 'tax2' => 'ภาษีส่วนที่สอง', 'fee_help' => 'ค่าใช้จ่ายที่เกิดขึ้นขึ้นอยู่กับสถาบันการเงินที่ใช้ชำระ', - 'format_export' => 'ไฟล์ที่ส่งออก', + 'format_export' => 'ไฟล์ที่ส่งออก', 'custom1' => 'กำหนดเองครั้งแรก', 'custom2' => 'กำหนดเองครั้งที่สอง', 'contact_first_name' => 'ชื่อที่ติดต่อ', @@ -2870,5 +2870,3 @@ $LANG = array( ); return $LANG; - -?> diff --git a/resources/lang/tr_TR/texts.php b/resources/lang/tr_TR/texts.php index a6539b97a3..7571a3ecbd 100644 --- a/resources/lang/tr_TR/texts.php +++ b/resources/lang/tr_TR/texts.php @@ -1962,37 +1962,37 @@ adresine gönderildi. Müthiş tüm özelliklerin kilidini açmak için lütfen 'authorization' => 'Authorization', 'signed' => 'Signed', - // BlueVine - 'bluevine_promo' => 'Get flexible business lines of credit and invoice factoring using BlueVine.', - 'bluevine_modal_label' => 'Sign up with BlueVine', - 'bluevine_modal_text' => '

Fast funding for your business. No paperwork.

+ // BlueVine + 'bluevine_promo' => 'Get flexible business lines of credit and invoice factoring using BlueVine.', + 'bluevine_modal_label' => 'Sign up with BlueVine', + 'bluevine_modal_text' => '

Fast funding for your business. No paperwork.

  • Flexible business lines of credit and invoice factoring.
', - 'bluevine_create_account' => 'Hesap oluştur', - 'quote_types' => 'Fiyat teklifi al', - 'invoice_factoring' => 'Fatura faktoringi', - 'line_of_credit' => 'Kredi limiti', - 'fico_score' => 'FICO skorunuz', - 'business_inception' => 'İş Başlangıç Tarihi', - 'average_bank_balance' => 'Ortalama banka hesabı bakiyesi', - 'annual_revenue' => 'Yıllık gelir', - 'desired_credit_limit_factoring' => 'İstenilen fatura faktoring limiti', - 'desired_credit_limit_loc' => 'İstenilen kredi limiti', - 'desired_credit_limit' => 'İstenilen kredi limiti', - 'bluevine_credit_line_type_required' => 'En az birini seçmelisiniz', - 'bluevine_field_required' => 'Bu alan gereklidir', - 'bluevine_unexpected_error' => 'Beklenmedik bir hata oluştu.', - 'bluevine_no_conditional_offer' => 'Teklif almadan önce daha fazla bilgi gereklidir. Aşağıdaki devam linkine tıklayın.', - 'bluevine_invoice_factoring' => 'Fatura Faktoringi', - 'bluevine_conditional_offer' => 'Koşullu teklif', - 'bluevine_credit_line_amount' => 'Kredi Limiti', - 'bluevine_advance_rate' => 'Avans Oranı', - 'bluevine_weekly_discount_rate' => 'Haftalık İskonto Oranı', - 'bluevine_minimum_fee_rate' => 'Minimum Ücret', - 'bluevine_line_of_credit' => 'Kredi sınırı', - 'bluevine_interest_rate' => 'Faiz oranı', - 'bluevine_weekly_draw_rate' => 'Haftalık Çekme Oranı', - 'bluevine_continue' => 'BlueVine\'e devam et', - 'bluevine_completed' => 'BlueVine kayıt tamamlandı', + 'bluevine_create_account' => 'Hesap oluştur', + 'quote_types' => 'Fiyat teklifi al', + 'invoice_factoring' => 'Fatura faktoringi', + 'line_of_credit' => 'Kredi limiti', + 'fico_score' => 'FICO skorunuz', + 'business_inception' => 'İş Başlangıç Tarihi', + 'average_bank_balance' => 'Ortalama banka hesabı bakiyesi', + 'annual_revenue' => 'Yıllık gelir', + 'desired_credit_limit_factoring' => 'İstenilen fatura faktoring limiti', + 'desired_credit_limit_loc' => 'İstenilen kredi limiti', + 'desired_credit_limit' => 'İstenilen kredi limiti', + 'bluevine_credit_line_type_required' => 'En az birini seçmelisiniz', + 'bluevine_field_required' => 'Bu alan gereklidir', + 'bluevine_unexpected_error' => 'Beklenmedik bir hata oluştu.', + 'bluevine_no_conditional_offer' => 'Teklif almadan önce daha fazla bilgi gereklidir. Aşağıdaki devam linkine tıklayın.', + 'bluevine_invoice_factoring' => 'Fatura Faktoringi', + 'bluevine_conditional_offer' => 'Koşullu teklif', + 'bluevine_credit_line_amount' => 'Kredi Limiti', + 'bluevine_advance_rate' => 'Avans Oranı', + 'bluevine_weekly_discount_rate' => 'Haftalık İskonto Oranı', + 'bluevine_minimum_fee_rate' => 'Minimum Ücret', + 'bluevine_line_of_credit' => 'Kredi sınırı', + 'bluevine_interest_rate' => 'Faiz oranı', + 'bluevine_weekly_draw_rate' => 'Haftalık Çekme Oranı', + 'bluevine_continue' => 'BlueVine\'e devam et', + 'bluevine_completed' => 'BlueVine kayıt tamamlandı', 'vendor_name' => 'Tedarikçi', 'entity_state' => 'Durum', @@ -2126,16 +2126,16 @@ adresine gönderildi. Müthiş tüm özelliklerin kilidini açmak için lütfen 'reports_help' => 'Shift + Click to sort by multiple columns, Ctrl + Click to clear the grouping.', 'this_year' => 'This Year', - // Updated login screen - 'ninja_tagline' => 'Create. Send. Get Paid.', - 'login_or_existing' => 'Or login with a connected account.', - 'sign_up_now' => 'Sign Up Now', - 'not_a_member_yet' => 'Not a member yet?', - 'login_create_an_account' => 'Create an Account!', - 'client_login' => 'Client Login', + // Updated login screen + 'ninja_tagline' => 'Create. Send. Get Paid.', + 'login_or_existing' => 'Or login with a connected account.', + 'sign_up_now' => 'Sign Up Now', + 'not_a_member_yet' => 'Not a member yet?', + 'login_create_an_account' => 'Create an Account!', + 'client_login' => 'Client Login', - // New Client Portal styling - 'invoice_from' => 'Invoices From:', + // New Client Portal styling + 'invoice_from' => 'Invoices From:', 'email_alias_message' => 'We require each company to have a unique email address.
Consider using an alias. ie, email+label@example.com', 'full_name' => 'Full Name', 'month_year' => 'MONTH/YEAR', @@ -2430,7 +2430,7 @@ adresine gönderildi. Müthiş tüm özelliklerin kilidini açmak için lütfen 'tax1' => 'First Tax', 'tax2' => 'Second Tax', 'fee_help' => 'Gateway fees are the costs charged for access to the financial networks that handle the processing of online payments.', - 'format_export' => 'Dışa aktarma formatı', + 'format_export' => 'Dışa aktarma formatı', 'custom1' => 'First Custom', 'custom2' => 'Second Custom', 'contact_first_name' => 'Contact First Name', @@ -2867,5 +2867,3 @@ adresine gönderildi. Müthiş tüm özelliklerin kilidini açmak için lütfen ); return $LANG; - -?> diff --git a/resources/lang/zh_TW/texts.php b/resources/lang/zh_TW/texts.php index 5fbde2990a..3390d4a6fe 100644 --- a/resources/lang/zh_TW/texts.php +++ b/resources/lang/zh_TW/texts.php @@ -1961,37 +1961,37 @@ $LANG = array( 'authorization' => '許可', 'signed' => '已簽署', - // BlueVine - 'bluevine_promo' => '使用BlueVine,以彈性的商營運方式進行貸款與發票結帳。', - 'bluevine_modal_label' => '透過BlueVine登入', - 'bluevine_modal_text' => '

快速建立您的企業。無紙化。

+ // BlueVine + 'bluevine_promo' => '使用BlueVine,以彈性的商營運方式進行貸款與發票結帳。', + 'bluevine_modal_label' => '透過BlueVine登入', + 'bluevine_modal_text' => '

快速建立您的企業。無紙化。

  • 以彈性的商營運方式進行貸款與發票結帳。
', - 'bluevine_create_account' => '建立一個帳號', - 'quote_types' => '取得報價單', - 'invoice_factoring' => '開立應收帳款承購的發票', - 'line_of_credit' => '貸款額度', - 'fico_score' => '您的FICO分數', - 'business_inception' => '營運起始日', - 'average_bank_balance' => '平均銀行帳戶餘額', - 'annual_revenue' => '年收入', - 'desired_credit_limit_factoring' => '希望設定的發票貼現限額', - 'desired_credit_limit_loc' => '希望的貸款限額基準線', - 'desired_credit_limit' => '希望的貸款額度。', - 'bluevine_credit_line_type_required' => '您必須至少選擇一項', - 'bluevine_field_required' => '此欄位為必填', - 'bluevine_unexpected_error' => '發生為預期的錯誤。', - 'bluevine_no_conditional_offer' => '取得報價單之前,需提供更多資訊。點擊以下繼續。', - 'bluevine_invoice_factoring' => '開立應收帳款承購的發票', - 'bluevine_conditional_offer' => '附條件報價', - 'bluevine_credit_line_amount' => '貸款額度', - 'bluevine_advance_rate' => '預付率', - 'bluevine_weekly_discount_rate' => '每週折扣率', - 'bluevine_minimum_fee_rate' => '最低費用', - 'bluevine_line_of_credit' => '信用額度', - 'bluevine_interest_rate' => '利率', - 'bluevine_weekly_draw_rate' => '每週支取率', - 'bluevine_continue' => '前往BlueVine', - 'bluevine_completed' => '已完成註冊BlueVine', + 'bluevine_create_account' => '建立一個帳號', + 'quote_types' => '取得報價單', + 'invoice_factoring' => '開立應收帳款承購的發票', + 'line_of_credit' => '貸款額度', + 'fico_score' => '您的FICO分數', + 'business_inception' => '營運起始日', + 'average_bank_balance' => '平均銀行帳戶餘額', + 'annual_revenue' => '年收入', + 'desired_credit_limit_factoring' => '希望設定的發票貼現限額', + 'desired_credit_limit_loc' => '希望的貸款限額基準線', + 'desired_credit_limit' => '希望的貸款額度。', + 'bluevine_credit_line_type_required' => '您必須至少選擇一項', + 'bluevine_field_required' => '此欄位為必填', + 'bluevine_unexpected_error' => '發生為預期的錯誤。', + 'bluevine_no_conditional_offer' => '取得報價單之前,需提供更多資訊。點擊以下繼續。', + 'bluevine_invoice_factoring' => '開立應收帳款承購的發票', + 'bluevine_conditional_offer' => '附條件報價', + 'bluevine_credit_line_amount' => '貸款額度', + 'bluevine_advance_rate' => '預付率', + 'bluevine_weekly_discount_rate' => '每週折扣率', + 'bluevine_minimum_fee_rate' => '最低費用', + 'bluevine_line_of_credit' => '信用額度', + 'bluevine_interest_rate' => '利率', + 'bluevine_weekly_draw_rate' => '每週支取率', + 'bluevine_continue' => '前往BlueVine', + 'bluevine_completed' => '已完成註冊BlueVine', 'vendor_name' => '供應商', 'entity_state' => '狀態', @@ -2125,16 +2125,16 @@ $LANG = array( 'reports_help' => 'Shift + Click 可多欄排序,Ctrl + Click 以取消組合。', 'this_year' => '今年', - // Updated login screen - 'ninja_tagline' => '建立。寄送。接受付款。', - 'login_or_existing' => '或使用已連結的帳號登入', - 'sign_up_now' => '現在就註冊', - 'not_a_member_yet' => '尚未成為會員?', - 'login_create_an_account' => '建立一個帳號', - 'client_login' => '客戶登入', + // Updated login screen + 'ninja_tagline' => '建立。寄送。接受付款。', + 'login_or_existing' => '或使用已連結的帳號登入', + 'sign_up_now' => '現在就註冊', + 'not_a_member_yet' => '尚未成為會員?', + 'login_create_an_account' => '建立一個帳號', + 'client_login' => '客戶登入', - // New Client Portal styling - 'invoice_from' => '發票來自:', + // New Client Portal styling + 'invoice_from' => '發票來自:', 'email_alias_message' => '我們要求每個公司擁有專屬的電子郵件地址。
建議使用代稱。例如, email+label@example.com', 'full_name' => '全名', 'month_year' => '月/年', @@ -2429,7 +2429,7 @@ $LANG = array( 'tax1' => '首項稅負', 'tax2' => '次項稅負', 'fee_help' => '閘道費是使用處理線上支付的金融網路收取的費用。', - 'format_export' => '輸出格式', + 'format_export' => '輸出格式', 'custom1' => '首位顧客', 'custom2' => '第二名顧客', 'contact_first_name' => '通訊資料:名', @@ -2867,5 +2867,3 @@ $LANG = array( ); return $LANG; - -?> diff --git a/routes/api.php b/routes/api.php index ea26ddccbc..d48e37b1ad 100644 --- a/routes/api.php +++ b/routes/api.php @@ -17,135 +17,128 @@ return $request->user(); */ Route::group(['middleware' => ['api_secret_check']], function () { - - Route::post('api/v1/signup', 'AccountController@store')->name('signup.submit'); - Route::post('api/v1/oauth_login', 'Auth\LoginController@oauthApiLogin'); - + Route::post('api/v1/signup', 'AccountController@store')->name('signup.submit'); + Route::post('api/v1/oauth_login', 'Auth\LoginController@oauthApiLogin'); }); Route::group(['api_secret_check', 'email_db'], function () { - - Route::post('api/v1/login', 'Auth\LoginController@apiLogin')->name('login.submit'); - Route::post('api/v1/reset_password', 'Auth\ForgotPasswordController@sendResetLinkEmail')->name('password.reset'); - + Route::post('api/v1/login', 'Auth\LoginController@apiLogin')->name('login.submit'); + Route::post('api/v1/reset_password', 'Auth\ForgotPasswordController@sendResetLinkEmail')->name('password.reset'); }); Route::group(['middleware' => ['api_db', 'token_auth', 'locale'], 'prefix' => 'api/v1', 'as' => 'api.'], function () { + Route::resource('activities', 'ActivityController');// name = (clients. index / create / show / update / destroy / edit - Route::resource('activities', 'ActivityController');// name = (clients. index / create / show / update / destroy / edit + Route::resource('clients', 'ClientController');// name = (clients. index / create / show / update / destroy / edit - Route::resource('clients', 'ClientController');// name = (clients. index / create / show / update / destroy / edit + Route::post('clients/bulk', 'ClientController@bulk')->name('clients.bulk'); - Route::post('clients/bulk', 'ClientController@bulk')->name('clients.bulk'); + Route::resource('invoices', 'InvoiceController');// name = (invoices. index / create / show / update / destroy / edit - Route::resource('invoices', 'InvoiceController');// name = (invoices. index / create / show / update / destroy / edit + Route::get('invoices/{invoice}/{action}', 'InvoiceController@action')->name('invoices.action'); - Route::get('invoices/{invoice}/{action}', 'InvoiceController@action')->name('invoices.action'); + Route::get('invoice/{invitation_key}/download', 'InvoiceController@downloadPdf')->name('invoices.downloadPdf'); - Route::get('invoice/{invitation_key}/download', 'InvoiceController@downloadPdf')->name('invoices.downloadPdf'); + Route::post('invoices/bulk', 'InvoiceController@bulk')->name('invoices.bulk'); - Route::post('invoices/bulk', 'InvoiceController@bulk')->name('invoices.bulk'); + Route::resource('credits', 'CreditController');// name = (credits. index / create / show / update / destroy / edit - Route::resource('credits', 'CreditController');// name = (credits. index / create / show / update / destroy / edit + Route::get('credits/{credit}/{action}', 'CreditController@action')->name('credits.action'); - Route::get('credits/{credit}/{action}', 'CreditController@action')->name('credits.action'); + Route::post('credits/bulk', 'CreditController@bulk')->name('credits.bulk'); - Route::post('credits/bulk', 'CreditController@bulk')->name('credits.bulk'); + Route::resource('products', 'ProductController');// name = (products. index / create / show / update / destroy / edit - Route::resource('products', 'ProductController');// name = (products. index / create / show / update / destroy / edit + Route::post('products/bulk', 'ProductController@bulk')->name('products.bulk'); - Route::post('products/bulk', 'ProductController@bulk')->name('products.bulk'); + Route::resource('quotes', 'QuoteController');// name = (quotes. index / create / show / update / destroy / edit - Route::resource('quotes', 'QuoteController');// name = (quotes. index / create / show / update / destroy / edit + Route::get('quotes/{quote}/{action}', 'QuoteController@action')->name('quotes.action'); - Route::get('quotes/{quote}/{action}', 'QuoteController@action')->name('quotes.action'); + Route::post('quotes/bulk', 'QuoteController@bulk')->name('quotes.bulk'); - Route::post('quotes/bulk', 'QuoteController@bulk')->name('quotes.bulk'); + Route::resource('recurring_invoices', 'RecurringInvoiceController');// name = (recurring_invoices. index / create / show / update / destroy / edit - Route::resource('recurring_invoices', 'RecurringInvoiceController');// name = (recurring_invoices. index / create / show / update / destroy / edit + Route::post('recurring_invoices/bulk', 'RecurringInvoiceController@bulk')->name('recurring_invoices.bulk'); - Route::post('recurring_invoices/bulk', 'RecurringInvoiceController@bulk')->name('recurring_invoices.bulk'); + Route::resource('recurring_quotes', 'RecurringQuoteController');// name = (recurring_invoices. index / create / show / update / destroy / edit - Route::resource('recurring_quotes', 'RecurringQuoteController');// name = (recurring_invoices. index / create / show / update / destroy / edit + Route::post('recurring_quotes/bulk', 'RecurringQuoteController@bulk')->name('recurring_quotes.bulk'); - Route::post('recurring_quotes/bulk', 'RecurringQuoteController@bulk')->name('recurring_quotes.bulk'); + Route::resource('expenses', 'ExpenseController');// name = (expenses. index / create / show / update / destroy / edit - Route::resource('expenses', 'ExpenseController');// name = (expenses. index / create / show / update / destroy / edit + Route::post('expenses/bulk', 'ExpenseController@bulk')->name('expenses.bulk'); - Route::post('expenses/bulk', 'ExpenseController@bulk')->name('expenses.bulk'); + Route::resource('vendors', 'VendorController');// name = (vendors. index / create / show / update / destroy / edit - Route::resource('vendors', 'VendorController');// name = (vendors. index / create / show / update / destroy / edit + Route::post('vendors/bulk', 'VendorController@bulk')->name('vendors.bulk'); - Route::post('vendors/bulk', 'VendorController@bulk')->name('vendors.bulk'); + Route::resource('client_statement', 'ClientStatementController@statement');// name = (client_statement. index / create / show / update / destroy / edit - Route::resource('client_statement', 'ClientStatementController@statement');// name = (client_statement. index / create / show / update / destroy / edit + Route::resource('payments', 'PaymentController');// name = (payments. index / create / show / update / destroy / edit - Route::resource('payments', 'PaymentController');// name = (payments. index / create / show / update / destroy / edit + Route::post('payments/refund', 'PaymentController@refund')->name('payments.refund'); - Route::post('payments/refund', 'PaymentController@refund')->name('payments.refund'); + Route::post('payments/bulk', 'PaymentController@bulk')->name('payments.bulk'); - Route::post('payments/bulk', 'PaymentController@bulk')->name('payments.bulk'); + Route::post('migrate', 'MigrationController@index')->name('migrate.start'); - Route::post('migrate', 'MigrationController@index')->name('migrate.start'); + Route::resource('designs', 'DesignController');// name = (payments. index / create / show / update / destroy / edit - Route::resource('designs', 'DesignController');// name = (payments. index / create / show / update / destroy / edit + // Route::resource('users', 'UserController')->middleware('password_protected'); // name = (users. index / create / show / update / destroy / edit + Route::get('users', 'UserController@index'); + Route::put('users/{user}', 'UserController@update')->middleware('password_protected'); + Route::post('users', 'UserController@store')->middleware('password_protected'); + Route::post('users/{user}/attach_to_company', 'UserController@attach')->middleware('password_protected'); + Route::delete('users/{user}/detach_from_company', 'UserController@detach')->middleware('password_protected'); - // Route::resource('users', 'UserController')->middleware('password_protected'); // name = (users. index / create / show / update / destroy / edit - Route::get('users', 'UserController@index'); - Route::put('users/{user}', 'UserController@update')->middleware('password_protected'); - Route::post('users', 'UserController@store')->middleware('password_protected'); - Route::post('users/{user}/attach_to_company', 'UserController@attach')->middleware('password_protected'); - Route::delete('users/{user}/detach_from_company', 'UserController@detach')->middleware('password_protected'); + Route::post('users/bulk', 'UserController@bulk')->name('users.bulk')->middleware('password_protected'); - Route::post('users/bulk', 'UserController@bulk')->name('users.bulk')->middleware('password_protected'); + Route::post('migration/purge/{company}', 'MigrationController@purgeCompany')->middleware('password_protected'); + Route::post('migration/purge_save_settings/{company}', 'MigrationController@purgeCompanySaveSettings')->middleware('password_protected'); + Route::post('migration/start/{company}', 'MigrationController@startMigration'); - Route::post('migration/purge/{company}', 'MigrationController@purgeCompany')->middleware('password_protected'); - Route::post('migration/purge_save_settings/{company}', 'MigrationController@purgeCompanySaveSettings')->middleware('password_protected'); - Route::post('migration/start/{company}', 'MigrationController@startMigration'); + Route::resource('companies', 'CompanyController');// name = (companies. index / create / show / update / destroy / edit - Route::resource('companies', 'CompanyController');// name = (companies. index / create / show / update / destroy / edit + Route::resource('company_gateways', 'CompanyGatewayController'); + + Route::put('company_users/{user}', 'CompanyUserController@update'); - Route::resource('company_gateways', 'CompanyGatewayController'); - - Route::put('company_users/{user}', 'CompanyUserController@update'); + Route::resource('group_settings', 'GroupSettingController'); - Route::resource('group_settings', 'GroupSettingController'); + Route::resource('tax_rates', 'TaxRateController');// name = (tasks. index / create / show / update / destroy / edit - Route::resource('tax_rates', 'TaxRateController');// name = (tasks. index / create / show / update / destroy / edit + Route::post('refresh', 'Auth\LoginController@refresh'); - Route::post('refresh', 'Auth\LoginController@refresh'); + Route::post('templates', 'TemplateController@show')->name('templates.show'); + + Route::post('preview', 'PreviewController@show')->name('previews.show'); - Route::post('templates', 'TemplateController@show')->name('templates.show'); - - Route::post('preview', 'PreviewController@show')->name('previews.show'); + Route::post('self-update', 'SelfUpdateController@update')->middleware('password_protected'); - Route::post('self-update', 'SelfUpdateController@update')->middleware('password_protected'); + Route::post('self-update/check_version', 'SelfUpdateController@checkVersion'); - Route::post('self-update/check_version', 'SelfUpdateController@checkVersion'); + /* + Route::resource('tasks', 'TaskController'); // name = (tasks. index / create / show / update / destroy / edit - /* - Route::resource('tasks', 'TaskController'); // name = (tasks. index / create / show / update / destroy / edit - - Route::post('tasks/bulk', 'TaskController@bulk')->name('tasks.bulk'); + Route::post('tasks/bulk', 'TaskController@bulk')->name('tasks.bulk'); - Route::resource('credits', 'CreditController'); // name = (credits. index / create / show / update / destroy / edit + Route::resource('credits', 'CreditController'); // name = (credits. index / create / show / update / destroy / edit - Route::post('credits/bulk', 'CreditController@bulk')->name('credits.bulk'); + Route::post('credits/bulk', 'CreditController@bulk')->name('credits.bulk'); - Route::get('settings', 'SettingsController@index')->name('user.settings'); - */ - Route::post('support/messages/send', 'Support\Messages\SendingController'); + Route::get('settings', 'SettingsController@index')->name('user.settings'); + */ + Route::post('support/messages/send', 'Support\Messages\SendingController'); }); Route::group(['middleware' => ['api_db', 'locale'], 'prefix' => 'api/v1', 'as' => 'api.'], function () { - - Route::get('claim_license', 'LicenseController@index')->name('license.index'); - //Route::post('register_user', 'LicenseController@registerNinjaUser')->name('license.register_ninja_user'); - + Route::post('claim_license', 'LicenseController@index')->name('license.index'); + //Route::post('register_user', 'LicenseController@registerNinjaUser')->name('license.register_ninja_user'); }); Route::fallback('BaseController@notFound'); diff --git a/routes/breadcrumbs.php b/routes/breadcrumbs.php index 9f8748d198..0a94a65e1f 100644 --- a/routes/breadcrumbs.php +++ b/routes/breadcrumbs.php @@ -11,17 +11,16 @@ Breadcrumbs::for('clients', function ($trail) { $trail->push(trans('texts.clients'), route('clients.index')); }); -Breadcrumbs::for('clients.show', function($trail, $client) { +Breadcrumbs::for('clients.show', function ($trail, $client) { $trail->parent('clients'); $trail->push($client->name, route('clients.show', $client)); }); -Breadcrumbs::for('clients.edit', function($trail, $client) { +Breadcrumbs::for('clients.edit', function ($trail, $client) { $trail->parent('clients'); $trail->push($client->name, route('clients.edit', $client)); }); -Breadcrumbs::for('clients.create', function($trail) { +Breadcrumbs::for('clients.create', function ($trail) { $trail->parent('clients'); }); - diff --git a/routes/client.php b/routes/client.php index b41c5d53d4..146807f4f3 100644 --- a/routes/client.php +++ b/routes/client.php @@ -12,53 +12,46 @@ Route::post('client/password/reset', 'Auth\ContactResetPasswordController@reset' //todo implement domain DB Route::group(['middleware' => ['auth:contact','locale'], 'prefix' => 'client', 'as' => 'client.'], function () { + Route::get('dashboard', 'ClientPortal\DashboardController@index')->name('dashboard'); // name = (dashboard. index / create / show / update / destroy / edit - Route::get('dashboard', 'ClientPortal\DashboardController@index')->name('dashboard'); // name = (dashboard. index / create / show / update / destroy / edit + Route::get('invoices', 'ClientPortal\InvoiceController@index')->name('invoices.index')->middleware('portal_enabled'); + Route::post('invoices/payment', 'ClientPortal\InvoiceController@bulk')->name('invoices.bulk'); + Route::get('invoices/{invoice}', 'ClientPortal\InvoiceController@show')->name('invoice.show'); + Route::get('invoices/{invoice_invitation}', 'ClientPortal\InvoiceController@show')->name('invoice.show_invitation'); - Route::get('invoices', 'ClientPortal\InvoiceController@index')->name('invoices.index')->middleware('portal_enabled'); - Route::post('invoices/payment', 'ClientPortal\InvoiceController@bulk')->name('invoices.bulk'); - Route::get('invoices/{invoice}', 'ClientPortal\InvoiceController@show')->name('invoice.show'); - Route::get('invoices/{invoice_invitation}', 'ClientPortal\InvoiceController@show')->name('invoice.show_invitation'); + Route::get('recurring_invoices', 'ClientPortal\RecurringInvoiceController@index')->name('recurring_invoices.index')->middleware('portal_enabled'); + Route::get('recurring_invoices/{recurring_invoice}', 'ClientPortal\RecurringInvoiceController@show')->name('recurring_invoices.show'); + Route::get('recurring_invoices/{recurring_invoice}/request_cancellation', 'ClientPortal\RecurringInvoiceController@requestCancellation')->name('recurring_invoices.request_cancellation'); + + Route::get('payments', 'ClientPortal\PaymentController@index')->name('payments.index')->middleware('portal_enabled'); + Route::get('payments/{payment}', 'ClientPortal\PaymentController@show')->name('payments.show'); + Route::post('payments/process', 'ClientPortal\PaymentController@process')->name('payments.process'); + Route::post('payments/process/response', 'ClientPortal\PaymentController@response')->name('payments.response'); + Route::get('payments/process/response', 'ClientPortal\PaymentController@response')->name('payments.response.get'); - Route::get('recurring_invoices', 'ClientPortal\RecurringInvoiceController@index')->name('recurring_invoices.index')->middleware('portal_enabled'); - Route::get('recurring_invoices/{recurring_invoice}', 'ClientPortal\RecurringInvoiceController@show')->name('recurring_invoices.show'); - Route::get('recurring_invoices/{recurring_invoice}/request_cancellation', 'ClientPortal\RecurringInvoiceController@requestCancellation')->name('recurring_invoices.request_cancellation'); - - Route::get('payments', 'ClientPortal\PaymentController@index')->name('payments.index')->middleware('portal_enabled'); - Route::get('payments/{payment}', 'ClientPortal\PaymentController@show')->name('payments.show'); - Route::post('payments/process', 'ClientPortal\PaymentController@process')->name('payments.process'); - Route::post('payments/process/response', 'ClientPortal\PaymentController@response')->name('payments.response'); - Route::get('payments/process/response', 'ClientPortal\PaymentController@response')->name('payments.response.get'); + Route::get('profile/{client_contact}/edit', 'ClientPortal\ProfileController@edit')->name('profile.edit'); + Route::put('profile/{client_contact}/edit', 'ClientPortal\ProfileController@update')->name('profile.update'); + Route::put('profile/{client_contact}/edit_client', 'ClientPortal\ProfileController@updateClient')->name('profile.edit_client'); + Route::put('profile/{client_contact}/localization', 'ClientPortal\ProfileController@updateClientLocalization')->name('profile.edit_localization'); - Route::get('profile/{client_contact}/edit', 'ClientPortal\ProfileController@edit')->name('profile.edit'); - Route::put('profile/{client_contact}/edit', 'ClientPortal\ProfileController@update')->name('profile.update'); - Route::put('profile/{client_contact}/edit_client', 'ClientPortal\ProfileController@updateClient')->name('profile.edit_client'); - Route::put('profile/{client_contact}/localization', 'ClientPortal\ProfileController@updateClientLocalization')->name('profile.edit_localization'); - - Route::resource('payment_methods', 'ClientPortal\PaymentMethodController');// name = (payment_methods. index / create / show / update / destroy / edit - - Route::post('document', 'ClientPortal\DocumentController@store')->name('document.store'); - Route::delete('document', 'ClientPortal\DocumentController@destroy')->name('document.destroy'); - - Route::get('logout', 'Auth\ContactLoginController@logout')->name('logout'); + Route::resource('payment_methods', 'ClientPortal\PaymentMethodController');// name = (payment_methods. index / create / show / update / destroy / edit + Route::post('document', 'ClientPortal\DocumentController@store')->name('document.store'); + Route::delete('document', 'ClientPortal\DocumentController@destroy')->name('document.destroy'); + + Route::get('logout', 'Auth\ContactLoginController@logout')->name('logout'); }); Route::group(['middleware' => ['invite_db'], 'prefix' => 'client', 'as' => 'client.'], function () { - - Route::get('invoice/{invitation_key}/download_pdf', 'InvoiceController@downloadPdf'); - Route::get('quote/{invitation_key}/download_pdf', 'QuoteController@downloadPdf'); - Route::get('credit/{invitation_key}/download_pdf', 'CreditController@downloadPdf'); - Route::get('{entity}/{invitation_key}/download', 'ClientPortal\InvitationController@routerForDownload'); - - /*Invitation catches*/ - Route::get('{entity}/{invitation_key}','ClientPortal\InvitationController@router'); - Route::get('{entity}/{client_hash}/{invitation_key}','ClientPortal\InvitationController@routerForIframe'); //should never need this - Route::get('payment_hook/{company_gateway_id}/{gateway_type_id}','ClientPortal\PaymentHookController@process'); - - - - + Route::get('invoice/{invitation_key}/download_pdf', 'InvoiceController@downloadPdf'); + Route::get('quote/{invitation_key}/download_pdf', 'QuoteController@downloadPdf'); + Route::get('credit/{invitation_key}/download_pdf', 'CreditController@downloadPdf'); + Route::get('{entity}/{invitation_key}/download', 'ClientPortal\InvitationController@routerForDownload'); + + /*Invitation catches*/ + Route::get('{entity}/{invitation_key}', 'ClientPortal\InvitationController@router'); + Route::get('{entity}/{client_hash}/{invitation_key}', 'ClientPortal\InvitationController@routerForIframe'); //should never need this + Route::get('payment_hook/{company_gateway_id}/{gateway_type_id}', 'ClientPortal\PaymentHookController@process'); }); -Route::fallback('BaseController@notFoundClient'); \ No newline at end of file +Route::fallback('BaseController@notFoundClient'); diff --git a/routes/contact.php b/routes/contact.php index ae7b653bb7..22dcd9de74 100644 --- a/routes/contact.php +++ b/routes/contact.php @@ -14,13 +14,9 @@ use Illuminate\Http\Request; */ Route::group(['middleware' => ['api_secret_check']], function () { - - Route::post('api/v1/contact/login', 'Contact\LoginController@apiLogin'); - + Route::post('api/v1/contact/login', 'Contact\LoginController@apiLogin'); }); Route::group(['middleware' => ['contact_db','api_secret_check','contact_token_auth'], 'prefix' =>'api/v1/contact', 'as' => 'api.contact.'], function () { - - Route::get('invoices', 'Contact\InvoiceController@index'); // name = (clients. index / create / show / update / destroy / edit - -}); \ No newline at end of file + Route::get('invoices', 'Contact\InvoiceController@index'); // name = (clients. index / create / show / update / destroy / edit +}); diff --git a/routes/web.php b/routes/web.php index c47ad0ac26..d48524d210 100644 --- a/routes/web.php +++ b/routes/web.php @@ -27,7 +27,5 @@ Route::post('password/reset', 'Auth\ResetPasswordController@reset')->name('passw * Inbound routes requiring DB Lookup */ Route::group(['middleware' => ['url_db']], function () { - Route::get('/user/confirm/{confirmation_code}', 'UserController@confirm'); - -}); \ No newline at end of file +}); diff --git a/tests/Browser/Client/PaymentMethods.php b/tests/Browser/Client/PaymentMethods.php index 022ac902e9..6fd8e6968e 100644 --- a/tests/Browser/Client/PaymentMethods.php +++ b/tests/Browser/Client/PaymentMethods.php @@ -8,11 +8,9 @@ use Tests\DuskTestCase; class PaymentMethods extends DuskTestCase { - public function testAddPaymentMethodPage(): void { $this->browse(function (Browser $browser) { - $browser->visit('/client/login') ->type('email', 'user@example.com') ->type('password', config('ninja.testvars.password')) diff --git a/tests/Browser/ClientPortalTest.php b/tests/Browser/ClientPortalTest.php index 953051ba8c..54df99d003 100644 --- a/tests/Browser/ClientPortalTest.php +++ b/tests/Browser/ClientPortalTest.php @@ -15,18 +15,15 @@ use Tests\DuskTestCase; class ClientPortalTest extends DuskTestCase { - use WithFaker; use MakesHash; public function testLoginPageDisplayed() { - - $this->browse(function ($browser){ + $this->browse(function ($browser) { $browser->visit('/client/login') ->assertPathIs('/client/login'); }); - } /** @@ -111,22 +108,17 @@ class ClientPortalTest extends DuskTestCase $browser->visit('client/logout') ->assertPathIs('/client/login'); - - }); - - } /** * Testing sidebar pages availability. - * - * @return void + * + * @return void */ public function testDashboardElements(): void { $this->browse(function ($browser) { - $browser->visit('/client/login') ->type('email', 'user@example.com') ->type('password', config('ninja.testvars.password')) @@ -152,7 +144,6 @@ class ClientPortalTest extends DuskTestCase public function testInvoicesElements(): void { $this->browse(function ($browser) { - $browser->visit('/client/login') ->type('email', 'user@example.com') ->type('password', config('ninja.testvars.password')) @@ -180,7 +171,6 @@ class ClientPortalTest extends DuskTestCase public function testRecurringInvoicesElements(): void { $this->browse(function ($browser) { - $browser->visit('/client/login') ->assertPathIs('/client/login') ->type('email', 'user@example.com') @@ -206,7 +196,6 @@ class ClientPortalTest extends DuskTestCase public function testPaymentsElements(): void { $this->browse(function ($browser) { - $browser ->visit('/client/logout') ->visit('/client/login') @@ -231,7 +220,6 @@ class ClientPortalTest extends DuskTestCase public function testPaymentMethodsElements(): void { $this->browse(function ($browser) { - $browser->visit('/client/logout') ->visit('/client/login') ->type('email', 'user@example.com') @@ -239,7 +227,7 @@ class ClientPortalTest extends DuskTestCase ->press('Login') ->assertPathIs('/client/dashboard'); - $browser->visit('/client/payment_methods') + $browser->visit('/client/payment_methods') ->waitFor('.dataTable') ->assertVisible('#datatable_info') // ->assertVisible('.dataTables_empty'); @@ -252,8 +240,7 @@ class ClientPortalTest extends DuskTestCase { $faker = \Faker\Factory::create(); - $this->browse(function ($browser) use ($faker) { - + $this->browse(function ($browser) use ($faker) { $browser->visit('/client/login') ->type('email', 'user@example.com') ->type('password', config('ninja.testvars.password')) @@ -291,7 +278,6 @@ class ClientPortalTest extends DuskTestCase $faker = \Faker\Factory::create(); $this->browse(function ($browser) use ($faker) { - $browser->visit('/client/login') ->type('email', 'user@example.com') ->type('password', config('ninja.testvars.password')) @@ -325,5 +311,4 @@ class ClientPortalTest extends DuskTestCase $browser->driver->executeScript('window.scrollTo(0, document.body.scrollHeight)'); }); } - } diff --git a/tests/DuskTestCase.php b/tests/DuskTestCase.php index 1261c7a6d7..3f7998b4ec 100644 --- a/tests/DuskTestCase.php +++ b/tests/DuskTestCase.php @@ -35,8 +35,10 @@ abstract class DuskTestCase extends BaseTestCase ]); return RemoteWebDriver::create( - 'http://localhost:9515', DesiredCapabilities::chrome()->setCapability( - ChromeOptions::CAPABILITY, $options + 'http://localhost:9515', + DesiredCapabilities::chrome()->setCapability( + ChromeOptions::CAPABILITY, + $options ) ); } diff --git a/tests/Feature/AccountTest.php b/tests/Feature/AccountTest.php index e950912b89..4321c4a6a4 100644 --- a/tests/Feature/AccountTest.php +++ b/tests/Feature/AccountTest.php @@ -87,10 +87,5 @@ class AccountTest extends TestCase ])->post('/api/v1/signup?include=account', $data); $response->assertStatus(200); - - } - - - } diff --git a/tests/Feature/ClientApiTest.php b/tests/Feature/ClientApiTest.php index 87c29ec4b3..6e9029acf3 100644 --- a/tests/Feature/ClientApiTest.php +++ b/tests/Feature/ClientApiTest.php @@ -79,8 +79,6 @@ class ClientApiTest extends TestCase public function testClientGet() { - - $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-TOKEN' => $this->token @@ -88,7 +86,6 @@ class ClientApiTest extends TestCase $response->assertStatus(200); - } public function testClientNotArchived() @@ -153,5 +150,4 @@ class ClientApiTest extends TestCase $this->assertTrue($arr['data'][0]['is_deleted']); } - -} \ No newline at end of file +} diff --git a/tests/Feature/ClientModelTest.php b/tests/Feature/ClientModelTest.php index eed4dc80f5..86233e0323 100644 --- a/tests/Feature/ClientModelTest.php +++ b/tests/Feature/ClientModelTest.php @@ -13,50 +13,52 @@ use Tests\TestCase; */ class ClientModelTest extends TestCase { - - use MockAccountData; + use MockAccountData; use DatabaseTransactions; public function setUp() :void { - - parent::setUp(); - - $this->makeTestData(); + parent::setUp(); + + $this->makeTestData(); - if(config('ninja.testvars.travis') !== false) + if (config('ninja.testvars.travis') !== false) { $this->markTestSkipped('Skip test for Travis'); + } - if(!config('ninja.testvars.stripe')) + if (!config('ninja.testvars.stripe')) { $this->markTestSkipped('Skip test no company gateways installed'); - } + } + } - public function testPaymentMethods() - { - - $amount = 40; + public function testPaymentMethods() + { + $amount = 40; $company_gateways = $this->client->getSetting('company_gateway_ids'); //todo create a test where we actually SET a value in the settings->company_gateways object and test if we can harvest. - if($company_gateways) + if ($company_gateways) { $gateways = $this->company->company_gateways->whereIn('id', $payment_gateways); - else + } else { $gateways = $this->company->company_gateways; + } $this->assertNotNull($gateways); $pre_count = $gateways->count(); - $gateways->filter(function ($method) use ($amount){ - if($method->min_limit !== null && $amount < $method->min_limit) + $gateways->filter(function ($method) use ($amount) { + if ($method->min_limit !== null && $amount < $method->min_limit) { return false; + } - if($method->max_limit !== null && $amount > $method->min_limit) + if ($method->max_limit !== null && $amount > $method->min_limit) { return false; - }); + } + }); $post_count = $gateways->count(); @@ -64,45 +66,41 @@ class ClientModelTest extends TestCase $payment_methods = []; - foreach($gateways as $gateway) - foreach($gateway->driver($this->client)->gatewayTypes() as $type) - $payment_methods[] = [$gateway->id => $type]; + foreach ($gateways as $gateway) { + foreach ($gateway->driver($this->client)->gatewayTypes() as $type) { + $payment_methods[] = [$gateway->id => $type]; + } + } $this->assertEquals(8, count($payment_methods)); $payment_methods_collections = collect($payment_methods); //** Plucks the remaining keys into its own collection - $payment_methods_intersect = $payment_methods_collections->intersectByKeys( $payment_methods_collections->flatten(1)->unique() ); + $payment_methods_intersect = $payment_methods_collections->intersectByKeys($payment_methods_collections->flatten(1)->unique()); $this->assertEquals(4, $payment_methods_intersect->count()); $payment_urls = []; - foreach($payment_methods_intersect as $key => $child_array) - { - foreach($child_array as $gateway_id => $gateway_type_id) - { + foreach ($payment_methods_intersect as $key => $child_array) { + foreach ($child_array as $gateway_id => $gateway_type_id) { + $gateway = $gateways->where('id', $gateway_id)->first(); - $gateway = $gateways->where('id', $gateway_id)->first(); + $this->assertNotNull($gateway); - $this->assertNotNull($gateway); + $fee_label = $gateway->calcGatewayFeeLabel($amount, $this->client); - $fee_label = $gateway->calcGatewayFeeLabel($amount, $this->client); - - $payment_urls[] = [ + $payment_urls[] = [ 'label' => ctrans('texts.' . $gateway->getTypeAlias($gateway_type_id)) . $fee_label, 'url' => URL::signedRoute('client.payments.process', [ 'company_gateway_id' => $gateway_id, 'gateway_type_id' => $gateway_type_id]) ]; } - } $this->assertEquals(4, count($payment_urls)); - } - - + } } diff --git a/tests/Feature/ClientPresenterTest.php b/tests/Feature/ClientPresenterTest.php index 2e44f2160f..c4a36387f6 100644 --- a/tests/Feature/ClientPresenterTest.php +++ b/tests/Feature/ClientPresenterTest.php @@ -13,41 +13,36 @@ use Tests\TestCase; */ class ClientPresenterTest extends TestCase { - - use MockAccountData; + use MockAccountData; use DatabaseTransactions; public function setUp() :void { - - parent::setUp(); - - $this->makeTestData(); + parent::setUp(); + + $this->makeTestData(); + } - } + public function testCompanyName() + { + $settings = $this->client->company->settings; - public function testCompanyName() - { + $settings->name = 'test'; + $this->client->company->settings = $settings; + $this->client->company->save(); + + $this->client->getSetting('name'); - $settings = $this->client->company->settings; + $merged_settings = $this->client->getMergedSettings(); - $settings->name = 'test'; - $this->client->company->settings = $settings; - $this->client->company->save(); - - $this->client->getSetting('name'); + $name = $this->client->present()->company_name(); - $merged_settings = $this->client->getMergedSettings(); + $this->assertEquals('test', $merged_settings->name); + $this->assertEquals('test', $name); + } - $name = $this->client->present()->company_name(); - - $this->assertEquals('test', $merged_settings->name); - $this->assertEquals('test', $name); - } - - public function testCompanyAddress() - { - $this->assertNotNull($this->client->present()->company_address()); - } - -} \ No newline at end of file + public function testCompanyAddress() + { + $this->assertNotNull($this->client->present()->company_address()); + } +} diff --git a/tests/Feature/ClientTest.php b/tests/Feature/ClientTest.php index 521bd71142..f67ebf2ace 100644 --- a/tests/Feature/ClientTest.php +++ b/tests/Feature/ClientTest.php @@ -54,7 +54,6 @@ class ClientTest extends TestCase public function testClientList() { - $data = [ 'first_name' => $this->faker->firstName, 'last_name' => $this->faker->lastName, @@ -87,7 +86,6 @@ class ClientTest extends TestCase ])->get('/api/v1/clients'); $response->assertStatus(200); - } /* @@ -95,7 +93,6 @@ class ClientTest extends TestCase */ public function testClientRestEndPoints() { - $data = [ 'first_name' => $this->faker->firstName, 'last_name' => $this->faker->lastName, @@ -132,21 +129,19 @@ class ClientTest extends TestCase $this->assertNotNull($company); //$this->assertNotNull($user->token->company); - factory(\App\Models\Client::class, 3)->create(['user_id' => $user->id, 'company_id' => $company->id])->each(function ($c) use ($user, $company){ - - factory(\App\Models\ClientContact::class,1)->create([ + factory(\App\Models\Client::class, 3)->create(['user_id' => $user->id, 'company_id' => $company->id])->each(function ($c) use ($user, $company) { + factory(\App\Models\ClientContact::class, 1)->create([ 'user_id' => $user->id, 'client_id' => $c->id, 'company_id' => $company->id, 'is_primary' => 1 ]); - factory(\App\Models\ClientContact::class,2)->create([ + factory(\App\Models\ClientContact::class, 2)->create([ 'user_id' => $user->id, 'client_id' => $c->id, 'company_id' => $company->id ]); - }); $client = $account->default_company->clients()->first(); @@ -207,14 +202,12 @@ class ClientTest extends TestCase 'X-API-TOKEN' => $token, ])->put('/api/v1/clients/'.$this->encodePrimaryKey($client->id), $client_update) ->assertStatus(400); + } - } - - public function testDefaultTimeZoneFromClientModel() - { - + public function testDefaultTimeZoneFromClientModel() + { $account = factory(\App\Models\Account::class)->create(); - $company = factory(\App\Models\Company::class)->create([ + $company = factory(\App\Models\Company::class)->create([ 'account_id' => $account->id, ]); @@ -248,55 +241,52 @@ class ClientTest extends TestCase 'is_locked' => 0, ]); - factory(\App\Models\Client::class, 3)->create(['user_id' => $user->id, 'company_id' => $company->id])->each(function ($c) use ($user, $company){ - - factory(\App\Models\ClientContact::class,1)->create([ + factory(\App\Models\Client::class, 3)->create(['user_id' => $user->id, 'company_id' => $company->id])->each(function ($c) use ($user, $company) { + factory(\App\Models\ClientContact::class, 1)->create([ 'user_id' => $user->id, 'client_id' => $c->id, 'company_id' => $company->id, 'is_primary' => 1, ]); - factory(\App\Models\ClientContact::class,2)->create([ + factory(\App\Models\ClientContact::class, 2)->create([ 'user_id' => $user->id, 'client_id' => $c->id, 'company_id' => $company->id ]); + }); - }); + $client = Client::whereUserId($user->id)->whereCompanyId($company->id)->first(); - $client = Client::whereUserId($user->id)->whereCompanyId($company->id)->first(); + $this->assertNotNull($client); - $this->assertNotNull($client); + /* Make sure we have a valid settings object*/ + $this->assertEquals($client->getSetting('timezone_id'), 1); - /* Make sure we have a valid settings object*/ - $this->assertEquals($client->getSetting('timezone_id'), 1); + /* Make sure we are harvesting valid data */ + $this->assertEquals($client->timezone()->name, 'Pacific/Midway'); - /* Make sure we are harvesting valid data */ - $this->assertEquals($client->timezone()->name, 'Pacific/Midway'); - - /* Make sure NULL settings return the correct count (0) instead of throwing an exception*/ - $this->assertEquals($client->contacts->count(), 3); - } + /* Make sure NULL settings return the correct count (0) instead of throwing an exception*/ + $this->assertEquals($client->contacts->count(), 3); + } - public function testCreatingClientAndContacts() - { - - $account = factory(\App\Models\Account::class)->create(); - $company = factory(\App\Models\Company::class)->create([ + public function testCreatingClientAndContacts() + { + $account = factory(\App\Models\Account::class)->create(); + $company = factory(\App\Models\Company::class)->create([ 'account_id' => $account->id, ]); - $account->default_company_id = $company->id; - $account->save(); + $account->default_company_id = $company->id; + $account->save(); - $user = factory(\App\Models\User::class)->create([ + $user = factory(\App\Models\User::class)->create([ // 'account_id' => $account->id, 'confirmation_code' => $this->createDbHash(config('database.default')) ]); - $user->companies()->attach($company->id, [ + $user->companies()->attach($company->id, [ 'account_id' => $account->id, 'is_owner' => 1, 'is_admin' => 1, @@ -306,7 +296,7 @@ class ClientTest extends TestCase 'is_locked' => 0, ]); - $ct = CompanyToken::create([ + $ct = CompanyToken::create([ 'account_id' => $account->id, 'company_id' => $company->id, 'user_id' => $user->id, @@ -314,9 +304,9 @@ class ClientTest extends TestCase 'name' => $user->first_name. ' '. $user->last_name, ]); - $token = $ct->token; + $token = $ct->token; - $data = [ + $data = [ 'name' => 'A loyal Client', 'contacts' => [ ['email' => $this->faker->unique()->safeEmail] @@ -324,15 +314,15 @@ class ClientTest extends TestCase ]; - $response = $this->withHeaders([ + $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-TOKEN' => $token, ])->post('/api/v1/clients/', $data) ->assertStatus(200); - // $arr = $response->json(); + // $arr = $response->json(); - $data = [ + $data = [ 'name' => 'A loyal Client', 'contacts' => [ [ @@ -343,14 +333,14 @@ class ClientTest extends TestCase ]; - $response = $this->withHeaders([ + $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-TOKEN' => $token, ])->post('/api/v1/clients/', $data) ->assertStatus(200); - $data = [ + $data = [ 'name' => 'A loyal Client', 'contacts' => [ [ @@ -360,22 +350,20 @@ class ClientTest extends TestCase ] ]; - $response = null; + $response = null; - try{ - $response = $this->withHeaders([ + try { + $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-TOKEN' => $token, ])->post('/api/v1/clients/', $data); - } - catch(ValidationException $e) { + } catch (ValidationException $e) { + $message = json_decode($e->validator->getMessageBag(), 1); + //\Log::error($message); + $this->assertNotNull($message); + } - $message = json_decode($e->validator->getMessageBag(),1); - //\Log::error($message); - $this->assertNotNull($message); - } - - $data = [ + $data = [ 'name' => 'A loyal Client', 'contacts' => [ [ @@ -385,24 +373,22 @@ class ClientTest extends TestCase ] ]; - $response = null; + $response = null; - try{ - $response = $this->withHeaders([ + try { + $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-TOKEN' => $token, ])->post('/api/v1/clients/', $data); - } - catch(ValidationException $e) { - - $message = json_decode($e->validator->getMessageBag(),1); - ////\Log::error($message); + } catch (ValidationException $e) { + $message = json_decode($e->validator->getMessageBag(), 1); + ////\Log::error($message); //$this->assertNotNull($message); - } + } - $response->assertStatus(200); + $response->assertStatus(200); - $data = [ + $data = [ 'name' => 'A loyal Client', 'contacts' => [ [ @@ -416,39 +402,37 @@ class ClientTest extends TestCase ] ]; - $response = null; + $response = null; - try{ - $response = $this->withHeaders([ + try { + $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-TOKEN' => $token, ])->post('/api/v1/clients/', $data); - } - catch(ValidationException $e) { + } catch (ValidationException $e) { + $message = json_decode($e->validator->getMessageBag(), 1); + //\Log::error($message); + $this->assertNotNull($message); + } - $message = json_decode($e->validator->getMessageBag(),1); - //\Log::error($message); - $this->assertNotNull($message); - } - - $response->assertStatus(200); + $response->assertStatus(200); - $arr = $response->json(); + $arr = $response->json(); - $client_id = $arr['data']['id']; + $client_id = $arr['data']['id']; - $response = $this->withHeaders([ + $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-TOKEN' => $token, ])->put('/api/v1/clients/' . $client_id, $data)->assertStatus(200); - $arr = $response->json(); + $arr = $response->json(); - //\Log::error($arr); - $safe_email = $this->faker->unique()->safeEmail; + //\Log::error($arr); + $safe_email = $this->faker->unique()->safeEmail; - $data = [ + $data = [ 'name' => 'A loyal Client', 'contacts' => [ [ @@ -458,34 +442,32 @@ class ClientTest extends TestCase ] ]; - $response = null; + $response = null; - try{ - $response = $this->withHeaders([ + try { + $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-TOKEN' => $token, ])->post('/api/v1/clients/', $data); - } - catch(ValidationException $e) { + } catch (ValidationException $e) { + $message = json_decode($e->validator->getMessageBag(), 1); + //\Log::error($message); + $this->assertNotNull($message); + } - $message = json_decode($e->validator->getMessageBag(),1); - //\Log::error($message); - $this->assertNotNull($message); - } + $response->assertStatus(200); - $response->assertStatus(200); + $arr = $response->json(); - $arr = $response->json(); + $client = Client::find($this->decodePrimaryKey($arr['data']['id'])); - $client = Client::find($this->decodePrimaryKey($arr['data']['id'])); + $contact = $client->contacts()->whereEmail($safe_email)->first(); - $contact = $client->contacts()->whereEmail($safe_email)->first(); + $this->assertEquals(0, strlen($contact->password)); - $this->assertEquals(0, strlen($contact->password)); + $safe_email = $this->faker->unique()->safeEmail; - $safe_email = $this->faker->unique()->safeEmail; - - $data = [ + $data = [ 'name' => 'A loyal Client', 'contacts' => [ [ @@ -495,34 +477,32 @@ class ClientTest extends TestCase ] ]; - $response = null; + $response = null; - try{ - $response = $this->withHeaders([ + try { + $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-TOKEN' => $token, ])->post('/api/v1/clients/', $data); - } - catch(ValidationException $e) { + } catch (ValidationException $e) { + $message = json_decode($e->validator->getMessageBag(), 1); + //\Log::error($message); + $this->assertNotNull($message); + } - $message = json_decode($e->validator->getMessageBag(),1); - //\Log::error($message); - $this->assertNotNull($message); - } + $response->assertStatus(200); - $response->assertStatus(200); + $arr = $response->json(); - $arr = $response->json(); + $client = Client::find($this->decodePrimaryKey($arr['data']['id'])); - $client = Client::find($this->decodePrimaryKey($arr['data']['id'])); + $contact = $client->contacts()->whereEmail($safe_email)->first(); - $contact = $client->contacts()->whereEmail($safe_email)->first(); + $this->assertGreaterThan(1, strlen($contact->password)); - $this->assertGreaterThan(1, strlen($contact->password)); + $password = $contact->password; - $password = $contact->password; - - $data = [ + $data = [ 'name' => 'A Stary eyed client', 'contacts' => [ [ @@ -533,32 +513,30 @@ class ClientTest extends TestCase ] ]; - $response = null; + $response = null; - try{ - $response = $this->withHeaders([ + try { + $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-TOKEN' => $token, ])->put('/api/v1/clients/' . $client->hashed_id, $data); - } - catch(ValidationException $e) { - - $message = json_decode($e->validator->getMessageBag(),1); - //\Log::error($message); - $this->assertNotNull($message); - } - - $response->assertStatus(200); - - $arr = $response->json(); - - $client = Client::find($this->decodePrimaryKey($arr['data']['id'])); - $client->fresh(); - - $contact = $client->contacts()->whereEmail($safe_email)->first(); - - $this->assertEquals($password, $contact->password); + } catch (ValidationException $e) { + $message = json_decode($e->validator->getMessageBag(), 1); + //\Log::error($message); + $this->assertNotNull($message); } + + $response->assertStatus(200); + + $arr = $response->json(); + + $client = Client::find($this->decodePrimaryKey($arr['data']['id'])); + $client->fresh(); + + $contact = $client->contacts()->whereEmail($safe_email)->first(); + + $this->assertEquals($password, $contact->password); + } /** @test */ // public function testMassivelyCreatingClients() // { diff --git a/tests/Feature/CompanyGatewayApiTest.php b/tests/Feature/CompanyGatewayApiTest.php index 2bf004d196..e267a3aea6 100644 --- a/tests/Feature/CompanyGatewayApiTest.php +++ b/tests/Feature/CompanyGatewayApiTest.php @@ -43,7 +43,6 @@ class CompanyGatewayApiTest extends TestCase $this->faker = \Faker\Factory::create(); Model::reguard(); - } @@ -105,16 +104,13 @@ class CompanyGatewayApiTest extends TestCase $response->assertStatus(200); - $response = $this->withHeaders([ + $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-TOKEN' => $this->token ])->delete("/api/v1/company_gateways/{$cg_id}", $data); $response->assertStatus(200); - - - } @@ -163,8 +159,6 @@ class CompanyGatewayApiTest extends TestCase $cg = $response->json(); $response->assertStatus(200); - - } @@ -188,7 +182,6 @@ class CompanyGatewayApiTest extends TestCase $response->assertStatus(200); - } public function testCompanyGatewayArrayBuilder() @@ -204,6 +197,5 @@ class CompanyGatewayApiTest extends TestCase $this->assertEquals($arr['min_limit'], $new_arr['min_limit']); $this->assertTrue(array_key_exists('fee_amount', $new_arr)); - } -} \ No newline at end of file +} diff --git a/tests/Feature/CompanySettingsTest.php b/tests/Feature/CompanySettingsTest.php index 28e0e05586..6c3ed43176 100644 --- a/tests/Feature/CompanySettingsTest.php +++ b/tests/Feature/CompanySettingsTest.php @@ -41,52 +41,48 @@ class CompanySettingsTest extends TestCase Session::start(); $this->faker = \Faker\Factory::create(); -$this->withoutExceptionHandling(); + $this->withoutExceptionHandling(); Model::reguard(); - - } public function testClientNumberCantBeModified() { - $settings = $this->company->settings; + $settings = $this->company->settings; - $settings->client_number_counter = 200; + $settings->client_number_counter = 200; - $this->company->saveSettings($settings, $this->company); + $this->company->saveSettings($settings, $this->company); //$this->withoutExceptionHandling(); - $response = false; + $response = false; try { $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-Token' => $this->token, ])->put('/api/v1/companies/'.$this->encodePrimaryKey($this->company->id), $this->company->toArray()); - } - catch(ValidationException $e) { - - $message = json_decode($e->validator->getMessageBag(),1); + } catch (ValidationException $e) { + $message = json_decode($e->validator->getMessageBag(), 1); \Log::error($message); } - if($response) { + if ($response) { $response->assertStatus(200); $arr = $response->json(); - $this->assertEquals($arr['data']['settings']['timezone_id'],1); + $this->assertEquals($arr['data']['settings']['timezone_id'], 1); } } public function testNullValuesInSettings() { - $settings = $this->company->settings; + $settings = $this->company->settings; - $settings->reset_counter_date = null; + $settings->reset_counter_date = null; - $this->company->saveSettings($settings, $this->company); + $this->company->saveSettings($settings, $this->company); $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), @@ -98,7 +94,7 @@ $this->withoutExceptionHandling(); $arr = $response->json(); - $this->assertEquals($arr['data']['settings']['reset_counter_date'],''); + $this->assertEquals($arr['data']['settings']['reset_counter_date'], ''); } public function testIntegerEdgeCases() @@ -117,7 +113,7 @@ $this->withoutExceptionHandling(); 'X-API-Token' => $this->token, ])->put('/api/v1/companies/'.$this->encodePrimaryKey($this->company->id), $this->company->toArray()); - $response->assertStatus(200); + $response->assertStatus(200); $arr = $response->json(); @@ -143,16 +139,14 @@ $this->withoutExceptionHandling(); 'X-API-Token' => $this->token, ])->put('/api/v1/companies/'.$this->encodePrimaryKey($this->company->id), $this->company->toArray()); - $response->assertStatus(200); + $response->assertStatus(200); $arr = $response->json(); - $this->assertEquals($arr['data']['settings']['default_task_rate'],0); - $this->assertEquals($arr['data']['settings']['tax_rate1'],10.0); - $this->assertEquals($arr['data']['settings']['tax_rate2'],10.0); - $this->assertEquals($arr['data']['settings']['tax_rate3'],10.5); - - + $this->assertEquals($arr['data']['settings']['default_task_rate'], 0); + $this->assertEquals($arr['data']['settings']['tax_rate1'], 10.0); + $this->assertEquals($arr['data']['settings']['tax_rate2'], 10.0); + $this->assertEquals($arr['data']['settings']['tax_rate3'], 10.5); } public function testBoolEdgeCases() @@ -165,14 +159,14 @@ $this->withoutExceptionHandling(); $settings->show_accept_invoice_terms = "TRUE"; $settings->enable_client_portal_tasks = "FALSE"; - $this->company->saveSettings($settings, $this->company); + $this->company->saveSettings($settings, $this->company); $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-Token' => $this->token, ])->put('/api/v1/companies/'.$this->encodePrimaryKey($this->company->id), $this->company->toArray()); - $response->assertStatus(200); + $response->assertStatus(200); $arr = $response->json(); @@ -192,15 +186,15 @@ $this->withoutExceptionHandling(); $this->company->saveSettings($settings, $this->company); - $response = $this->withHeaders([ + $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-Token' => $this->token, - ])->post('/api/v1/companies?include=company',$this->company->toArray()); + ])->post('/api/v1/companies?include=company', $this->company->toArray()); $arr = $response->json(); - $response->assertStatus(200); + $response->assertStatus(200); - $this->assertEquals($arr['data'][0]['company']['settings']['reset_counter_date'],''); + $this->assertEquals($arr['data'][0]['company']['settings']['reset_counter_date'], ''); } public function testCompanyWrongValueMatrixPOST() @@ -210,15 +204,15 @@ $this->withoutExceptionHandling(); $this->company->saveSettings($settings, $this->company); - $response = $this->withHeaders([ + $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-Token' => $this->token, - ])->post('/api/v1/companies?include=company',$this->company->toArray()); + ])->post('/api/v1/companies?include=company', $this->company->toArray()); $arr = $response->json(); - $response->assertStatus(200); + $response->assertStatus(200); - $this->assertEquals($arr['data'][0]['company']['settings']['reset_counter_date'],''); + $this->assertEquals($arr['data'][0]['company']['settings']['reset_counter_date'], ''); } @@ -229,15 +223,15 @@ $this->withoutExceptionHandling(); $this->company->saveSettings($settings, $this->company); - $response = $this->withHeaders([ + $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-Token' => $this->token, - ])->post('/api/v1/companies?include=company',$this->company->toArray()); + ])->post('/api/v1/companies?include=company', $this->company->toArray()); $arr = $response->json(); - $response->assertStatus(200); + $response->assertStatus(200); - $this->assertEquals($arr['data'][0]['company']['settings']['reset_counter_date'],'1'); + $this->assertEquals($arr['data'][0]['company']['settings']['reset_counter_date'], '1'); } public function testCompanyrightValueMatrixPOST() @@ -247,14 +241,14 @@ $this->withoutExceptionHandling(); $this->company->saveSettings($settings, $this->company); - $response = $this->withHeaders([ + $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-Token' => $this->token, - ])->post('/api/v1/companies?include=company',$this->company->toArray()); + ])->post('/api/v1/companies?include=company', $this->company->toArray()); $arr = $response->json(); - $response->assertStatus(200); + $response->assertStatus(200); - $this->assertEquals($arr['data'][0]['company']['settings']['reset_counter_date'],'1/1/2000'); + $this->assertEquals($arr['data'][0]['company']['settings']['reset_counter_date'], '1/1/2000'); } -} \ No newline at end of file +} diff --git a/tests/Feature/CompanyTest.php b/tests/Feature/CompanyTest.php index 48f3e8b1a0..83678ff00d 100644 --- a/tests/Feature/CompanyTest.php +++ b/tests/Feature/CompanyTest.php @@ -40,14 +40,10 @@ class CompanyTest extends TestCase $this->faker = \Faker\Factory::create(); Model::reguard(); - - - } public function testCompanyList() { - $data = [ 'first_name' => $this->faker->firstName, 'last_name' => $this->faker->lastName, @@ -69,7 +65,7 @@ class CompanyTest extends TestCase $acc = $response->json(); - $account = Account::find($this->decodePrimaryKey($acc['data'][0]['account']['id'])); + $account = Account::find($this->decodePrimaryKey($acc['data'][0]['account']['id'])); $token = $account->default_company->tokens->first()->token; @@ -84,7 +80,8 @@ class CompanyTest extends TestCase $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-TOKEN' => $token, - ])->post('/api/v1/companies?include=company', + ])->post( + '/api/v1/companies?include=company', [ 'name' => 'A New Company', 'logo' => UploadedFile::fake()->image('avatar.jpg') @@ -92,20 +89,21 @@ class CompanyTest extends TestCase ) ->assertStatus(200)->decodeResponseJson(); - $company = Company::find($this->decodePrimaryKey($response['data'][0]['company']['id'])); + $company = Company::find($this->decodePrimaryKey($response['data'][0]['company']['id'])); $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-TOKEN' => $token, - ])->post('/api/v1/companies/', + ])->post( + '/api/v1/companies/', [ 'name' => 'A New Company', - 'company_logo' => UploadedFile::fake()->create('avatar.pdf',100) + 'company_logo' => UploadedFile::fake()->create('avatar.pdf', 100) ] ) ->assertStatus(302); - // Log::error($company); + // Log::error($company); $token = CompanyToken::whereCompanyId($company->id)->first()->token; @@ -159,7 +157,5 @@ class CompanyTest extends TestCase 'X-API-TOKEN' => $token, ])->delete('/api/v1/companies/'.$this->encodePrimaryKey($company->id)) ->assertStatus(200); - - - } + } } diff --git a/tests/Feature/CreditTest.php b/tests/Feature/CreditTest.php index c317db2714..6acc056f8f 100644 --- a/tests/Feature/CreditTest.php +++ b/tests/Feature/CreditTest.php @@ -64,7 +64,6 @@ class CreditTest extends TestCase $this->assertNotNull($company); factory(Client::class, 1)->create(['user_id' => $user->id, 'company_id' => $company->id])->each(function ($c) use ($user, $company) { - factory(\App\Models\ClientContact::class, 1)->create([ 'user_id' => $user->id, 'client_id' => $c->id, @@ -148,7 +147,7 @@ class CreditTest extends TestCase public function testDeleteCredit() { - $response = $this->withHeaders([ + $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-TOKEN' => $this->token, ])->delete('/api/v1/credits/'.$this->encodePrimaryKey($this->credit->id)); diff --git a/tests/Feature/DesignApiTest.php b/tests/Feature/DesignApiTest.php index 85375d241d..aba65c4f3b 100644 --- a/tests/Feature/DesignApiTest.php +++ b/tests/Feature/DesignApiTest.php @@ -44,7 +44,6 @@ class DesignApiTest extends TestCase $this->faker = \Faker\Factory::create(); Model::reguard(); - } @@ -132,10 +131,5 @@ class DesignApiTest extends TestCase $this->assertTrue((bool)$design->is_deleted); $this->assertGreaterThan(0, $design->deleted_at); - } - - - - -} \ No newline at end of file +} diff --git a/tests/Feature/InvitationTest.php b/tests/Feature/InvitationTest.php index d065e89165..7026da7c9c 100644 --- a/tests/Feature/InvitationTest.php +++ b/tests/Feature/InvitationTest.php @@ -32,7 +32,7 @@ use Tests\TestCase; class InvitationTest extends TestCase { - use MakesHash; + use MakesHash; use DatabaseTransactions; public function setUp() :void @@ -48,10 +48,10 @@ class InvitationTest extends TestCase public function testInvoiceCreationAfterInvoiceMarkedSent() { - $account = factory(\App\Models\Account::class)->create(); - $company = factory(\App\Models\Company::class)->create([ - 'account_id' => $account->id, - ]); + $account = factory(\App\Models\Account::class)->create(); + $company = factory(\App\Models\Company::class)->create([ + 'account_id' => $account->id, + ]); $account->default_company_id = $company->id; $account->save(); @@ -83,26 +83,24 @@ class InvitationTest extends TestCase 'is_locked' => 0, ]); - factory(\App\Models\Client::class)->create(['user_id' => $user->id, 'company_id' => $company->id])->each(function ($c) use ($user, $company){ - - factory(\App\Models\ClientContact::class,1)->create([ + factory(\App\Models\Client::class)->create(['user_id' => $user->id, 'company_id' => $company->id])->each(function ($c) use ($user, $company) { + factory(\App\Models\ClientContact::class, 1)->create([ 'user_id' => $user->id, 'client_id' => $c->id, 'company_id' => $company->id, 'is_primary' => 1 ]); - factory(\App\Models\ClientContact::class,2)->create([ + factory(\App\Models\ClientContact::class, 2)->create([ 'user_id' => $user->id, 'client_id' => $c->id, 'company_id' => $company->id ]); - }); $client = Client::whereUserId($user->id)->whereCompanyId($company->id)->first(); - factory(\App\Models\Invoice::class,5)->create(['user_id' => $user->id, 'company_id' => $company->id, 'client_id' => $client->id]); + factory(\App\Models\Invoice::class, 5)->create(['user_id' => $user->id, 'company_id' => $company->id, 'client_id' => $client->id]); $invoice = Invoice::whereUserId($user->id)->whereCompanyId($company->id)->whereClientId($client->id)->first(); @@ -117,6 +115,5 @@ class InvitationTest extends TestCase $i->save(); $this->assertNotNull($invoice->invitations); - } } diff --git a/tests/Feature/InvoiceEmailTest.php b/tests/Feature/InvoiceEmailTest.php index 78bcb27f60..be5fd4850d 100644 --- a/tests/Feature/InvoiceEmailTest.php +++ b/tests/Feature/InvoiceEmailTest.php @@ -43,7 +43,6 @@ class InvoiceEmailTest extends TestCase public function test_initial_email_send_emails() { - $this->invoice->date = now(); $this->invoice->due_date = now()->addDays(7); $this->invoice->number = $this->getNextInvoiceNumber($this->client); @@ -54,18 +53,13 @@ class InvoiceEmailTest extends TestCase $this->invoice->save(); $this->invoice->invitations->each(function ($invitation) { - if ($invitation->contact->send_email && $invitation->contact->email) { - $email_builder = (new InvoiceEmail())->build($invitation, null); EmailInvoice::dispatch($email_builder, $invitation, $invitation->company); $this->expectsJobs(EmailInvoice::class); - } }); - } - } diff --git a/tests/Feature/InvoiceTest.php b/tests/Feature/InvoiceTest.php index ae79a3b5ea..f1107a8257 100644 --- a/tests/Feature/InvoiceTest.php +++ b/tests/Feature/InvoiceTest.php @@ -25,14 +25,12 @@ use Tests\TestCase; class InvoiceTest extends TestCase { - use MakesHash; use DatabaseTransactions; use MockAccountData; public function setUp() :void { - parent::setUp(); Session::start(); @@ -42,7 +40,6 @@ class InvoiceTest extends TestCase Model::reguard(); $this->makeTestData(); - } public function testInvoiceList() @@ -65,7 +62,7 @@ class InvoiceTest extends TestCase $acc = $response->json(); - $account = Account::find($this->decodePrimaryKey($acc['data'][0]['account']['id'])); + $account = Account::find($this->decodePrimaryKey($acc['data'][0]['account']['id'])); $company_token = $account->default_company->tokens()->first(); $token = $company_token->token; @@ -79,21 +76,19 @@ class InvoiceTest extends TestCase $this->assertNotNull($company); //$this->assertNotNull($user->token->company); - factory(\App\Models\Client::class, 1)->create(['user_id' => $user->id, 'company_id' => $company->id])->each(function ($c) use ($user, $company){ - - factory(\App\Models\ClientContact::class,1)->create([ + factory(\App\Models\Client::class, 1)->create(['user_id' => $user->id, 'company_id' => $company->id])->each(function ($c) use ($user, $company) { + factory(\App\Models\ClientContact::class, 1)->create([ 'user_id' => $user->id, 'client_id' => $c->id, 'company_id' => $company->id, 'is_primary' => 1 ]); - factory(\App\Models\ClientContact::class,1)->create([ + factory(\App\Models\ClientContact::class, 1)->create([ 'user_id' => $user->id, 'client_id' => $c->id, 'company_id' => $company->id ]); - }); $client = Client::all()->first(); @@ -106,12 +101,10 @@ class InvoiceTest extends TestCase ])->get('/api/v1/invoices'); $response->assertStatus(200); - } public function testInvoiceRESTEndPoints() { - $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-TOKEN' => $this->token, @@ -137,14 +130,13 @@ class InvoiceTest extends TestCase 'X-API-TOKEN' => $this->token, ])->put('/api/v1/invoices/'.$this->encodePrimaryKey($this->invoice->id), $invoice_update) ->assertStatus(200); - } public function testPostNewInvoice() { $invoice = [ 'status_id' => 1, - 'number' => 'dfdfd', + 'number' => 'dfdfd', 'discount' => 0, 'is_amount_discount' => 1, 'po_number' => '3434343', @@ -158,7 +150,7 @@ class InvoiceTest extends TestCase 'client_id' => $this->encodePrimaryKey($this->client->id), ]; - $response = $this->withHeaders([ + $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-TOKEN' => $this->token, ])->post('/api/v1/invoices/', $invoice) @@ -167,12 +159,11 @@ class InvoiceTest extends TestCase public function testDeleteInvoice() { - $response = $this->withHeaders([ + $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-TOKEN' => $this->token, ])->delete('/api/v1/invoices/'.$this->encodePrimaryKey($this->invoice->id)); $response->assertStatus(200); } - -} \ No newline at end of file +} diff --git a/tests/Feature/LoginTest.php b/tests/Feature/LoginTest.php index 794bc59186..7afdf90ad5 100644 --- a/tests/Feature/LoginTest.php +++ b/tests/Feature/LoginTest.php @@ -32,7 +32,6 @@ class LoginTest extends TestCase public function testLoginFormDisplayed() { - $response = $this->get('/login', [ '_token' => csrf_token() ]); @@ -174,12 +173,11 @@ class LoginTest extends TestCase 'password' => '123456' ]; - $response = $this->withHeaders([ + $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), ])->post('/api/v1/login', $data); $response->assertStatus(200); } - } diff --git a/tests/Feature/MigrationTest.php b/tests/Feature/MigrationTest.php index 6731883240..1dab58dd97 100644 --- a/tests/Feature/MigrationTest.php +++ b/tests/Feature/MigrationTest.php @@ -47,41 +47,38 @@ class MigrationTest extends TestCase public function testCompanyExists() { + $co = Company::find($this->company->id); - $co = Company::find($this->company->id); - - // $this->assertNull($this->company); - $this->assertNotNull($co); + // $this->assertNull($this->company); + $this->assertNotNull($co); } public function testThatCompanyDeletesCompletely() { - $company_id = $this->company->id; + $company_id = $this->company->id; - $this->company->delete(); - $this->company->fresh(); + $this->company->delete(); + $this->company->fresh(); - $co = Company::find($company_id); - - // $this->assertNull($this->company); - $this->assertNull($co); + $co = Company::find($company_id); + // $this->assertNull($this->company); + $this->assertNull($co); } public function testCompanyChildDeletes() { - $this->makeTestData(); $this->assertNotNull($this->company); - $co = Client::whereCompanyId($this->company->id)->get(); - $inv = Invoice::whereCompanyId($this->company->id)->get(); + $co = Client::whereCompanyId($this->company->id)->get(); + $inv = Invoice::whereCompanyId($this->company->id)->get(); - $this->assertEquals($co->count(),1); - $this->assertEquals($inv->count(),1); + $this->assertEquals($co->count(), 1); + $this->assertEquals($inv->count(), 1); - // DB::statement( 'DELETE FROM `clients` WHERE `company_id`=:company_id', array('company_id' => $this->company->id) ); + // DB::statement( 'DELETE FROM `clients` WHERE `company_id`=:company_id', array('company_id' => $this->company->id) ); // $co = Client::whereCompanyId($this->company->id)->get(); // $inv = Invoice::whereCompanyId($this->company->id)->get(); @@ -92,7 +89,6 @@ class MigrationTest extends TestCase // $this->assertNotNull($this->company); // $this->assertNotNull($this->company->settings); // $this->assertNotNull($this->company->settings->timezone_id); - } // public function testMigrationFileUpload() @@ -116,6 +112,4 @@ class MigrationTest extends TestCase // $response->assertStatus(200); // $this->assertTrue(file_exists(base_path('storage/migrations/migration/migration.json'))); // } - - } diff --git a/tests/Feature/PaymentTest.php b/tests/Feature/PaymentTest.php index 6586ee5883..22cfb42635 100644 --- a/tests/Feature/PaymentTest.php +++ b/tests/Feature/PaymentTest.php @@ -31,14 +31,12 @@ use Tests\TestCase; class PaymentTest extends TestCase { - use MakesHash; use DatabaseTransactions; use MockAccountData; public function setUp() :void { - parent::setUp(); $this->withoutMiddleware( @@ -53,28 +51,23 @@ class PaymentTest extends TestCase $this->makeTestData(); $this->withoutExceptionHandling(); - } public function testPaymentList() { - - factory(\App\Models\Client::class, 1)->create(['user_id' => $this->user->id, 'company_id' => $this->company->id])->each(function ($c) { - - factory(\App\Models\ClientContact::class,1)->create([ + factory(\App\Models\ClientContact::class, 1)->create([ 'user_id' => $this->user->id, 'client_id' => $c->id, 'company_id' => $this->company->id, 'is_primary' => 1 ]); - factory(\App\Models\ClientContact::class,1)->create([ + factory(\App\Models\ClientContact::class, 1)->create([ 'user_id' => $this->user->id, 'client_id' => $c->id, 'company_id' => $this->company->id ]); - }); $client = Client::all()->first(); @@ -89,12 +82,10 @@ class PaymentTest extends TestCase ])->get('/api/v1/payments'); $response->assertStatus(200); - } public function testPaymentRESTEndPoints() { - factory(\App\Models\Payment::class, 1)->create(['user_id' => $this->user->id, 'company_id' => $this->company->id, 'client_id' => $this->client->id]); $Payment = Payment::all()->last(); @@ -112,7 +103,6 @@ class PaymentTest extends TestCase ])->get('/api/v1/payments/'.$this->encodePrimaryKey($Payment->id).'/edit'); $response->assertStatus(200); - } public function testStorePaymentWithoutClientId() @@ -120,7 +110,7 @@ class PaymentTest extends TestCase $client = ClientFactory::create($this->company->id, $this->user->id); $client->save(); - $this->invoice = InvoiceFactory::create($this->company->id,$this->user->id);//stub the company and user_id + $this->invoice = InvoiceFactory::create($this->company->id, $this->user->id);//stub the company and user_id $this->invoice->client_id = $client->id; $this->invoice->line_items = $this->buildLineItems(); @@ -150,16 +140,11 @@ class PaymentTest extends TestCase 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-TOKEN' => $this->token, ])->post('/api/v1/payments/', $data); - } - catch(ValidationException $e) { - - $message = json_decode($e->validator->getMessageBag(),1); + } catch (ValidationException $e) { + $message = json_decode($e->validator->getMessageBag(), 1); $this->assertTrue(array_key_exists('client_id', $message)); - } - - } public function testStorePaymentWithClientId() @@ -167,7 +152,7 @@ class PaymentTest extends TestCase $client = ClientFactory::create($this->company->id, $this->user->id); $client->save(); - $this->invoice = InvoiceFactory::create($this->company->id,$this->user->id);//stub the company and user_id + $this->invoice = InvoiceFactory::create($this->company->id, $this->user->id);//stub the company and user_id $this->invoice->client_id = $client->id; $this->invoice->status_id = Invoice::STATUS_SENT; @@ -202,17 +187,14 @@ class PaymentTest extends TestCase 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-TOKEN' => $this->token, ])->post('/api/v1/payments?include=invoices', $data); - - } - catch(ValidationException $e) { - // \Log::error('in the validator'); - $message = json_decode($e->validator->getMessageBag(),1); - // \Log::error($message); + } catch (ValidationException $e) { + // \Log::error('in the validator'); + $message = json_decode($e->validator->getMessageBag(), 1); + // \Log::error($message); $this->assertNotNull($message); - } - if($response){ + if ($response) { $arr = $response->json(); $response->assertStatus(200); @@ -224,7 +206,6 @@ class PaymentTest extends TestCase $this->assertNotNull($payment->invoices()); $this->assertEquals(1, $payment->invoices()->count()); } - } public function testStorePaymentWithNoInvoiecs() @@ -232,7 +213,7 @@ class PaymentTest extends TestCase $client = ClientFactory::create($this->company->id, $this->user->id); $client->save(); - $this->invoice = InvoiceFactory::create($this->company->id,$this->user->id);//stub the company and user_id + $this->invoice = InvoiceFactory::create($this->company->id, $this->user->id);//stub the company and user_id $this->invoice->client_id = $client->id; $this->invoice->status_id = Invoice::STATUS_SENT; @@ -263,15 +244,14 @@ class PaymentTest extends TestCase 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-TOKEN' => $this->token, ])->post('/api/v1/payments?include=invoices', $data); - - } - catch(ValidationException $e) { - $message = json_decode($e->validator->getMessageBag(),1); + } catch (ValidationException $e) { + $message = json_decode($e->validator->getMessageBag(), 1); $this->assertNotNull($message); } - if($response) + if ($response) { $response->assertStatus(200); + } } public function testPartialPaymentAmount() @@ -285,11 +265,11 @@ class PaymentTest extends TestCase 'user_id' => $this->user->id, 'client_id' => $client->id, 'company_id' =>$this->company->id, - 'is_primary' => true, + 'is_primary' => true, ]); - $this->invoice = InvoiceFactory::create($this->company->id,$this->user->id);//stub the company and user_id + $this->invoice = InvoiceFactory::create($this->company->id, $this->user->id);//stub the company and user_id $this->invoice->client_id = $client->id; $this->invoice->partial = 2.0; @@ -321,21 +301,17 @@ class PaymentTest extends TestCase $response = false; try { - $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-TOKEN' => $this->token, ])->post('/api/v1/payments?include=invoices', $data); - - - } - catch(ValidationException $e) { - $message = json_decode($e->validator->getMessageBag(),1); + } catch (ValidationException $e) { + $message = json_decode($e->validator->getMessageBag(), 1); $this->assertNotNull($message); //\Log::error($message); } - if($response) { + if ($response) { $response->assertStatus(200); $arr = $response->json(); @@ -354,13 +330,10 @@ class PaymentTest extends TestCase $this->assertEquals($pivot_invoice->amount, 10.0000); $this->assertEquals($pivot_invoice->balance, 8.0000); } - } public function testPaymentGreaterThanPartial() { - - $this->invoice = null; $client = ClientFactory::create($this->company->id, $this->user->id); @@ -376,7 +349,7 @@ class PaymentTest extends TestCase $client->setRelation('contacts', $client_contact); - $this->invoice = InvoiceFactory::create($this->company->id,$this->user->id);//stub the company and user_id + $this->invoice = InvoiceFactory::create($this->company->id, $this->user->id);//stub the company and user_id $this->invoice->client_id = $client->id; $this->invoice->partial = 5.0; @@ -410,46 +383,42 @@ class PaymentTest extends TestCase $response = false; - try { + try { $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-TOKEN' => $this->token, ])->post('/api/v1/payments?include=invoices', $data); - } - catch(ValidationException $e) { - - $message = json_decode($e->validator->getMessageBag(),1); - //\Log::error($message); + } catch (ValidationException $e) { + $message = json_decode($e->validator->getMessageBag(), 1); + //\Log::error($message); //\Log::error('errrr'); - } + } - $arr = $response->json(); - $response->assertStatus(200); + $arr = $response->json(); + $response->assertStatus(200); - $payment_id = $arr['data']['id']; + $payment_id = $arr['data']['id']; - $payment = Payment::whereId($this->decodePrimaryKey($payment_id))->first(); + $payment = Payment::whereId($this->decodePrimaryKey($payment_id))->first(); - $this->assertNotNull($payment); - $this->assertNotNull($payment->invoices()); - $this->assertEquals(1, $payment->invoices()->count()); + $this->assertNotNull($payment); + $this->assertNotNull($payment->invoices()); + $this->assertEquals(1, $payment->invoices()->count()); - $invoice = $payment->invoices()->first(); - - $this->assertEquals($invoice->partial, 0); - $this->assertEquals($invoice->balance, 4); + $invoice = $payment->invoices()->first(); + $this->assertEquals($invoice->partial, 0); + $this->assertEquals($invoice->balance, 4); } public function testPaymentLessThanPartialAmount() { - $this->invoice = null; $client = ClientFactory::create($this->company->id, $this->user->id); $client->save(); - $this->invoice = InvoiceFactory::create($this->company->id,$this->user->id);//stub the company and user_id + $this->invoice = InvoiceFactory::create($this->company->id, $this->user->id);//stub the company and user_id $this->invoice->client_id = $client->id; $this->invoice->partial = 5.0; @@ -478,38 +447,36 @@ class PaymentTest extends TestCase 'date' => '2019/12/12', ]; - $response = $this->withHeaders([ + $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-TOKEN' => $this->token, ])->post('/api/v1/payments?include=invoices', $data); - $arr = $response->json(); - $response->assertStatus(200); + $arr = $response->json(); + $response->assertStatus(200); - $payment_id = $arr['data']['id']; + $payment_id = $arr['data']['id']; - $payment = Payment::whereId($this->decodePrimaryKey($payment_id))->first(); + $payment = Payment::whereId($this->decodePrimaryKey($payment_id))->first(); - $this->assertNotNull($payment); - $this->assertNotNull($payment->invoices()); - $this->assertEquals(1, $payment->invoices()->count()); + $this->assertNotNull($payment); + $this->assertNotNull($payment->invoices()); + $this->assertEquals(1, $payment->invoices()->count()); - $invoice = $payment->invoices()->first(); - - $this->assertEquals($invoice->partial, 3); - $this->assertEquals($invoice->balance, 8); + $invoice = $payment->invoices()->first(); + $this->assertEquals($invoice->partial, 3); + $this->assertEquals($invoice->balance, 8); } public function testPaymentValidationAmount() { - $this->invoice = null; $client = ClientFactory::create($this->company->id, $this->user->id); $client->save(); - $this->invoice = InvoiceFactory::create($this->company->id,$this->user->id);//stub the company and user_id + $this->invoice = InvoiceFactory::create($this->company->id, $this->user->id);//stub the company and user_id $this->invoice->client_id = $client->id; $this->invoice->partial = 5.0; @@ -543,30 +510,25 @@ class PaymentTest extends TestCase 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-TOKEN' => $this->token, ])->post('/api/v1/payments?include=invoices', $data); - - } - catch(ValidationException $e) { - - $message = json_decode($e->validator->getMessageBag(),1); + } catch (ValidationException $e) { + $message = json_decode($e->validator->getMessageBag(), 1); $this->assertTrue(array_key_exists('amount', $message)); - } - // if($response) + // if($response) // $response->assertStatus(200); } public function testPaymentChangesBalancesCorrectly() { - $this->invoice = null; $client = ClientFactory::create($this->company->id, $this->user->id); $client->save(); - $this->invoice = InvoiceFactory::create($this->company->id,$this->user->id);//stub the company and user_id + $this->invoice = InvoiceFactory::create($this->company->id, $this->user->id);//stub the company and user_id $this->invoice->client_id = $client->id; $this->invoice->line_items = $this->buildLineItems(); @@ -594,24 +556,20 @@ class PaymentTest extends TestCase 'date' => '2019/12/12', ]; - $response = false; + $response = false; try { $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-TOKEN' => $this->token, ])->post('/api/v1/payments?include=invoices', $data); - - } - catch(ValidationException $e) { - - $message = json_decode($e->validator->getMessageBag(),1); + } catch (ValidationException $e) { + $message = json_decode($e->validator->getMessageBag(), 1); $this->assertTrue(array_key_exists('amount', $message)); - } - if($response){ + if ($response) { $response->assertStatus(200); $invoice = Invoice::find($this->decodePrimaryKey($this->invoice->hashed_id)); @@ -626,13 +584,12 @@ class PaymentTest extends TestCase public function testUpdatePaymentValidationWorks() { - $this->invoice = null; $client = ClientFactory::create($this->company->id, $this->user->id); $client->save(); - $this->invoice = InvoiceFactory::create($this->company->id,$this->user->id);//stub the company and user_id + $this->invoice = InvoiceFactory::create($this->company->id, $this->user->id);//stub the company and user_id $this->invoice->client_id = $client->id; $this->invoice->line_items = $this->buildLineItems(); @@ -661,37 +618,33 @@ class PaymentTest extends TestCase 'date' => '2019/12/12', ]; - $response = false; + $response = false; try { $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-TOKEN' => $this->token, ])->put('/api/v1/payments/'.$this->encodePrimaryKey($payment->id), $data); - - } - catch(ValidationException $e) { - - $message = json_decode($e->validator->getMessageBag(),1); + } catch (ValidationException $e) { + $message = json_decode($e->validator->getMessageBag(), 1); $this->assertTrue(array_key_exists('invoices', $message)); - } - if($response) + if ($response) { $response->assertStatus(302); + } } public function testUpdatePaymentValidationPasses() { - $this->invoice = null; $client = ClientFactory::create($this->company->id, $this->user->id); $client->save(); - $this->invoice = InvoiceFactory::create($this->company->id,$this->user->id);//stub the company and user_id + $this->invoice = InvoiceFactory::create($this->company->id, $this->user->id);//stub the company and user_id $this->invoice->client_id = $client->id; $this->invoice->line_items = $this->buildLineItems(); @@ -733,31 +686,27 @@ class PaymentTest extends TestCase 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-TOKEN' => $this->token, ])->put('/api/v1/payments/'.$this->encodePrimaryKey($payment->id), $data); - - } - catch(ValidationException $e) { - - $message = json_decode($e->validator->getMessageBag(),1); - \Log::error(print_r($e->validator->getMessageBag(),1)); + } catch (ValidationException $e) { + $message = json_decode($e->validator->getMessageBag(), 1); + \Log::error(print_r($e->validator->getMessageBag(), 1)); $this->assertTrue(array_key_exists('invoices', $message)); - } - if($response) + if ($response) { $response->assertStatus(200); + } } public function testDoublePaymentTestWithInvalidAmounts() { - $this->invoice = null; $client = ClientFactory::create($this->company->id, $this->user->id); $client->save(); - $this->invoice = InvoiceFactory::create($this->company->id,$this->user->id);//stub the company and user_id + $this->invoice = InvoiceFactory::create($this->company->id, $this->user->id);//stub the company and user_id $this->invoice->client_id = $client->id; $this->invoice->line_items = $this->buildLineItems(); @@ -787,30 +736,28 @@ class PaymentTest extends TestCase $response = false; try { - $response = $this->withHeaders([ + $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-TOKEN' => $this->token, ])->post('/api/v1/payments/', $data); - } - catch(ValidationException $e) { - - $message = json_decode($e->validator->getMessageBag(),1); - \Log::error(print_r($e->validator->getMessageBag(),1)); + } catch (ValidationException $e) { + $message = json_decode($e->validator->getMessageBag(), 1); + \Log::error(print_r($e->validator->getMessageBag(), 1)); } - $response->assertStatus(200); + $response->assertStatus(200); - $arr = $response->json(); + $arr = $response->json(); - $payment_id = $arr['data']['id']; + $payment_id = $arr['data']['id']; - $payment = Payment::whereId($this->decodePrimaryKey($payment_id))->first(); + $payment = Payment::whereId($this->decodePrimaryKey($payment_id))->first(); - $this->assertEquals($payment->amount, 15); - $this->assertEquals($payment->applied, 10); + $this->assertEquals($payment->amount, 15); + $this->assertEquals($payment->applied, 10); $this->invoice = null; - $this->invoice = InvoiceFactory::create($this->company->id,$this->user->id);//stub the company and user_id + $this->invoice = InvoiceFactory::create($this->company->id, $this->user->id);//stub the company and user_id $this->invoice->client_id = $client->id; $this->invoice->line_items = $this->buildLineItems(); @@ -846,31 +793,26 @@ class PaymentTest extends TestCase 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-TOKEN' => $this->token, ])->put('/api/v1/payments/'.$this->encodePrimaryKey($payment->id), $data); - - } - catch(ValidationException $e) { - - $message = json_decode($e->validator->getMessageBag(),1); - // \Log::error(print_r($e->validator->getMessageBag(),1)); + } catch (ValidationException $e) { + $message = json_decode($e->validator->getMessageBag(), 1); + // \Log::error(print_r($e->validator->getMessageBag(),1)); $this->assertTrue(array_key_exists('invoices', $message)); - // \Log::error('hit error'); + // \Log::error('hit error'); } - //$response->assertStatus(302); - + //$response->assertStatus(302); } public function testDoublePaymentTestWithValidAmounts() { - $this->invoice = null; $client = ClientFactory::create($this->company->id, $this->user->id); $client->save(); - $this->invoice = InvoiceFactory::create($this->company->id,$this->user->id);//stub the company and user_id + $this->invoice = InvoiceFactory::create($this->company->id, $this->user->id);//stub the company and user_id $this->invoice->client_id = $client->id; $this->invoice->line_items = $this->buildLineItems(); @@ -904,17 +846,17 @@ class PaymentTest extends TestCase $response->assertStatus(200); - $arr = $response->json(); + $arr = $response->json(); - $payment_id = $arr['data']['id']; + $payment_id = $arr['data']['id']; - $payment = Payment::whereId($this->decodePrimaryKey($payment_id))->first(); + $payment = Payment::whereId($this->decodePrimaryKey($payment_id))->first(); - $this->assertEquals($payment->amount, 20); - $this->assertEquals($payment->applied, 10); + $this->assertEquals($payment->amount, 20); + $this->assertEquals($payment->applied, 10); $this->invoice = null; - $this->invoice = InvoiceFactory::create($this->company->id,$this->user->id);//stub the company and user_id + $this->invoice = InvoiceFactory::create($this->company->id, $this->user->id);//stub the company and user_id $this->invoice->client_id = $client->id; $this->invoice->line_items = $this->buildLineItems(); @@ -950,12 +892,9 @@ class PaymentTest extends TestCase 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-TOKEN' => $this->token, ])->put('/api/v1/payments/'.$this->encodePrimaryKey($payment->id), $data); - - } - catch(ValidationException $e) { - - $message = json_decode($e->validator->getMessageBag(),1); - \Log::error(print_r($e->validator->getMessageBag(),1)); + } catch (ValidationException $e) { + $message = json_decode($e->validator->getMessageBag(), 1); + \Log::error(print_r($e->validator->getMessageBag(), 1)); $this->assertTrue(array_key_exists('invoices', $message)); //\Log::error('hit error'); @@ -966,7 +905,6 @@ class PaymentTest extends TestCase $arr = $response->json(); $this->assertEquals(20, $arr['data']['applied']); - } @@ -975,7 +913,7 @@ class PaymentTest extends TestCase $client = ClientFactory::create($this->company->id, $this->user->id); $client->save(); - $this->invoice = InvoiceFactory::create($this->company->id,$this->user->id);//stub the company and user_id + $this->invoice = InvoiceFactory::create($this->company->id, $this->user->id);//stub the company and user_id $this->invoice->client_id = $client->id; $this->invoice->status_id = Invoice::STATUS_SENT; @@ -1009,17 +947,14 @@ class PaymentTest extends TestCase 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-TOKEN' => $this->token, ])->post('/api/v1/payments?include=invoices', $data); - - } - catch(ValidationException $e) { - // \Log::error('in the validator'); - $message = json_decode($e->validator->getMessageBag(),1); - // \Log::error($message); + } catch (ValidationException $e) { + // \Log::error('in the validator'); + $message = json_decode($e->validator->getMessageBag(), 1); + // \Log::error($message); $this->assertNotNull($message); - } - if($response){ + if ($response) { $arr = $response->json(); $response->assertStatus(200); @@ -1033,7 +968,6 @@ class PaymentTest extends TestCase $this->assertNotNull($payment->invoices()); $this->assertEquals(1, $payment->invoices()->count()); } - } @@ -1042,7 +976,7 @@ class PaymentTest extends TestCase $client = ClientFactory::create($this->company->id, $this->user->id); $client->save(); - $this->invoice = InvoiceFactory::create($this->company->id,$this->user->id);//stub the company and user_id + $this->invoice = InvoiceFactory::create($this->company->id, $this->user->id);//stub the company and user_id $this->invoice->client_id = $client->id; $this->invoice->status_id = Invoice::STATUS_SENT; @@ -1075,14 +1009,11 @@ class PaymentTest extends TestCase 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-TOKEN' => $this->token, ])->post('/api/v1/payments?include=invoices', $data); - - } - catch(ValidationException $e) { - // \Log::error('in the validator'); - $message = json_decode($e->validator->getMessageBag(),1); - // \Log::error($message); + } catch (ValidationException $e) { + // \Log::error('in the validator'); + $message = json_decode($e->validator->getMessageBag(), 1); + // \Log::error($message); $this->assertNotNull($message); - } $response->assertStatus(200); @@ -1091,14 +1022,13 @@ class PaymentTest extends TestCase $payment_id = $arr['data']['id']; $payment = Payment::whereId($this->decodePrimaryKey($payment_id))->first(); - $this->assertEquals(round($payment->amount,2), $this->invoice->amount); + $this->assertEquals(round($payment->amount, 2), $this->invoice->amount); - $this->assertEquals(round($payment->applied,2), $this->invoice->amount); + $this->assertEquals(round($payment->applied, 2), $this->invoice->amount); } public function testPaymentForInvoicesFromDifferentClients() { - $client1 = ClientFactory::create($this->company->id, $this->user->id); $client1->save(); @@ -1106,7 +1036,7 @@ class PaymentTest extends TestCase $client2->save(); - $invoice1 = InvoiceFactory::create($this->company->id,$this->user->id);//stub the company and user_id + $invoice1 = InvoiceFactory::create($this->company->id, $this->user->id);//stub the company and user_id $invoice1->client_id = $client1->id; $invoice1->status_id = Invoice::STATUS_SENT; @@ -1121,7 +1051,7 @@ class PaymentTest extends TestCase $invoice1 = $invoice_calc->getInvoice(); $invoice1->save(); - $invoice2 = InvoiceFactory::create($this->company->id,$this->user->id);//stub the company and user_id + $invoice2 = InvoiceFactory::create($this->company->id, $this->user->id);//stub the company and user_id $invoice2->client_id = $client2->id; $invoice2->status_id = Invoice::STATUS_SENT; @@ -1158,26 +1088,21 @@ class PaymentTest extends TestCase 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-TOKEN' => $this->token, ])->post('/api/v1/payments?include=invoices', $data); - - } - catch(ValidationException $e) { - // \Log::error('in the validator'); - $message = json_decode($e->validator->getMessageBag(),1); + } catch (ValidationException $e) { + // \Log::error('in the validator'); + $message = json_decode($e->validator->getMessageBag(), 1); \Log::error($message); $this->assertNotNull($message); - } - } public function testPaymentWithSameInvoiceMultipleTimes() { - $client1 = ClientFactory::create($this->company->id, $this->user->id); $client1->save(); - $invoice1 = InvoiceFactory::create($this->company->id,$this->user->id);//stub the company and user_id + $invoice1 = InvoiceFactory::create($this->company->id, $this->user->id);//stub the company and user_id $invoice1->client_id = $client1->id; $invoice1->status_id = Invoice::STATUS_SENT; @@ -1217,17 +1142,13 @@ class PaymentTest extends TestCase 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-TOKEN' => $this->token, ])->post('/api/v1/payments?include=invoices', $data); - - } - catch(ValidationException $e) { - // \Log::error('in the validator'); - $message = json_decode($e->validator->getMessageBag(),1); + } catch (ValidationException $e) { + // \Log::error('in the validator'); + $message = json_decode($e->validator->getMessageBag(), 1); //\Log::error($message); $this->assertNotNull($message); - } $this->assertNull($response); } - } diff --git a/tests/Feature/ProductTest.php b/tests/Feature/ProductTest.php index e1433806f9..63006411f3 100644 --- a/tests/Feature/ProductTest.php +++ b/tests/Feature/ProductTest.php @@ -44,7 +44,6 @@ class ProductTest extends TestCase public function testProductList() { - $data = [ 'first_name' => $this->faker->firstName, 'last_name' => $this->faker->lastName, @@ -64,7 +63,7 @@ class ProductTest extends TestCase $acc = $response->json(); - $account = Account::find($this->decodePrimaryKey($acc['data'][0]['account']['id'])); + $account = Account::find($this->decodePrimaryKey($acc['data'][0]['account']['id'])); $token = $account->default_company->tokens->first()->token; @@ -79,7 +78,8 @@ class ProductTest extends TestCase $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-TOKEN' => $token, - ])->post('/api/v1/products/', + ])->post( + '/api/v1/products/', [ 'product_key' => 'a-new-product-key', 'notes' => 'Product Notes', diff --git a/tests/Feature/QuoteTest.php b/tests/Feature/QuoteTest.php index 17e4b95c38..d241dee8e4 100644 --- a/tests/Feature/QuoteTest.php +++ b/tests/Feature/QuoteTest.php @@ -26,14 +26,12 @@ use Tests\TestCase; class QuoteTest extends TestCase { - use MakesHash; use DatabaseTransactions; use MockAccountData; public function setUp() :void { - parent::setUp(); Session::start(); @@ -47,43 +45,34 @@ class QuoteTest extends TestCase $this->withoutMiddleware( ThrottleRequests::class ); - - } public function testQuoteList() { - $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-TOKEN' => $this->token, ])->get('/api/v1/quotes'); $response->assertStatus(200); - } public function testQuoteRESTEndPoints() { - - - $response = null; - try{ + try { $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-TOKEN' => $this->token, ])->get('/api/v1/quotes/'.$this->encodePrimaryKey($this->quote->id)); - } - catch(ValidationException $e) { - - $message = json_decode($e->validator->getMessageBag(),1); - + } catch (ValidationException $e) { + $message = json_decode($e->validator->getMessageBag(), 1); } - if($response) + if ($response) { $response->assertStatus(200); + } $this->assertNotNull($response); @@ -134,7 +123,4 @@ class QuoteTest extends TestCase $response->assertStatus(200); } - } - - diff --git a/tests/Feature/RecurringInvoiceTest.php b/tests/Feature/RecurringInvoiceTest.php index bafa187649..3656ade4a4 100644 --- a/tests/Feature/RecurringInvoiceTest.php +++ b/tests/Feature/RecurringInvoiceTest.php @@ -24,13 +24,11 @@ use Tests\TestCase; class RecurringInvoiceTest extends TestCase { - use MakesHash; use DatabaseTransactions; public function setUp() :void { - parent::setUp(); Session::start(); @@ -42,8 +40,6 @@ class RecurringInvoiceTest extends TestCase $this->withoutMiddleware( ThrottleRequests::class ); - - } public function testRecurringInvoiceList() @@ -66,7 +62,7 @@ class RecurringInvoiceTest extends TestCase $acc = $response->json(); - $account = Account::find($this->decodePrimaryKey($acc['data'][0]['account']['id'])); + $account = Account::find($this->decodePrimaryKey($acc['data'][0]['account']['id'])); $company_token = $account->default_company->tokens()->first(); $token = $company_token->token; @@ -80,21 +76,19 @@ class RecurringInvoiceTest extends TestCase $this->assertNotNull($company); //$this->assertNotNull($user->token->company); - factory(\App\Models\Client::class, 1)->create(['user_id' => $user->id, 'company_id' => $company->id])->each(function ($c) use ($user, $company){ - - factory(\App\Models\ClientContact::class,1)->create([ + factory(\App\Models\Client::class, 1)->create(['user_id' => $user->id, 'company_id' => $company->id])->each(function ($c) use ($user, $company) { + factory(\App\Models\ClientContact::class, 1)->create([ 'user_id' => $user->id, 'client_id' => $c->id, 'company_id' => $company->id, 'is_primary' => 1 ]); - factory(\App\Models\ClientContact::class,1)->create([ + factory(\App\Models\ClientContact::class, 1)->create([ 'user_id' => $user->id, 'client_id' => $c->id, 'company_id' => $company->id ]); - }); $client = Client::all()->first(); @@ -107,7 +101,6 @@ class RecurringInvoiceTest extends TestCase ])->get('/api/v1/recurring_invoices'); $response->assertStatus(200); - } public function testRecurringInvoiceRESTEndPoints() @@ -129,7 +122,7 @@ class RecurringInvoiceTest extends TestCase ])->post('/api/v1/signup?include=account', $data); $acc = $response->json(); - $account = Account::find($this->decodePrimaryKey($acc['data'][0]['account']['id'])); + $account = Account::find($this->decodePrimaryKey($acc['data'][0]['account']['id'])); $company_token = $account->default_company->tokens()->first(); $token = $company_token->token; @@ -143,27 +136,25 @@ class RecurringInvoiceTest extends TestCase $this->assertNotNull($company); //$this->assertNotNull($user->token->company); - factory(\App\Models\Client::class, 1)->create(['user_id' => $user->id, 'company_id' => $company->id])->each(function ($c) use ($user, $company){ - - factory(\App\Models\ClientContact::class,1)->create([ + factory(\App\Models\Client::class, 1)->create(['user_id' => $user->id, 'company_id' => $company->id])->each(function ($c) use ($user, $company) { + factory(\App\Models\ClientContact::class, 1)->create([ 'user_id' => $user->id, 'client_id' => $c->id, 'company_id' => $company->id, 'is_primary' => 1 ]); - factory(\App\Models\ClientContact::class,1)->create([ + factory(\App\Models\ClientContact::class, 1)->create([ 'user_id' => $user->id, 'client_id' => $c->id, 'company_id' => $company->id ]); - }); $client = Client::all()->first(); factory(\App\Models\RecurringInvoice::class, 1)->create(['user_id' => $user->id, 'company_id' => $company->id, 'client_id' => $client->id]); - $RecurringInvoice = RecurringInvoice::where('user_id',$user->id)->first(); + $RecurringInvoice = RecurringInvoice::where('user_id', $user->id)->first(); $RecurringInvoice->save(); @@ -200,7 +191,5 @@ class RecurringInvoiceTest extends TestCase ])->delete('/api/v1/recurring_invoices/'.$this->encodePrimaryKey($RecurringInvoice->id)); $response->assertStatus(200); - } - } diff --git a/tests/Feature/RecurringInvoicesCronTest.php b/tests/Feature/RecurringInvoicesCronTest.php index 75015d0508..44c2777add 100644 --- a/tests/Feature/RecurringInvoicesCronTest.php +++ b/tests/Feature/RecurringInvoicesCronTest.php @@ -25,18 +25,14 @@ use Tests\TestCase; class RecurringInvoicesCronTest extends TestCase { - use DatabaseTransactions; use MockAccountData; public function setUp() :void { - parent::setUp(); $this->makeTestData(); - - } public function testCountCorrectNumberOfRecurringInvoicesDue() @@ -50,6 +46,4 @@ class RecurringInvoicesCronTest extends TestCase $this->assertEquals(6, $recurring_all->count()); } - - } diff --git a/tests/Feature/RecurringQuoteTest.php b/tests/Feature/RecurringQuoteTest.php index 5d2dc7c5a2..2a984e29fc 100644 --- a/tests/Feature/RecurringQuoteTest.php +++ b/tests/Feature/RecurringQuoteTest.php @@ -24,13 +24,11 @@ use Tests\TestCase; class RecurringQuoteTest extends TestCase { - use MakesHash; use DatabaseTransactions; public function setUp() :void { - parent::setUp(); Session::start(); @@ -42,7 +40,6 @@ class RecurringQuoteTest extends TestCase $this->withoutMiddleware( ThrottleRequests::class ); - } public function testRecurringQuoteList() @@ -65,7 +62,7 @@ class RecurringQuoteTest extends TestCase $acc = $response->json(); - $account = Account::find($this->decodePrimaryKey($acc['data'][0]['account']['id'])); + $account = Account::find($this->decodePrimaryKey($acc['data'][0]['account']['id'])); $company_token = $account->default_company->tokens()->first(); $token = $company_token->token; @@ -79,21 +76,19 @@ class RecurringQuoteTest extends TestCase $this->assertNotNull($company); //$this->assertNotNull($user->token->company); - factory(\App\Models\Client::class, 1)->create(['user_id' => $user->id, 'company_id' => $company->id])->each(function ($c) use ($user, $company){ - - factory(\App\Models\ClientContact::class,1)->create([ + factory(\App\Models\Client::class, 1)->create(['user_id' => $user->id, 'company_id' => $company->id])->each(function ($c) use ($user, $company) { + factory(\App\Models\ClientContact::class, 1)->create([ 'user_id' => $user->id, 'client_id' => $c->id, 'company_id' => $company->id, 'is_primary' => 1 ]); - factory(\App\Models\ClientContact::class,1)->create([ + factory(\App\Models\ClientContact::class, 1)->create([ 'user_id' => $user->id, 'client_id' => $c->id, 'company_id' => $company->id ]); - }); $client = Client::all()->first(); @@ -106,7 +101,6 @@ class RecurringQuoteTest extends TestCase ])->get('/api/v1/recurring_quotes'); $response->assertStatus(200); - } public function testRecurringQuoteRESTEndPoints() @@ -129,7 +123,7 @@ class RecurringQuoteTest extends TestCase $acc = $response->json(); - $account = Account::find($this->decodePrimaryKey($acc['data'][0]['account']['id'])); + $account = Account::find($this->decodePrimaryKey($acc['data'][0]['account']['id'])); $company_token = $account->default_company->tokens()->first(); $token = $company_token->token; @@ -143,27 +137,25 @@ class RecurringQuoteTest extends TestCase $this->assertNotNull($company); //$this->assertNotNull($user->token->company); - factory(\App\Models\Client::class, 1)->create(['user_id' => $user->id, 'company_id' => $company->id])->each(function ($c) use ($user, $company){ - - factory(\App\Models\ClientContact::class,1)->create([ + factory(\App\Models\Client::class, 1)->create(['user_id' => $user->id, 'company_id' => $company->id])->each(function ($c) use ($user, $company) { + factory(\App\Models\ClientContact::class, 1)->create([ 'user_id' => $user->id, 'client_id' => $c->id, 'company_id' => $company->id, 'is_primary' => 1 ]); - factory(\App\Models\ClientContact::class,1)->create([ + factory(\App\Models\ClientContact::class, 1)->create([ 'user_id' => $user->id, 'client_id' => $c->id, 'company_id' => $company->id ]); - }); $client = Client::all()->first(); factory(\App\Models\RecurringQuote::class, 1)->create(['user_id' => $user->id, 'company_id' => $company->id, 'client_id' => $client->id]); - $RecurringQuote = RecurringQuote::where('user_id',$user->id)->first(); + $RecurringQuote = RecurringQuote::where('user_id', $user->id)->first(); $RecurringQuote->save(); @@ -201,7 +193,5 @@ class RecurringQuoteTest extends TestCase ])->delete('/api/v1/recurring_quotes/'.$this->encodePrimaryKey($RecurringQuote->id)); $response->assertStatus(200); - } - } diff --git a/tests/Feature/RefundTest.php b/tests/Feature/RefundTest.php index 93e0f33d8f..d041e9710c 100644 --- a/tests/Feature/RefundTest.php +++ b/tests/Feature/RefundTest.php @@ -33,14 +33,12 @@ use Tests\TestCase; class RefundTest extends TestCase { - use MakesHash; use DatabaseTransactions; use MockAccountData; public function setUp() :void { - parent::setUp(); $this->withoutMiddleware( @@ -56,8 +54,6 @@ class RefundTest extends TestCase $this->makeTestData(); $this->withoutExceptionHandling(); - - } /** @@ -69,7 +65,7 @@ class RefundTest extends TestCase $client = ClientFactory::create($this->company->id, $this->user->id); $client->save(); - $this->invoice = InvoiceFactory::create($this->company->id,$this->user->id);//stub the company and user_id + $this->invoice = InvoiceFactory::create($this->company->id, $this->user->id);//stub the company and user_id $this->invoice->client_id = $client->id; $this->invoice->status_id = Invoice::STATUS_SENT; @@ -117,14 +113,12 @@ class RefundTest extends TestCase $response = false; try { - $response = $this->withHeaders([ + $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-TOKEN' => $this->token, ])->post('/api/v1/payments/refund', $data); - } - catch(ValidationException $e) { - - $message = json_decode($e->validator->getMessageBag(),1); + } catch (ValidationException $e) { + $message = json_decode($e->validator->getMessageBag(), 1); \Log::error($message); } @@ -135,7 +129,6 @@ class RefundTest extends TestCase $this->assertEquals(50, $arr['data']['refunded']); $this->assertEquals(Payment::STATUS_REFUNDED, $arr['data']['status_id']); - } /** @@ -150,7 +143,7 @@ class RefundTest extends TestCase $client = ClientFactory::create($this->company->id, $this->user->id); $client->save(); - $this->invoice = InvoiceFactory::create($this->company->id,$this->user->id);//stub the company and user_id + $this->invoice = InvoiceFactory::create($this->company->id, $this->user->id);//stub the company and user_id $this->invoice->client_id = $client->id; $this->invoice->status_id = Invoice::STATUS_SENT; @@ -207,23 +200,20 @@ class RefundTest extends TestCase $response = false; try { - $response = $this->withHeaders([ + $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-TOKEN' => $this->token, ])->post('/api/v1/payments/refund', $data); - } - catch(ValidationException $e) { - - $message = json_decode($e->validator->getMessageBag(),1); + } catch (ValidationException $e) { + $message = json_decode($e->validator->getMessageBag(), 1); $this->assertNotNull($message); \Log::error($message); } - if($response) + if ($response) { $response->assertStatus(302); - - + } } /** @@ -235,7 +225,7 @@ class RefundTest extends TestCase $client = ClientFactory::create($this->company->id, $this->user->id); $client->save(); - $this->invoice = InvoiceFactory::create($this->company->id,$this->user->id);//stub the company and user_id + $this->invoice = InvoiceFactory::create($this->company->id, $this->user->id);//stub the company and user_id $this->invoice->client_id = $client->id; $this->invoice->status_id = Invoice::STATUS_SENT; @@ -295,15 +285,14 @@ class RefundTest extends TestCase 'date' => '2020/12/12', ]; - $response = false; + $response = false; $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-TOKEN' => $this->token, ])->post('/api/v1/payments/refund', $data); - $response->assertStatus(200); - + $response->assertStatus(200); } /** @@ -314,7 +303,7 @@ class RefundTest extends TestCase $client = ClientFactory::create($this->company->id, $this->user->id); $client->save(); - $this->invoice = InvoiceFactory::create($this->company->id,$this->user->id);//stub the company and user_id + $this->invoice = InvoiceFactory::create($this->company->id, $this->user->id);//stub the company and user_id $this->invoice->client_id = $client->id; $this->invoice->status_id = Invoice::STATUS_SENT; @@ -374,23 +363,22 @@ class RefundTest extends TestCase 'date' => '2020/12/12', ]; - $response = false; + $response = false; - try{ - $response = $this->withHeaders([ + try { + $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-TOKEN' => $this->token, ])->post('/api/v1/payments/refund', $data); - }catch(ValidationException $e) - { - $message = json_decode($e->validator->getMessageBag(),1); + } catch (ValidationException $e) { + $message = json_decode($e->validator->getMessageBag(), 1); - \Log::error($message); + \Log::error($message); } - if($response) + if ($response) { $response->assertStatus(302); - + } } /** @@ -402,7 +390,7 @@ class RefundTest extends TestCase $client = ClientFactory::create($this->company->id, $this->user->id); $client->save(); - $this->invoice = InvoiceFactory::create($this->company->id,$this->user->id);//stub the company and user_id + $this->invoice = InvoiceFactory::create($this->company->id, $this->user->id);//stub the company and user_id $this->invoice->client_id = $client->id; $this->invoice->status_id = Invoice::STATUS_SENT; @@ -449,7 +437,7 @@ class RefundTest extends TestCase $this->assertNotNull($payment->invoices()); $this->assertEquals(1, $payment->invoices()->count()); - $this->invoice = InvoiceFactory::create($this->company->id,$this->user->id);//stub the company and user_id + $this->invoice = InvoiceFactory::create($this->company->id, $this->user->id);//stub the company and user_id $this->invoice->client_id = $client->id; $this->invoice->status_id = Invoice::STATUS_SENT; @@ -476,28 +464,27 @@ class RefundTest extends TestCase 'date' => '2020/12/12', ]; - $response = false; + $response = false; - try{ - $response = $this->withHeaders([ + try { + $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-TOKEN' => $this->token, ])->post('/api/v1/payments/refund', $data); - }catch(ValidationException $e) - { - $message = json_decode($e->validator->getMessageBag(),1); + } catch (ValidationException $e) { + $message = json_decode($e->validator->getMessageBag(), 1); - \Log::error($message); + \Log::error($message); } - if($response) + if ($response) { $response->assertStatus(302); - + } } /** * Test refunds where payments include credits - * + * * $10 invoice * $10 credit * $50 credit card payment @@ -507,14 +494,14 @@ class RefundTest extends TestCase * * payment.applied = 10 * credit.balance = 0 - * + * */ public function testRefundWhereCreditsArePresent() { $client = ClientFactory::create($this->company->id, $this->user->id); $client->save(); - $this->invoice = InvoiceFactory::create($this->company->id,$this->user->id);//stub the company and user_id + $this->invoice = InvoiceFactory::create($this->company->id, $this->user->id);//stub the company and user_id $this->invoice->client_id = $client->id; $this->invoice->status_id = Invoice::STATUS_SENT; @@ -529,7 +516,7 @@ class RefundTest extends TestCase $this->invoice = $this->invoice_calc->getInvoice(); $this->invoice->save(); - $this->credit = CreditFactory::create($this->company->id,$this->user->id); + $this->credit = CreditFactory::create($this->company->id, $this->user->id); $this->credit->client_id = $this->client->id; $this->credit->line_items = $this->buildLineItems(); @@ -560,14 +547,13 @@ class RefundTest extends TestCase $response = false; - try{ + try { $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-TOKEN' => $this->token, ])->post('/api/v1/payments', $data); - }catch(ValidationException $e) - { - $message = json_decode($e->validator->getMessageBag(),1); + } catch (ValidationException $e) { + $message = json_decode($e->validator->getMessageBag(), 1); \Log::error($message); } @@ -597,33 +583,27 @@ class RefundTest extends TestCase 'date' => '2020/12/12', ]; - $response = false; + $response = false; - try{ - $response = $this->withHeaders([ + try { + $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-TOKEN' => $this->token, ])->post('/api/v1/payments/refund', $data); - }catch(ValidationException $e) - { - $message = json_decode($e->validator->getMessageBag(),1); + } catch (ValidationException $e) { + $message = json_decode($e->validator->getMessageBag(), 1); \Log::error("refund message error"); \Log::error($message); } - $response->assertStatus(200); - $arr = $response->json(); + $response->assertStatus(200); + $arr = $response->json(); - $payment = Payment::find($this->decodePrimaryKey($arr['data']['id'])); + $payment = Payment::find($this->decodePrimaryKey($arr['data']['id'])); // \Log::error(print_r($payment->paymentables->toArray(),1)); - - - - } /*Additional scenarios*/ - } diff --git a/tests/Feature/TemplateApiTest.php b/tests/Feature/TemplateApiTest.php index 135cfaf6d8..4bb20df962 100644 --- a/tests/Feature/TemplateApiTest.php +++ b/tests/Feature/TemplateApiTest.php @@ -55,7 +55,6 @@ class TemplateApiTest extends TestCase public function testShowTemplate() { - $data = [ 'body' => $this->faker->firstName, 'subject' => $this->faker->firstName, @@ -69,7 +68,5 @@ class TemplateApiTest extends TestCase $response->assertStatus(200); - - } -} \ No newline at end of file +} diff --git a/tests/Feature/UserTest.php b/tests/Feature/UserTest.php index 917c93d38c..a959cb803f 100644 --- a/tests/Feature/UserTest.php +++ b/tests/Feature/UserTest.php @@ -2,7 +2,6 @@ namespace Feature; - use App\Factory\CompanyUserFactory; use App\Factory\UserFactory; use App\Models\Account; @@ -55,8 +54,6 @@ class UserTest extends TestCase public function testUserList() { - - $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-TOKEN' => $this->token, @@ -64,7 +61,6 @@ class UserTest extends TestCase ])->get('/api/v1/users'); $response->assertStatus(200); - } public function testUserStore() @@ -80,7 +76,7 @@ class UserTest extends TestCase ], ]; - $response = $this->withHeaders([ + $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-TOKEN' => $this->token, 'X-API-PASSWORD' => 'ALongAndBriliantPassword', @@ -100,7 +96,7 @@ class UserTest extends TestCase $user->last_name = 'Palloni'; $user->save(); - $response = $this->withHeaders([ + $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-TOKEN' => $this->token, 'X-API-PASSWORD' => 'ALongAndBriliantPassword', @@ -112,7 +108,7 @@ class UserTest extends TestCase $this->assertEquals($user->company_user->company_id, $this->company->id); - $response = $this->withHeaders([ + $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-TOKEN' => $this->token, 'X-API-PASSWORD' => 'ALongAndBriliantPassword', @@ -127,7 +123,6 @@ class UserTest extends TestCase $this->assertNull($cu); $this->assertNull($ct); $this->assertNotNull($user); - } public function testAttachUserToMultipleCompanies() @@ -182,7 +177,7 @@ class UserTest extends TestCase ], ]; - $response = $this->withHeaders([ + $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-TOKEN' => $user_1_company_token->token, ])->post('/api/v1/users?include=company_user', $data); @@ -218,7 +213,7 @@ class UserTest extends TestCase ], ]; - $response = $this->withHeaders([ + $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-TOKEN' => $user_1_company_token->token, 'X-API-PASSWORD' => 'ALongAndBriliantPassword', @@ -232,7 +227,5 @@ class UserTest extends TestCase $this->assertTrue($arr['data']['company_user']['is_admin']); $this->assertFalse($arr['data']['company_user']['is_owner']); $this->assertEquals($arr['data']['company_user']['permissions'], 'create_invoice,create_invoice'); - - } -} \ No newline at end of file +} diff --git a/tests/Integration/CheckCacheTest.php b/tests/Integration/CheckCacheTest.php index 00c15d3701..f46b519265 100644 --- a/tests/Integration/CheckCacheTest.php +++ b/tests/Integration/CheckCacheTest.php @@ -25,15 +25,15 @@ class CheckCacheTest extends TestCase public function testWarmedUpCache() { - $date_formats = Cache::get('date_formats'); + $date_formats = Cache::get('date_formats'); - $this->assertNotNull($date_formats); + $this->assertNotNull($date_formats); } public function testCacheCount() { - $date_formats = Cache::get('date_formats'); + $date_formats = Cache::get('date_formats'); - $this->assertEquals(14, count($date_formats)); + $this->assertEquals(14, count($date_formats)); } -} \ No newline at end of file +} diff --git a/tests/Integration/CheckRemindersTest.php b/tests/Integration/CheckRemindersTest.php index 199eeeb1e7..bd46a388ca 100644 --- a/tests/Integration/CheckRemindersTest.php +++ b/tests/Integration/CheckRemindersTest.php @@ -165,4 +165,4 @@ class CheckRemindersTest extends TestCase $this->assertEquals($this->invoice->next_send_date, null); } -} \ No newline at end of file +} diff --git a/tests/Integration/CompanyLedgerTest.php b/tests/Integration/CompanyLedgerTest.php index 0ef32f5f7f..4d1d11e18e 100644 --- a/tests/Integration/CompanyLedgerTest.php +++ b/tests/Integration/CompanyLedgerTest.php @@ -70,7 +70,6 @@ class CompanyLedgerTest extends TestCase if ($tableData->count()) { Cache::forever($name, $tableData); } - } $this->account = factory(\App\Models\Account::class)->create(); @@ -101,7 +100,7 @@ class CompanyLedgerTest extends TestCase $this->user = User::whereEmail('user@example.com')->first(); - if(!$this->user){ + if (!$this->user) { $this->user = factory(\App\Models\User::class)->create([ 'password' => Hash::make('ALongAndBriliantPassword'), 'confirmation_code' => $this->createDbHash(config('database.default')) @@ -123,21 +122,19 @@ class CompanyLedgerTest extends TestCase 'token' => $this->token, ]); - $this->client = factory(\App\Models\Client::class)->create([ + $this->client = factory(\App\Models\Client::class)->create([ 'user_id' => $this->user->id, 'company_id' => $this->company->id, ]); - factory(\App\Models\ClientContact::class,1)->create([ + factory(\App\Models\ClientContact::class, 1)->create([ 'user_id' => $this->user->id, 'client_id' => $this->client->id, 'company_id' => $this->company->id, 'is_primary' => 1, 'send_email' => true, ]); - - } public function testBaseLine() @@ -162,14 +159,14 @@ class CompanyLedgerTest extends TestCase 'line_items' => $line_items ]; -/* Test adding one invoice */ + /* Test adding one invoice */ $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-TOKEN' => $this->token, ])->post('/api/v1/invoices/', $data) ->assertStatus(200); - $acc = $response->json(); + $acc = $response->json(); $invoice = Invoice::find($this->decodePrimaryKey($acc['data']['id'])); @@ -183,14 +180,14 @@ class CompanyLedgerTest extends TestCase $this->assertEquals($invoice->client->paid_to_date, 0); -/* Test adding another invoice */ + /* Test adding another invoice */ $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-TOKEN' => $this->token, ])->post('/api/v1/invoices/', $data) ->assertStatus(200); - $acc = $response->json(); + $acc = $response->json(); $invoice = Invoice::find($this->decodePrimaryKey($acc['data']['id'])); $invoice->service()->markSent()->save(); @@ -201,7 +198,7 @@ class CompanyLedgerTest extends TestCase $this->assertEquals($invoice_ledger->balance, $invoice->client->balance); $this->assertEquals($invoice->client->paid_to_date, 0); -/* Test making a payment */ + /* Test making a payment */ $data = [ 'client_id' => $this->encodePrimaryKey($invoice->client_id), @@ -221,7 +218,7 @@ class CompanyLedgerTest extends TestCase 'X-API-TOKEN' => $this->token, ])->post('/api/v1/payments/', $data); - $acc = $response->json(); + $acc = $response->json(); $payment = Payment::find($this->decodePrimaryKey($acc['data']['id'])); @@ -235,7 +232,7 @@ class CompanyLedgerTest extends TestCase $this->assertEquals(Invoice::STATUS_PAID, $invoice->status_id); -/* Test making a refund of a payment */ + /* Test making a refund of a payment */ $refund = $invoice->amount; $data = [ @@ -258,23 +255,9 @@ class CompanyLedgerTest extends TestCase ])->post('/api/v1/payments/refund', $data); - $acc = $response->json(); + $acc = $response->json(); $invoice = Invoice::find($invoice->id); $this->assertEquals($refund, $invoice->balance); - - - - - - - - - - - - - } - -} \ No newline at end of file +} diff --git a/tests/Integration/DesignTest.php b/tests/Integration/DesignTest.php index 02f548949f..39cd437bb9 100644 --- a/tests/Integration/DesignTest.php +++ b/tests/Integration/DesignTest.php @@ -28,7 +28,7 @@ class DesignTest extends TestCase { use MakesInvoiceHtml; use PdfMaker; - use MockAccountData; + use MockAccountData; use GeneratesCounter; use MakesHash; @@ -51,11 +51,11 @@ class DesignTest extends TestCase $design = Design::find(3); - $designer = new Designer($this->invoice, $design, $this->company->settings->pdf_variables, 'quote'); + $designer = new Designer($this->invoice, $design, $this->company->settings->pdf_variables, 'quote'); - $html = $designer->build()->getHtml(); + $html = $designer->build()->getHtml(); - $this->assertNotNull($html); + $this->assertNotNull($html); $this->invoice = factory(\App\Models\Invoice::class)->create([ @@ -66,13 +66,13 @@ class DesignTest extends TestCase $this->invoice->uses_inclusive_taxes = false; - $settings = $this->invoice->client->settings; - $settings->invoice_design_id = "VolejRejNm"; + $settings = $this->invoice->client->settings; + $settings->invoice_design_id = "VolejRejNm"; - $this->client->settings = $settings; - $this->client->save(); + $this->client->settings = $settings; + $this->client->save(); - CreateInvoicePdf::dispatchNow($this->invoice, $this->invoice->company, $this->invoice->client->primary_contact()->first()); + CreateInvoicePdf::dispatchNow($this->invoice, $this->invoice->company, $this->invoice->client->primary_contact()->first()); } public function testQuoteDesignExists() @@ -108,7 +108,6 @@ class DesignTest extends TestCase public function testCreditDesignExists() { - $design = Design::find(3); $designer = new Designer($this->credit, $design, $this->company->settings->pdf_variables, 'credit'); @@ -132,36 +131,31 @@ class DesignTest extends TestCase public function testAllDesigns() { + for ($x=1; $x<=10; $x++) { + $settings = $this->invoice->client->settings; + $settings->quote_design_id = (string)$this->encodePrimaryKey($x); - for($x=1; $x<=10; $x++) - { + $this->quote->client_id = $this->client->id; + $this->quote->setRelation('client', $this->client); + $this->quote->save(); - $settings = $this->invoice->client->settings; - $settings->quote_design_id = (string)$this->encodePrimaryKey($x); + $this->client->settings = $settings; + $this->client->save(); - $this->quote->client_id = $this->client->id; - $this->quote->setRelation('client', $this->client); - $this->quote->save(); - - $this->client->settings = $settings; - $this->client->save(); - - CreateQuotePdf::dispatchNow($this->quote, $this->quote->company, $this->quote->client->primary_contact()->first()); - - $this->quote->number = $this->getNextQuoteNumber($this->quote->client); - $this->quote->save(); + CreateQuotePdf::dispatchNow($this->quote, $this->quote->company, $this->quote->client->primary_contact()->first()); + $this->quote->number = $this->getNextQuoteNumber($this->quote->client); + $this->quote->save(); } $this->assertTrue(true); - } -/////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////// @@ -269,6 +263,5 @@ class DesignTest extends TestCase // CreateQuotePdf::dispatchNow($this->quote, $this->quote->company, $this->quote->client->primary_contact()->first()); // } - // + // } - diff --git a/tests/Integration/HtmlGenerationTest.php b/tests/Integration/HtmlGenerationTest.php index 4cb977205e..9619315afe 100644 --- a/tests/Integration/HtmlGenerationTest.php +++ b/tests/Integration/HtmlGenerationTest.php @@ -34,6 +34,4 @@ class HtmlGenerationTest extends TestCase $this->assertNotNull($html); } - - -} \ No newline at end of file +} diff --git a/tests/Integration/InvoiceUploadTest.php b/tests/Integration/InvoiceUploadTest.php index ec292d5b33..b0be0e1b0c 100644 --- a/tests/Integration/InvoiceUploadTest.php +++ b/tests/Integration/InvoiceUploadTest.php @@ -28,12 +28,8 @@ class InvoiceUploadTest extends TestCase public function testInvoiceUploadWorks() { - CreateInvoicePdf::dispatchNow($this->invoice, $this->invoice->company, $this->invoice->client->primary_contact()->first()); $this->assertNotNull($this->invoice->service()->getInvoicePdf($this->invoice->client->primary_contact()->first())); - } - - -} \ No newline at end of file +} diff --git a/tests/Integration/MarkInvoicePaidTest.php b/tests/Integration/MarkInvoicePaidTest.php index fb4359d8e0..8bc169e124 100644 --- a/tests/Integration/MarkInvoicePaidTest.php +++ b/tests/Integration/MarkInvoicePaidTest.php @@ -36,7 +36,6 @@ class MarkInvoicePaidTest extends TestCase public function testMarkInvoicePaidInvoice() { - $invoice = Invoice::find($this->invoice->id); $invoice_balance = $invoice->balance; $client = $invoice->client; @@ -51,14 +50,13 @@ class MarkInvoicePaidTest extends TestCase $this->assertEquals(1, count($invoice->payments)); - foreach($invoice->payments as $payment) { - $this->assertEquals(round($this->invoice->amount,2), $payment->amount); + foreach ($invoice->payments as $payment) { + $this->assertEquals(round($this->invoice->amount, 2), $payment->amount); } - //events are not firing which makes this impossible to control. + //events are not firing which makes this impossible to control. $this->assertEquals(0.00, $invoice->balance); $this->assertEquals(($client_balance - $invoice_balance), $client->balance); } - -} \ No newline at end of file +} diff --git a/tests/Integration/MultiDBUserTest.php b/tests/Integration/MultiDBUserTest.php index 5208dd73a1..839067bd81 100644 --- a/tests/Integration/MultiDBUserTest.php +++ b/tests/Integration/MultiDBUserTest.php @@ -24,13 +24,13 @@ use Tests\TestCase; class MultiDBUserTest extends TestCase { - public function setUp() :void { parent::setUp(); - if (! config('ninja.db.multi_db_enabled')) + if (! config('ninja.db.multi_db_enabled')) { $this->markTestSkipped('Multi DB not enabled - skipping'); + } User::unguard(); @@ -103,7 +103,6 @@ class MultiDBUserTest extends TestCase ]); User::unguard(false); - } public function test_oauth_user_db2_exists() @@ -111,7 +110,6 @@ class MultiDBUserTest extends TestCase $user = MultiDB::hasUser(['email' => 'db2@example.com', 'oauth_user_id' => 'abc']); $this->assertEquals($user->email, 'db2@example.com'); - } public function test_oauth_user_db1_exists() @@ -119,7 +117,6 @@ class MultiDBUserTest extends TestCase $user = MultiDB::hasUser(['email' => 'db1@example.com', 'oauth_user_id' => '123']); $this->assertEquals($user->email, 'db1@example.com'); - } public function test_check_user_exists() @@ -171,25 +168,22 @@ class MultiDBUserTest extends TestCase ], ]; - try{ + try { $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-TOKEN' => $this->token, 'X-API-PASSWORD' => 'ALongAndBriliantPassword', ])->post('/api/v1/users?include=company_user', $data); + } catch (ValidationException $e) { + \Log::error('in the validator'); + $message = json_decode($e->validator->getMessageBag(), 1); + \Log::error($message); + $this->assertNotNull($message); + } - } - catch(ValidationException $e) { - \Log::error('in the validator'); - $message = json_decode($e->validator->getMessageBag(),1); - \Log::error($message); - $this->assertNotNull($message); - - } - - if($response) + if ($response) { $response->assertStatus(302); - + } } @@ -209,31 +203,26 @@ class MultiDBUserTest extends TestCase ], ]; - try{ + try { $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-TOKEN' => $this->token, ])->post('/api/v1/users?include=company_user', $data); + } catch (ValidationException $e) { + \Log::error('in the validator'); + $message = json_decode($e->validator->getMessageBag(), 1); + \Log::error($message); + $this->assertNotNull($message); + } - - } - catch(ValidationException $e) { - \Log::error('in the validator'); - $message = json_decode($e->validator->getMessageBag(),1); - \Log::error($message); - $this->assertNotNull($message); - - } - - if($response) + if ($response) { $response->assertStatus(200); - + } } public function tearDown() :void { - DB::connection('db-ninja-01')->table('users')->delete(); - DB::connection('db-ninja-02')->table('users')->delete(); - + DB::connection('db-ninja-01')->table('users')->delete(); + DB::connection('db-ninja-02')->table('users')->delete(); } } diff --git a/tests/Integration/UniqueEmailTest.php b/tests/Integration/UniqueEmailTest.php index fcb7ea827e..bb26f8c662 100644 --- a/tests/Integration/UniqueEmailTest.php +++ b/tests/Integration/UniqueEmailTest.php @@ -26,8 +26,9 @@ class UniqueEmailTest extends TestCase User::unguard(); - if (! config('ninja.db.multi_db_enabled')) + if (! config('ninja.db.multi_db_enabled')) { $this->markTestSkipped('Multi DB not enabled - skipping'); + } $this->rule = new NewUniqueUserRule(); @@ -74,26 +75,21 @@ class UniqueEmailTest extends TestCase User::on('db-ninja-01')->create($user); User::on('db-ninja-02')->create($user2); - } public function test_unique_emails_detected_on_database() { - $this->assertFalse($this->rule->passes('email', 'user@example.com')); - } public function test_no_unique_emails_detected() { - $this->assertTrue($this->rule->passes('email', 'nohit@example.com')); - } public function tearDown() :void - { - DB::connection('db-ninja-01')->table('users')->delete(); - DB::connection('db-ninja-02')->table('users')->delete(); + { + DB::connection('db-ninja-01')->table('users')->delete(); + DB::connection('db-ninja-02')->table('users')->delete(); } -} \ No newline at end of file +} diff --git a/tests/Integration/UpdateCompanyLedgerTest.php b/tests/Integration/UpdateCompanyLedgerTest.php index 7a30b753ca..27be12e219 100644 --- a/tests/Integration/UpdateCompanyLedgerTest.php +++ b/tests/Integration/UpdateCompanyLedgerTest.php @@ -39,7 +39,6 @@ class UpdateCompanyLedgerTest extends TestCase */ public function testPaymentIsPresentInLedger() { - $invoice = $this->invoice->service()->markPaid()->save(); $ledger = CompanyLedger::whereClientId($invoice->client_id) @@ -49,7 +48,6 @@ class UpdateCompanyLedgerTest extends TestCase $payment = $ledger->adjustment * - 1; $this->assertEquals($invoice->amount, $payment); - } /** @@ -67,6 +65,4 @@ class UpdateCompanyLedgerTest extends TestCase $this->assertGreaterThan(1, count($ledger)); } - - -} \ No newline at end of file +} diff --git a/tests/Integration/UpdateCompanyUserTest.php b/tests/Integration/UpdateCompanyUserTest.php index a1bf0c0de7..ef5dc42c95 100644 --- a/tests/Integration/UpdateCompanyUserTest.php +++ b/tests/Integration/UpdateCompanyUserTest.php @@ -49,11 +49,9 @@ class UpdateCompanyUserTest extends TestCase 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-TOKEN' => $this->token, ])->put('/api/v1/company_users/'.$this->encodePrimaryKey($this->user->id), $user); - - } - catch(ValidationException $e) { - // \Log::error('in the validator'); - $message = json_decode($e->validator->getMessageBag(),1); + } catch (ValidationException $e) { + // \Log::error('in the validator'); + $message = json_decode($e->validator->getMessageBag(), 1); //\Log::error($message); $this->assertNotNull($message); } @@ -64,5 +62,4 @@ class UpdateCompanyUserTest extends TestCase $this->assertEquals('ninja', $arr['data']['settings']['invoice']); } - -} \ No newline at end of file +} diff --git a/tests/Integration/UploadFileTest.php b/tests/Integration/UploadFileTest.php index 2a22af5f00..fcc121fb25 100644 --- a/tests/Integration/UploadFileTest.php +++ b/tests/Integration/UploadFileTest.php @@ -49,10 +49,13 @@ class UploadFileTest extends TestCase $image = UploadedFile::fake()->image('avatar.jpg'); $document = UploadFile::dispatchNow( - $image, UploadFile::IMAGE, $this->invoice->user, $this->invoice->company, $this->invoice + $image, + UploadFile::IMAGE, + $this->invoice->user, + $this->invoice->company, + $this->invoice ); $this->assertNotNull($document); - } } diff --git a/tests/Integration/UploadLogoTest.php b/tests/Integration/UploadLogoTest.php index 3d142b5c6a..6cf2ce3b58 100644 --- a/tests/Integration/UploadLogoTest.php +++ b/tests/Integration/UploadLogoTest.php @@ -45,7 +45,6 @@ class UploadLogoTest extends TestCase public function testLogoUploadWorks() { - Storage::fake('avatars'); $data = [ @@ -62,7 +61,7 @@ class UploadLogoTest extends TestCase $acc = $response->json(); - $logo = $acc['data']['settings']['company_logo']; + $logo = $acc['data']['settings']['company_logo']; $logo_file = Storage::url($logo); @@ -73,7 +72,6 @@ class UploadLogoTest extends TestCase public function testLogoUploadfailure() { - Storage::fake('avatars'); $data = [ @@ -89,14 +87,11 @@ class UploadLogoTest extends TestCase //$acc = $response->json(); $response->assertStatus(302); - - } public function testLogoUploadNoAttribute() { - Storage::fake('avatars'); $data = [ @@ -109,7 +104,5 @@ class UploadLogoTest extends TestCase ])->put('/api/v1/companies/'.$this->encodePrimaryKey($this->company->id), $data); $response->assertStatus(200); - } - -} \ No newline at end of file +} diff --git a/tests/MockAccountData.php b/tests/MockAccountData.php index d0d8c2de53..e78339e558 100644 --- a/tests/MockAccountData.php +++ b/tests/MockAccountData.php @@ -45,17 +45,16 @@ use Illuminate\Support\Facades\Schema; */ trait MockAccountData { + use MakesHash; + use GeneratesCounter; - use MakesHash; - use GeneratesCounter; + public $account; - public $account; + public $company; - public $company; + public $user; - public $user; - - public $client; + public $client; public $token; @@ -63,8 +62,8 @@ trait MockAccountData public $quote; - public function makeTestData() - { + public function makeTestData() + { /* Warm up the cache !*/ $cached_tables = config('ninja.cached_tables'); @@ -88,7 +87,6 @@ trait MockAccountData if ($tableData->count()) { Cache::forever($name, $tableData); } - } $this->account = factory(\App\Models\Account::class)->create(); @@ -119,7 +117,7 @@ trait MockAccountData $this->user = User::whereEmail('user@example.com')->first(); - if(!$this->user){ + if (!$this->user) { $this->user = factory(\App\Models\User::class)->create([ 'password' => Hash::make('ALongAndBriliantPassword'), 'confirmation_code' => $this->createDbHash(config('database.default')) @@ -150,16 +148,16 @@ trait MockAccountData // 'settings' => json_encode(DefaultSettings::userSettings()), // ]); - // $this->client = ClientFactory::create($this->company->id, $this->user->id); - // $this->client->save(); + // $this->client = ClientFactory::create($this->company->id, $this->user->id); + // $this->client->save(); - $this->client = factory(\App\Models\Client::class)->create([ + $this->client = factory(\App\Models\Client::class)->create([ 'user_id' => $this->user->id, 'company_id' => $this->company->id, ]); - factory(\App\Models\ClientContact::class,1)->create([ + factory(\App\Models\ClientContact::class, 1)->create([ 'user_id' => $this->user->id, 'client_id' => $this->client->id, 'company_id' => $this->company->id, @@ -167,7 +165,7 @@ trait MockAccountData 'send_email' => true, ]); - factory(\App\Models\ClientContact::class,1)->create([ + factory(\App\Models\ClientContact::class, 1)->create([ 'user_id' => $this->user->id, 'client_id' => $this->client->id, 'company_id' => $this->company->id, @@ -197,15 +195,15 @@ trait MockAccountData // ]); - $this->invoice->line_items = $this->buildLineItems(); - $this->invoice->uses_inclusive_taxes = false; + $this->invoice->line_items = $this->buildLineItems(); + $this->invoice->uses_inclusive_taxes = false; $this->invoice->save(); - $this->invoice_calc = new InvoiceSum($this->invoice); - $this->invoice_calc->build(); + $this->invoice_calc = new InvoiceSum($this->invoice); + $this->invoice_calc->build(); - $this->invoice = $this->invoice_calc->getInvoice(); + $this->invoice = $this->invoice_calc->getInvoice(); $this->invoice->setRelation('client', $this->client); $this->invoice->setRelation('company', $this->company); @@ -237,14 +235,14 @@ trait MockAccountData $this->quote->save(); - $this->credit = CreditFactory::create($this->company->id,$this->user->id); + $this->credit = CreditFactory::create($this->company->id, $this->user->id); $this->credit->client_id = $this->client->id; - $this->credit->line_items = $this->buildLineItems(); + $this->credit->line_items = $this->buildLineItems(); $this->credit->amount = 10; $this->credit->balance = 10; - $this->credit->uses_inclusive_taxes = false; + $this->credit->uses_inclusive_taxes = false; $this->credit->save(); @@ -258,22 +256,19 @@ trait MockAccountData $contacts = $this->invoice->client->contacts; $contacts->each(function ($contact) { - $invitation = InvoiceInvitation::whereCompanyId($this->invoice->company_id) ->whereClientContactId($contact->id) ->whereInvoiceId($this->invoice->id) ->first(); - if(!$invitation && $contact->send_email) { + if (!$invitation && $contact->send_email) { $ii = InvoiceInvitationFactory::create($this->invoice->company_id, $this->invoice->user_id); $ii->invoice_id = $this->invoice->id; $ii->client_contact_id = $contact->id; $ii->save(); - } - else if($invitation && !$contact->send_email) { + } elseif ($invitation && !$contact->send_email) { $invitation->delete(); } - }); $invitations = InvoiceInvitation::whereCompanyId($this->invoice->company_id) @@ -354,9 +349,7 @@ trait MockAccountData $gs->name = 'Default Client Settings'; $gs->save(); - if(config('ninja.testvars.stripe')) - { - + if (config('ninja.testvars.stripe')) { $cg = new CompanyGateway; $cg->company_id = $this->company->id; $cg->user_id = $this->user->id; @@ -380,19 +373,18 @@ trait MockAccountData $cg->config = encrypt(config('ninja.testvars.stripe')); $cg->save(); } - - } + } - private function buildLineItems() - { - $line_items = []; + private function buildLineItems() + { + $line_items = []; - $item = InvoiceItemFactory::create(); - $item->quantity = 1; - $item->cost =10; + $item = InvoiceItemFactory::create(); + $item->quantity = 1; + $item->cost =10; - $line_items[] = $item; + $line_items[] = $item; // $line_items[] = $item; // $line_items[] = $item; @@ -434,7 +426,6 @@ trait MockAccountData // $line_items[] = $item; // $line_items[] = $item; - return $line_items; - - } -} \ No newline at end of file + return $line_items; + } +} diff --git a/tests/Pdf/PdfGenerationTest.php b/tests/Pdf/PdfGenerationTest.php index 0aaeff7b01..b57d1f47ca 100644 --- a/tests/Pdf/PdfGenerationTest.php +++ b/tests/Pdf/PdfGenerationTest.php @@ -12,136 +12,128 @@ use Tests\TestCase; */ class PdfGenerationTest extends TestCase { - public function setUp() :void { - - parent::setUp(); - - } + parent::setUp(); + } - private function makePdf($header, $footer, $html, $pdf) - { - Browsershot::html($html) - //->showBrowserHeaderAndFooter() - //->headerHtml($header) - //->footerHtml($footer) - ->waitUntilNetworkIdle() - //->margins(10,10,10,10) - ->savePdf($pdf); - } + private function makePdf($header, $footer, $html, $pdf) + { + Browsershot::html($html) + //->showBrowserHeaderAndFooter() + //->headerHtml($header) + //->footerHtml($footer) + ->waitUntilNetworkIdle() + //->margins(10,10,10,10) + ->savePdf($pdf); + } - public function testPdfGeneration() - { - $html = file_get_contents(base_path().'/tests/Pdf/invoice.html'); - $pdf = base_path().'/tests/Pdf/invoice.pdf'; + public function testPdfGeneration() + { + $html = file_get_contents(base_path().'/tests/Pdf/invoice.html'); + $pdf = base_path().'/tests/Pdf/invoice.pdf'; - $header = '
'; + $header = '
'; - $footer = '