mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-31 00:34:34 -04:00
commit
0b34fd0738
@ -70,6 +70,31 @@ class DemoMode extends Command
|
|||||||
{
|
{
|
||||||
set_time_limit(0);
|
set_time_limit(0);
|
||||||
|
|
||||||
|
$cached_tables = config('ninja.cached_tables');
|
||||||
|
|
||||||
|
foreach ($cached_tables as $name => $class) {
|
||||||
|
if (! Cache::has($name)) {
|
||||||
|
// check that the table exists in case the migration is pending
|
||||||
|
if (! Schema::hasTable((new $class())->getTable())) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if ($name == 'payment_terms') {
|
||||||
|
$orderBy = 'num_days';
|
||||||
|
} elseif ($name == 'fonts') {
|
||||||
|
$orderBy = 'sort_order';
|
||||||
|
} elseif (in_array($name, ['currencies', 'industries', 'languages', 'countries', 'banks'])) {
|
||||||
|
$orderBy = 'name';
|
||||||
|
} else {
|
||||||
|
$orderBy = 'id';
|
||||||
|
}
|
||||||
|
$tableData = $class::orderBy($orderBy)->get();
|
||||||
|
if ($tableData->count()) {
|
||||||
|
Cache::forever($name, $tableData);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$this->info("Migrating");
|
$this->info("Migrating");
|
||||||
Artisan::call('migrate:fresh --force');
|
Artisan::call('migrate:fresh --force');
|
||||||
|
|
||||||
@ -257,7 +282,7 @@ class DemoMode extends Command
|
|||||||
'company_id' => $company->id
|
'company_id' => $company->id
|
||||||
]);
|
]);
|
||||||
|
|
||||||
factory(\App\Models\ClientContact::class, 1)->create([
|
factory(\App\Models\ClientContact::class)->create([
|
||||||
'user_id' => $user->id,
|
'user_id' => $user->id,
|
||||||
'client_id' => $client->id,
|
'client_id' => $client->id,
|
||||||
'company_id' => $company->id,
|
'company_id' => $company->id,
|
||||||
@ -301,7 +326,7 @@ class DemoMode extends Command
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
|
|
||||||
factory(\App\Models\VendorContact::class, 1)->create([
|
factory(\App\Models\VendorContact::class)->create([
|
||||||
'user_id' => $client->user->id,
|
'user_id' => $client->user->id,
|
||||||
'vendor_id' => $vendor->id,
|
'vendor_id' => $vendor->id,
|
||||||
'company_id' => $client->company_id,
|
'company_id' => $client->company_id,
|
||||||
|
@ -151,7 +151,14 @@ class EmailTemplateDefaults
|
|||||||
|
|
||||||
public static function emailPaymentTemplate()
|
public static function emailPaymentTemplate()
|
||||||
{
|
{
|
||||||
return Parsedown::instance()->line(self::transformText('payment_message'));
|
$converter = new CommonMarkConverter([
|
||||||
|
'html_input' => 'strip',
|
||||||
|
'allow_unsafe_links' => false,
|
||||||
|
]);
|
||||||
|
|
||||||
|
return $converter->convertToHtml(self::transformText('payment_message'));
|
||||||
|
|
||||||
|
// return Parsedown::instance()->line(self::transformText('payment_message'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function emailReminder1Subject()
|
public static function emailReminder1Subject()
|
||||||
|
@ -667,7 +667,7 @@ class QuoteController extends BaseController
|
|||||||
//return response()->download(TempFile::path($quote->pdf_file_path()), basename($quote->pdf_file_path()));
|
//return response()->download(TempFile::path($quote->pdf_file_path()), basename($quote->pdf_file_path()));
|
||||||
break;
|
break;
|
||||||
case 'archive':
|
case 'archive':
|
||||||
$this->invoice_repo->archive($quote);
|
$this->quote_repo->archive($quote);
|
||||||
return $this->listResponse($quote);
|
return $this->listResponse($quote);
|
||||||
break;
|
break;
|
||||||
case 'delete':
|
case 'delete':
|
||||||
|
@ -34,7 +34,7 @@ class ProductController extends BaseController
|
|||||||
*/
|
*/
|
||||||
public function index(Request $request)
|
public function index(Request $request)
|
||||||
{
|
{
|
||||||
$company = Company::where('company_key', $request->header('X-API-COMPANY-KEY'))->first();
|
$company = Company::where('company_key', $request->header('X-API-COMPANY-KEY'))->firstOrFail();
|
||||||
|
|
||||||
if(!$company->enable_shop_api)
|
if(!$company->enable_shop_api)
|
||||||
return response()->json(['message' => 'Shop is disabled', 'errors' => new \stdClass],403);
|
return response()->json(['message' => 'Shop is disabled', 'errors' => new \stdClass],403);
|
||||||
@ -46,7 +46,7 @@ class ProductController extends BaseController
|
|||||||
|
|
||||||
public function show(Request $request, string $product_key)
|
public function show(Request $request, string $product_key)
|
||||||
{
|
{
|
||||||
$company = Company::where('company_key', $request->header('X-API-COMPANY-KEY'))->first();
|
$company = Company::where('company_key', $request->header('X-API-COMPANY-KEY'))->firstOrFail();
|
||||||
|
|
||||||
if(!$company->enable_shop_api)
|
if(!$company->enable_shop_api)
|
||||||
return response()->json(['message' => 'Shop is disabled', 'errors' => new \stdClass],403);
|
return response()->json(['message' => 'Shop is disabled', 'errors' => new \stdClass],403);
|
||||||
|
66
app/Observers/CompanyGatewayObserver.php
Normal file
66
app/Observers/CompanyGatewayObserver.php
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Observers;
|
||||||
|
|
||||||
|
use App\Models\CompanyGateway;
|
||||||
|
|
||||||
|
class CompanyGatewayObserver
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Handle the company gateway "created" event.
|
||||||
|
*
|
||||||
|
* @param \App\CompanyGateway $company_gateway
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function created(CompanyGateway $company_gateway)
|
||||||
|
{
|
||||||
|
if(!$company_gateway->label){
|
||||||
|
$company_gateway->label = $company_gateway->gateway->name;
|
||||||
|
$company_gateway->save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle the company gateway "updated" event.
|
||||||
|
*
|
||||||
|
* @param \App\CompanyGateway $company_gateway
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function updated(CompanyGateway $company_gateway)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle the company gateway "deleted" event.
|
||||||
|
*
|
||||||
|
* @param \App\CompanyGateway $company_gateway
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function deleted(CompanyGateway $company_gateway)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle the company gateway "restored" event.
|
||||||
|
*
|
||||||
|
* @param \App\CompanyGateway $company_gateway
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function restored(CompanyGateway $company_gateway)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle the company gateway "force deleted" event.
|
||||||
|
*
|
||||||
|
* @param \App\CompanyGateway $company_gateway
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function forceDeleted(CompanyGateway $company_gateway)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
}
|
@ -15,6 +15,7 @@ use App\Helpers\Language\DecoratedTranslator;
|
|||||||
use App\Models\Account;
|
use App\Models\Account;
|
||||||
use App\Models\Client;
|
use App\Models\Client;
|
||||||
use App\Models\Company;
|
use App\Models\Company;
|
||||||
|
use App\Models\CompanyGateway;
|
||||||
use App\Models\CompanyToken;
|
use App\Models\CompanyToken;
|
||||||
use App\Models\Expense;
|
use App\Models\Expense;
|
||||||
use App\Models\Invoice;
|
use App\Models\Invoice;
|
||||||
@ -26,6 +27,7 @@ use App\Models\Task;
|
|||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use App\Observers\AccountObserver;
|
use App\Observers\AccountObserver;
|
||||||
use App\Observers\ClientObserver;
|
use App\Observers\ClientObserver;
|
||||||
|
use App\Observers\CompanyGatewayObserver;
|
||||||
use App\Observers\CompanyObserver;
|
use App\Observers\CompanyObserver;
|
||||||
use App\Observers\CompanyTokenObserver;
|
use App\Observers\CompanyTokenObserver;
|
||||||
use App\Observers\ExpenseObserver;
|
use App\Observers\ExpenseObserver;
|
||||||
@ -68,6 +70,7 @@ class AppServiceProvider extends ServiceProvider
|
|||||||
Account::observe(AccountObserver::class);
|
Account::observe(AccountObserver::class);
|
||||||
Client::observe(ClientObserver::class);
|
Client::observe(ClientObserver::class);
|
||||||
Company::observe(CompanyObserver::class);
|
Company::observe(CompanyObserver::class);
|
||||||
|
CompanyGateway::observe(CompanyGatewayObserver::class);
|
||||||
CompanyToken::observe(CompanyTokenObserver::class);
|
CompanyToken::observe(CompanyTokenObserver::class);
|
||||||
Expense::observe(ExpenseObserver::class);
|
Expense::observe(ExpenseObserver::class);
|
||||||
Invoice::observe(InvoiceObserver::class);
|
Invoice::observe(InvoiceObserver::class);
|
||||||
|
@ -122,8 +122,8 @@ class HtmlEngine
|
|||||||
$data['$number'] = ['value' => $this->entity->number ?: ' ', 'label' => ctrans('texts.invoice_number')];
|
$data['$number'] = ['value' => $this->entity->number ?: ' ', 'label' => ctrans('texts.invoice_number')];
|
||||||
$data['$entity.terms'] = ['value' => $this->entity->terms ?: ' ', 'label' => ctrans('texts.invoice_terms')];
|
$data['$entity.terms'] = ['value' => $this->entity->terms ?: ' ', 'label' => ctrans('texts.invoice_terms')];
|
||||||
$data['$terms'] = &$data['$entity.terms'];
|
$data['$terms'] = &$data['$entity.terms'];
|
||||||
// $data['$view_link'] = ['value' => '<a href="' .$this->invitation->getLink() .'">'. ctrans('texts.view_invoice').'</a>', 'label' => ctrans('texts.view_invoice')];
|
$data['$view_link'] = ['value' => '<a href="' .$this->invitation->getLink() .'">'. ctrans('texts.view_invoice').'</a>', 'label' => ctrans('texts.view_invoice')];
|
||||||
$data['$view_link'] = ['value' => $this->invitation->getLink(), 'label' => ctrans('texts.view_invoice')];
|
// $data['$view_link'] = ['value' => $this->invitation->getLink(), 'label' => ctrans('texts.view_invoice')];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -132,8 +132,8 @@ class HtmlEngine
|
|||||||
$data['$number'] = ['value' => $this->entity->number ?: ' ', 'label' => ctrans('texts.quote_number')];
|
$data['$number'] = ['value' => $this->entity->number ?: ' ', 'label' => ctrans('texts.quote_number')];
|
||||||
$data['$entity.terms'] = ['value' => $this->entity->terms ?: ' ', 'label' => ctrans('texts.quote_terms')];
|
$data['$entity.terms'] = ['value' => $this->entity->terms ?: ' ', 'label' => ctrans('texts.quote_terms')];
|
||||||
$data['$terms'] = &$data['$entity.terms'];
|
$data['$terms'] = &$data['$entity.terms'];
|
||||||
// $data['$view_link'] = ['value' => '<a href="' .$this->invitation->getLink() .'">'. ctrans('texts.view_quote').'</a>', 'label' => ctrans('texts.view_quote')];
|
$data['$view_link'] = ['value' => '<a href="' .$this->invitation->getLink() .'">'. ctrans('texts.view_quote').'</a>', 'label' => ctrans('texts.view_quote')];
|
||||||
$data['$view_link'] = ['value' => $this->invitation->getLink(), 'label' => ctrans('texts.view_quote')];
|
// $data['$view_link'] = ['value' => $this->invitation->getLink(), 'label' => ctrans('texts.view_quote')];
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->entity_string == 'credit') {
|
if ($this->entity_string == 'credit') {
|
||||||
@ -141,8 +141,8 @@ class HtmlEngine
|
|||||||
$data['$number'] = ['value' => $this->entity->number ?: ' ', 'label' => ctrans('texts.credit_number')];
|
$data['$number'] = ['value' => $this->entity->number ?: ' ', 'label' => ctrans('texts.credit_number')];
|
||||||
$data['$entity.terms'] = ['value' => $this->entity->terms ?: ' ', 'label' => ctrans('texts.credit_terms')];
|
$data['$entity.terms'] = ['value' => $this->entity->terms ?: ' ', 'label' => ctrans('texts.credit_terms')];
|
||||||
$data['$terms'] = &$data['$entity.terms'];
|
$data['$terms'] = &$data['$entity.terms'];
|
||||||
// $data['$view_link'] = ['value' => '<a href="' .$this->invitation->getLink() .'">'. ctrans('texts.view_credit').'</a>', 'label' => ctrans('texts.view_credit')];
|
$data['$view_link'] = ['value' => '<a href="' .$this->invitation->getLink() .'">'. ctrans('texts.view_credit').'</a>', 'label' => ctrans('texts.view_credit')];
|
||||||
$data['$view_link'] = ['value' => $this->invitation->getLink(), 'label' => ctrans('texts.view_credit')];
|
// $data['$view_link'] = ['value' => $this->invitation->getLink(), 'label' => ctrans('texts.view_credit')];
|
||||||
}
|
}
|
||||||
|
|
||||||
$data['$entity_number'] = &$data['$number'];
|
$data['$entity_number'] = &$data['$number'];
|
||||||
|
@ -215,8 +215,8 @@ trait MakesInvoiceValues
|
|||||||
$data['$number'] = ['value' => $this->number ?: ' ', 'label' => ctrans('texts.invoice_number')];
|
$data['$number'] = ['value' => $this->number ?: ' ', 'label' => ctrans('texts.invoice_number')];
|
||||||
$data['$entity.terms'] = ['value' => $this->terms ?: ' ', 'label' => ctrans('texts.invoice_terms')];
|
$data['$entity.terms'] = ['value' => $this->terms ?: ' ', 'label' => ctrans('texts.invoice_terms')];
|
||||||
$data['$terms'] = &$data['$entity.terms'];
|
$data['$terms'] = &$data['$entity.terms'];
|
||||||
//$data['$view_link'] = ['value' => '<a href="' .$invitation->getLink() .'">'. ctrans('texts.view_invoice').'</a>', 'label' => ctrans('texts.view_invoice')];
|
$data['$view_link'] = ['value' => '<a href="' .$invitation->getLink() .'">'. ctrans('texts.view_invoice').'</a>', 'label' => ctrans('texts.view_invoice')];
|
||||||
$data['$view_link'] = ['value' => $invitation->getLink(), 'label' => ctrans('texts.view_invoice')];
|
// $data['$view_link'] = ['value' => $invitation->getLink(), 'label' => ctrans('texts.view_invoice')];
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this instanceof Quote) {
|
if ($this instanceof Quote) {
|
||||||
@ -224,8 +224,8 @@ trait MakesInvoiceValues
|
|||||||
$data['$number'] = ['value' => $this->number ?: ' ', 'label' => ctrans('texts.quote_number')];
|
$data['$number'] = ['value' => $this->number ?: ' ', 'label' => ctrans('texts.quote_number')];
|
||||||
$data['$entity.terms'] = ['value' => $this->terms ?: ' ', 'label' => ctrans('texts.quote_terms')];
|
$data['$entity.terms'] = ['value' => $this->terms ?: ' ', 'label' => ctrans('texts.quote_terms')];
|
||||||
$data['$terms'] = &$data['$entity.terms'];
|
$data['$terms'] = &$data['$entity.terms'];
|
||||||
// $data['$view_link'] = ['value' => '<a href="' .$invitation->getLink() .'">'. ctrans('texts.view_quote').'</a>', 'label' => ctrans('texts.view_quote')];
|
$data['$view_link'] = ['value' => '<a href="' .$invitation->getLink() .'">'. ctrans('texts.view_quote').'</a>', 'label' => ctrans('texts.view_quote')];
|
||||||
$data['$view_link'] = ['value' => $invitation->getLink(), 'label' => ctrans('texts.view_quote')];
|
// $data['$view_link'] = ['value' => $invitation->getLink(), 'label' => ctrans('texts.view_quote')];
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this instanceof Credit) {
|
if ($this instanceof Credit) {
|
||||||
@ -233,8 +233,8 @@ trait MakesInvoiceValues
|
|||||||
$data['$number'] = ['value' => $this->number ?: ' ', 'label' => ctrans('texts.credit_number')];
|
$data['$number'] = ['value' => $this->number ?: ' ', 'label' => ctrans('texts.credit_number')];
|
||||||
$data['$entity.terms'] = ['value' => $this->terms ?: ' ', 'label' => ctrans('texts.credit_terms')];
|
$data['$entity.terms'] = ['value' => $this->terms ?: ' ', 'label' => ctrans('texts.credit_terms')];
|
||||||
$data['$terms'] = &$data['$entity.terms'];
|
$data['$terms'] = &$data['$entity.terms'];
|
||||||
// $data['$view_link'] = ['value' => '<a href="' .$invitation->getLink() .'">'. ctrans('texts.view_credit').'</a>', 'label' => ctrans('texts.view_credit')];
|
$data['$view_link'] = ['value' => '<a href="' .$invitation->getLink() .'">'. ctrans('texts.view_credit').'</a>', 'label' => ctrans('texts.view_credit')];
|
||||||
$data['$view_link'] = ['value' => $invitation->getLink(), 'label' => ctrans('texts.view_credit')];
|
// $data['$view_link'] = ['value' => $invitation->getLink(), 'label' => ctrans('texts.view_credit')];
|
||||||
}
|
}
|
||||||
|
|
||||||
$data['$entity_number'] = &$data['$number'];
|
$data['$entity_number'] = &$data['$number'];
|
||||||
|
@ -24,7 +24,13 @@ class AddIsPublicToDocumentsTable extends Migration
|
|||||||
|
|
||||||
Schema::table('company_gateways', function (Blueprint $table) {
|
Schema::table('company_gateways', function (Blueprint $table) {
|
||||||
$table->enum('token_billing', ['off', 'always','optin','optout'])->default('off');
|
$table->enum('token_billing', ['off', 'always','optin','optout'])->default('off');
|
||||||
|
$table->string('label', 255)->nullable();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Schema::table('payments', function (Blueprint $table) {
|
||||||
|
$table->text('meta')->nullable();
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
256
package-lock.json
generated
256
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user