mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Merge pull request #5308 from turbo124/v5-develop
if/else blocks for flutter canvas build
This commit is contained in:
commit
7cb4806a65
1
.gitignore
vendored
1
.gitignore
vendored
@ -29,3 +29,4 @@ nbproject
|
||||
.php_cs.cache
|
||||
public/test.pdf
|
||||
public/storage/test.pdf
|
||||
/Modules
|
@ -139,6 +139,8 @@ class CompanySettings extends BaseSettings
|
||||
public $payment_type_id = '0'; //@TODO where do we use this?
|
||||
// public $invoice_fields = ''; //@TODO is this redundant, we store this in the custom_fields on the company?
|
||||
|
||||
public $valid_until = ''; //@implemented
|
||||
|
||||
public $show_accept_invoice_terms = false; //@TODO ben to confirm
|
||||
public $show_accept_quote_terms = false; //@TODO ben to confirm
|
||||
public $require_invoice_signature = false; //@TODO ben to confirm
|
||||
@ -430,6 +432,7 @@ class CompanySettings extends BaseSettings
|
||||
'show_accept_quote_terms' => 'bool',
|
||||
'show_accept_invoice_terms' => 'bool',
|
||||
'timezone_id' => 'string',
|
||||
'valid_until' => 'string',
|
||||
'date_format_id' => 'string',
|
||||
'military_time' => 'bool',
|
||||
'language_id' => 'string',
|
||||
|
@ -124,7 +124,7 @@ class EntityFailedSendObject
|
||||
$settings = $this->entity->client->getMergedSettings();
|
||||
$signature = $settings->email_signature;
|
||||
|
||||
$html_variables = (new HtmlEngine($this->invitation)->makeValues();
|
||||
$html_variables = (new HtmlEngine($this->invitation))->makeValues();
|
||||
$signature = str_replace(array_keys($html_variables), array_values($html_variables), $signature);
|
||||
|
||||
return [
|
||||
|
@ -14,6 +14,7 @@ namespace App\Services\Quote;
|
||||
use App\Events\Quote\QuoteWasMarkedSent;
|
||||
use App\Models\Quote;
|
||||
use App\Utils\Ninja;
|
||||
use Carbon\Carbon;
|
||||
|
||||
class MarkSent
|
||||
{
|
||||
@ -37,6 +38,13 @@ class MarkSent
|
||||
|
||||
$this->quote->markInvitationsSent();
|
||||
|
||||
if ($this->quote->due_date != '' || $this->quote->client->getSetting('valid_until') == '') {
|
||||
|
||||
}
|
||||
else{
|
||||
$this->quote->due_date = Carbon::parse($this->quote->date)->addDays($this->quote->client->getSetting('valid_until'));
|
||||
}
|
||||
|
||||
event(new QuoteWasMarkedSent($this->quote, $this->quote->company, Ninja::eventVars()));
|
||||
|
||||
$this->quote
|
||||
|
@ -55,9 +55,40 @@ class SubscriptionService
|
||||
}
|
||||
|
||||
// if we have a recurring product - then generate a recurring invoice
|
||||
// if trial is enabled, generate the recurring invoice to fire when the trial ends.
|
||||
if(strlen($this->subscription->recurring_product_ids) >=1){
|
||||
|
||||
$recurring_invoice = $this->convertInvoiceToRecurring($payment_hash->payment->client_id);
|
||||
$recurring_invoice_repo = new RecurringInvoiceRepository();
|
||||
|
||||
$recurring_invoice->next_send_date = now();
|
||||
$recurring_invoice = $recurring_invoice_repo->save([], $recurring_invoice);
|
||||
$recurring_invoice->next_send_date = $recurring_invoice->nextSendDate();
|
||||
|
||||
/* Start the recurring service */
|
||||
$recurring_invoice->service()
|
||||
->start()
|
||||
->save();
|
||||
|
||||
//execute any webhooks
|
||||
$this->triggerWebhook();
|
||||
|
||||
if(array_key_exists('post_purchase_url', $this->subscription->webhook_configuration) && strlen($this->subscription->webhook_configuration['post_purchase_url']) >=1)
|
||||
return redirect($this->subscription->webhook_configuration['post_purchase_url']);
|
||||
|
||||
return redirect('/client/recurring_invoices/'.$recurring_invoice->hashed_id);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
//execute any webhooks
|
||||
$this->triggerWebhook();
|
||||
|
||||
if(array_key_exists('post_purchase_url', $this->subscription->webhook_configuration) && strlen($this->subscription->webhook_configuration['post_purchase_url']) >=1)
|
||||
return redirect($this->subscription->webhook_configuration['post_purchase_url']);
|
||||
|
||||
return redirect('/client/invoices/'.$this->encodePrimaryKey($payment_hash->fee_invoice_id));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -75,16 +106,9 @@ class SubscriptionService
|
||||
|
||||
//create recurring invoice with start date = trial_duration + 1 day
|
||||
$recurring_invoice_repo = new RecurringInvoiceRepository();
|
||||
$subscription_repo = new SubscriptionRepository();
|
||||
|
||||
$recurring_invoice = RecurringInvoiceFactory::create($this->subscription->company_id, $this->subscription->user_id);
|
||||
$recurring_invoice->client_id = $client_contact->client_id;
|
||||
$recurring_invoice->line_items = $subscription_repo->generateLineItems($this->subscription, true);
|
||||
$recurring_invoice->subscription_id = $this->subscription->id;
|
||||
$recurring_invoice->frequency_id = $this->subscription->frequency_id ?: RecurringInvoice::FREQUENCY_MONTHLY;
|
||||
$recurring_invoice->date = now();
|
||||
$recurring_invoice = $this->convertInvoiceToRecurring($client_contact->client_id);
|
||||
$recurring_invoice->next_send_date = now()->addSeconds($this->subscription->trial_duration);
|
||||
$recurring_invoice->remaining_cycles = -1;
|
||||
$recurring_invoice->backup = 'is_trial';
|
||||
|
||||
if(array_key_exists('coupon', $data) && ($data['coupon'] == $this->subscription->promo_code) && $this->subscription->promo_discount > 0)
|
||||
@ -109,6 +133,7 @@ class SubscriptionService
|
||||
return redirect('/client/recurring_invoices/'.$recurring_invoice->hashed_id);
|
||||
}
|
||||
|
||||
|
||||
public function createInvoice($data): ?\App\Models\Invoice
|
||||
{
|
||||
|
||||
@ -130,16 +155,20 @@ class SubscriptionService
|
||||
}
|
||||
|
||||
|
||||
private function convertInvoiceToRecurring($payment_hash)
|
||||
private function convertInvoiceToRecurring($client_id)
|
||||
{
|
||||
//The first invoice is a plain invoice - the second is fired on the recurring schedule.
|
||||
$invoice = Invoice::find($payment_hash->billing_context->invoice_id);
|
||||
|
||||
if(!$invoice)
|
||||
throw new \Exception("Could not match an invoice for payment of billing subscription");
|
||||
|
||||
return InvoiceToRecurringInvoiceFactory::create($invoice);
|
||||
|
||||
|
||||
$subscription_repo = new SubscriptionRepository();
|
||||
|
||||
$recurring_invoice = RecurringInvoiceFactory::create($this->subscription->company_id, $this->subscription->user_id);
|
||||
$recurring_invoice->client_id = $client_id;
|
||||
$recurring_invoice->line_items = $subscription_repo->generateLineItems($this->subscription, true);
|
||||
$recurring_invoice->subscription_id = $this->subscription->id;
|
||||
$recurring_invoice->frequency_id = $this->subscription->frequency_id ?: RecurringInvoice::FREQUENCY_MONTHLY;
|
||||
$recurring_invoice->date = now();
|
||||
$recurring_invoice->remaining_cycles = -1;
|
||||
|
||||
return $recurring_invoice;
|
||||
}
|
||||
|
||||
// @deprecated due to change in architecture
|
||||
|
@ -89,7 +89,8 @@
|
||||
"psr-4": {
|
||||
"App\\": "app/",
|
||||
"Database\\Factories\\": "database/factories/",
|
||||
"Database\\Seeders\\": "database/seeders/"
|
||||
"Database\\Seeders\\": "database/seeders/",
|
||||
"Modules\\": "Modules/"
|
||||
},
|
||||
"files": [
|
||||
]
|
||||
|
401
composer.lock
generated
401
composer.lock
generated
File diff suppressed because it is too large
Load Diff
@ -3,6 +3,7 @@
|
||||
return [
|
||||
|
||||
'web_url' => 'https://www.invoiceninja.com',
|
||||
'admin_token' => env('NINJA_ADMIN_TOKEN', ''),
|
||||
'license_url' => 'https://app.invoiceninja.com',
|
||||
'production' => env('NINJA_PROD', false),
|
||||
'license' => env('NINJA_LICENSE', ''),
|
||||
@ -140,8 +141,8 @@ return [
|
||||
'log_pdf_html' => env('LOG_PDF_HTML', false),
|
||||
'expanded_logging' => env('EXPANDED_LOGGING', false),
|
||||
'snappdf_chromium_path' => env('SNAPPDF_CHROMIUM_PATH', false),
|
||||
'v4_migration_version' => '4.5.31',
|
||||
'flutter_canvas_kit' => env('FLUTTER_CANVAS_KIT', false),
|
||||
'v4_migration_version' => '4.5.35',
|
||||
'flutter_canvas_kit' => env('FLUTTER_CANVAS_KIT', 'selfhosted-html'),
|
||||
'webcron_secret' => env('WEBCRON_SECRET', false),
|
||||
'disable_auto_update' => env('DISABLE_AUTO_UPDATE', false),
|
||||
'invoiceninja_hosted_pdf_generation' => env('NINJA_HOSTED_PDF', false),
|
||||
|
3
modules_statuses.json
Normal file
3
modules_statuses.json
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"Admin": true
|
||||
}
|
@ -146,7 +146,13 @@
|
||||
|
||||
</script>
|
||||
|
||||
<script defer src="main.dart.js?v={{ config('ninja.app_version') }}" type="application/javascript"></script>
|
||||
@if(config('ninja.flutter_canvas_kit') == 'hosted')
|
||||
<script defer src="main.dart.js?v={{ config('ninja.app_version') }}" type="application/javascript"></script>
|
||||
@elseif(config('ninja.flutter_canvas_kit') == 'selfhosted-canvaskit')
|
||||
<script defer src="main.wasm.dart.js?v={{ config('ninja.app_version') }}" type="application/javascript"></script>
|
||||
@else
|
||||
<script defer src="main.foss.dart.js?v={{ config('ninja.app_version') }}" type="application/javascript"></script>
|
||||
@endif
|
||||
|
||||
<center style="padding-top: 150px" id="loader">
|
||||
<div class="loader"></div>
|
||||
|
Loading…
x
Reference in New Issue
Block a user