mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-08 14:14:31 -04:00
commit
e2310ac12c
@ -1 +1 @@
|
|||||||
5.3.76
|
5.3.77
|
@ -180,7 +180,7 @@ class EmailTemplateDefaults
|
|||||||
|
|
||||||
public static function emailReminder1Subject()
|
public static function emailReminder1Subject()
|
||||||
{
|
{
|
||||||
return ctrans('texts.reminder_subject', ['invoice'=>'$invoice.number', 'account'=>'$company.name']);
|
return ctrans('texts.reminder_subject', ['invoice'=>'$number', 'account'=>'$company.name']);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function emailReminder1Template()
|
public static function emailReminder1Template()
|
||||||
@ -190,7 +190,7 @@ class EmailTemplateDefaults
|
|||||||
|
|
||||||
public static function emailReminder2Subject()
|
public static function emailReminder2Subject()
|
||||||
{
|
{
|
||||||
return ctrans('texts.reminder_subject', ['invoice'=>'$invoice.number', 'account'=>'$company.name']);
|
return ctrans('texts.reminder_subject', ['invoice'=>'$number', 'account'=>'$company.name']);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function emailReminder2Template()
|
public static function emailReminder2Template()
|
||||||
@ -200,7 +200,7 @@ class EmailTemplateDefaults
|
|||||||
|
|
||||||
public static function emailReminder3Subject()
|
public static function emailReminder3Subject()
|
||||||
{
|
{
|
||||||
return ctrans('texts.reminder_subject', ['invoice'=>'$invoice.number', 'account'=>'$company.name']);
|
return ctrans('texts.reminder_subject', ['invoice'=>'$number', 'account'=>'$company.name']);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function emailReminder3Template()
|
public static function emailReminder3Template()
|
||||||
@ -210,7 +210,7 @@ class EmailTemplateDefaults
|
|||||||
|
|
||||||
public static function emailReminderEndlessSubject()
|
public static function emailReminderEndlessSubject()
|
||||||
{
|
{
|
||||||
return ctrans('texts.reminder_subject', ['invoice'=>'$invoice.number', 'account'=>'$company.name']);
|
return ctrans('texts.reminder_subject', ['invoice'=>'$number', 'account'=>'$company.name']);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function emailReminderEndlessTemplate()
|
public static function emailReminderEndlessTemplate()
|
||||||
|
@ -124,7 +124,7 @@ class Handler extends ExceptionHandler
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if ($this->validException($exception)) {
|
if ($this->validException($exception) && auth()->guard('contact')->user()->company->account->report_errors) {
|
||||||
app('sentry')->captureException($exception);
|
app('sentry')->captureException($exception);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -623,8 +623,8 @@ class BaseController extends Controller
|
|||||||
$query->with($includes);
|
$query->with($includes);
|
||||||
|
|
||||||
// 10-01-2022 need to ensure we snake case properly here to ensure permissions work as expected
|
// 10-01-2022 need to ensure we snake case properly here to ensure permissions work as expected
|
||||||
// if (auth()->user() && ! auth()->user()->hasPermission('view_'.lcfirst(class_basename($this->entity_type)))) {
|
// 28-03-2022 this is definitely correct here, do not append _ to the view, it resolved correctly when snake cased
|
||||||
if (auth()->user() && ! auth()->user()->hasPermission('view_'.lcfirst(class_basename(Str::snake($this->entity_type))))) {
|
if (auth()->user() && ! auth()->user()->hasPermission('view'.lcfirst(class_basename(Str::snake($this->entity_type))))) {
|
||||||
$query->where('user_id', '=', auth()->user()->id);
|
$query->where('user_id', '=', auth()->user()->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -198,7 +198,7 @@ class NinjaPlanController extends Controller
|
|||||||
if($account)
|
if($account)
|
||||||
{
|
{
|
||||||
//offer the option to have a free trial
|
//offer the option to have a free trial
|
||||||
if(!$account->trial_started)
|
if(!$account->trial_started && !$account->plan)
|
||||||
return $this->trial();
|
return $this->trial();
|
||||||
|
|
||||||
if(Carbon::parse($account->plan_expires)->lt(now())){
|
if(Carbon::parse($account->plan_expires)->lt(now())){
|
||||||
|
@ -100,9 +100,10 @@ class SelfUpdateController extends BaseController
|
|||||||
|
|
||||||
$this->testWritable();
|
$this->testWritable();
|
||||||
|
|
||||||
$contents = file_get_contents($this->getDownloadUrl());
|
copy($this->getDownloadUrl(), storage_path('app/invoiceninja.zip'));
|
||||||
|
|
||||||
Storage::disk('local')->put('invoiceninja.zip', $contents);
|
// $contents = file_get_contents($this->getDownloadUrl());
|
||||||
|
// Storage::disk('local')->put('invoiceninja.zip', $contents);
|
||||||
|
|
||||||
$file = Storage::disk('local')->path('invoiceninja.zip');
|
$file = Storage::disk('local')->path('invoiceninja.zip');
|
||||||
|
|
||||||
|
@ -42,6 +42,7 @@ class QueryLogging
|
|||||||
$timeStart = microtime(true);
|
$timeStart = microtime(true);
|
||||||
DB::enableQueryLog();
|
DB::enableQueryLog();
|
||||||
|
|
||||||
|
$response = $next($request);
|
||||||
// hide requests made by debugbar
|
// hide requests made by debugbar
|
||||||
if (strstr($request->url(), '_debugbar') === false) {
|
if (strstr($request->url(), '_debugbar') === false) {
|
||||||
|
|
||||||
@ -71,7 +72,6 @@ class QueryLogging
|
|||||||
->queue();
|
->queue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return $response;
|
||||||
return $next($request);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@ class CreatePaymentMethodRequest extends FormRequest
|
|||||||
public function authorize(): bool
|
public function authorize(): bool
|
||||||
{
|
{
|
||||||
/** @var Client $client */
|
/** @var Client $client */
|
||||||
$client = auth()->('guard')->user()->client;
|
$client = auth()->guard('contact')->user()->client;
|
||||||
|
|
||||||
$available_methods = [];
|
$available_methods = [];
|
||||||
|
|
||||||
|
@ -383,8 +383,11 @@ class RecurringInvoice extends BaseModel
|
|||||||
case self::FREQUENCY_TWO_YEARS:
|
case self::FREQUENCY_TWO_YEARS:
|
||||||
return ctrans('texts.freq_two_years');
|
return ctrans('texts.freq_two_years');
|
||||||
break;
|
break;
|
||||||
|
case self::FREQUENCY_THREE_YEARS:
|
||||||
|
return ctrans('texts.freq_three_years');
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
// code...
|
return '';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@ class QuoteObserver
|
|||||||
|
|
||||||
if ($subscriptions) {
|
if ($subscriptions) {
|
||||||
$quote->load('client');
|
$quote->load('client');
|
||||||
WebhookHandler::dispatch(Webhook::EVENT_CREATE_QUOTE, $quote, $quote->company);
|
WebhookHandler::dispatch(Webhook::EVENT_CREATE_QUOTE, $quote, $quote->company, 'client');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,7 +53,7 @@ class QuoteObserver
|
|||||||
|
|
||||||
if ($subscriptions) {
|
if ($subscriptions) {
|
||||||
$quote->load('client');
|
$quote->load('client');
|
||||||
WebhookHandler::dispatch(Webhook::EVENT_UPDATE_QUOTE, $quote, $quote->company);
|
WebhookHandler::dispatch(Webhook::EVENT_UPDATE_QUOTE, $quote, $quote->company, 'client');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -72,7 +72,7 @@ class QuoteObserver
|
|||||||
|
|
||||||
if ($subscriptions) {
|
if ($subscriptions) {
|
||||||
$quote->load('client');
|
$quote->load('client');
|
||||||
WebhookHandler::dispatch(Webhook::EVENT_DELETE_QUOTE, $quote, $quote->company);
|
WebhookHandler::dispatch(Webhook::EVENT_DELETE_QUOTE, $quote, $quote->company, 'client');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -322,8 +322,6 @@ class BaseDriver extends AbstractPaymentDriver
|
|||||||
|
|
||||||
if (collect($invoice->line_items)->contains('type_id', '3')) {
|
if (collect($invoice->line_items)->contains('type_id', '3')) {
|
||||||
$invoice->service()->toggleFeesPaid()->save();
|
$invoice->service()->toggleFeesPaid()->save();
|
||||||
// $invoice->client->service()->updateBalance($fee_total)->save();
|
|
||||||
// $invoice->ledger()->updateInvoiceBalance($fee_total, "Gateway fee adjustment for invoice {$invoice->number}");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$transaction = [
|
$transaction = [
|
||||||
|
@ -28,21 +28,21 @@ class ClientService
|
|||||||
|
|
||||||
public function updateBalance(float $amount)
|
public function updateBalance(float $amount)
|
||||||
{
|
{
|
||||||
$this->client->increment('balance', $amount);
|
$this->client->balance += $amount;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function updatePaidToDate(float $amount)
|
public function updatePaidToDate(float $amount)
|
||||||
{
|
{
|
||||||
$this->client->increment('paid_to_date', $amount);
|
$this->client->paid_to_date += $amount;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function adjustCreditBalance(float $amount)
|
public function adjustCreditBalance(float $amount)
|
||||||
{
|
{
|
||||||
$this->client->increment('credit_balance', $amount);
|
$this->client->credit_balance += $amount;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
@ -167,25 +167,22 @@ class CreditService
|
|||||||
|
|
||||||
public function adjustBalance($adjustment)
|
public function adjustBalance($adjustment)
|
||||||
{
|
{
|
||||||
// $this->credit->balance += $adjustment;
|
$this->credit->balance += $adjustment;
|
||||||
$this->credit->increment('balance', $adjustment);
|
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function updatePaidToDate($adjustment)
|
public function updatePaidToDate($adjustment)
|
||||||
{
|
{
|
||||||
// $this->credit->paid_to_date += $adjustment;
|
$this->credit->paid_to_date += $adjustment;
|
||||||
$this->credit->increment('paid_to_date', $adjustment);
|
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function updateBalance($adjustment)
|
public function updateBalance($adjustment)
|
||||||
{
|
{
|
||||||
// $this->credit->balance -= $adjustment;
|
$this->credit->balance -= $adjustment;
|
||||||
$this->credit->decrement('balance', $adjustment);
|
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -403,8 +403,7 @@ class InvoiceService
|
|||||||
/*Update the partial amount of a invoice*/
|
/*Update the partial amount of a invoice*/
|
||||||
public function updatePartial($amount)
|
public function updatePartial($amount)
|
||||||
{
|
{
|
||||||
// $this->invoice->partial += $amount;
|
$this->invoice->partial += $amount;
|
||||||
$this->invoice->increment('partial', $amount);
|
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
@ -535,7 +534,7 @@ class InvoiceService
|
|||||||
/* Throws: Payment amount xxx does not match invoice totals. */
|
/* Throws: Payment amount xxx does not match invoice totals. */
|
||||||
|
|
||||||
if ($this->invoice->trashed())
|
if ($this->invoice->trashed())
|
||||||
return;
|
return $this;
|
||||||
|
|
||||||
$this->invoice->delete();
|
$this->invoice->delete();
|
||||||
|
|
||||||
|
@ -40,19 +40,20 @@ class UpdateInvoicePayment
|
|||||||
$paid_invoices = $this->payment_hash->invoices();
|
$paid_invoices = $this->payment_hash->invoices();
|
||||||
|
|
||||||
$invoices = Invoice::whereIn('id', $this->transformKeys(array_column($paid_invoices, 'invoice_id')))->withTrashed()->get();
|
$invoices = Invoice::whereIn('id', $this->transformKeys(array_column($paid_invoices, 'invoice_id')))->withTrashed()->get();
|
||||||
|
|
||||||
|
$client = $this->payment->client;
|
||||||
|
|
||||||
collect($paid_invoices)->each(function ($paid_invoice) use ($invoices) {
|
if($client->trashed())
|
||||||
|
$client->restore();
|
||||||
|
|
||||||
$client = $this->payment->client;
|
collect($paid_invoices)->each(function ($paid_invoice) use ($invoices, $client) {
|
||||||
|
|
||||||
if($client->trashed())
|
$client = $client->fresh();
|
||||||
$client->restore();
|
|
||||||
|
|
||||||
$invoice = $invoices->first(function ($inv) use ($paid_invoice) {
|
$invoice = $invoices->first(function ($inv) use ($paid_invoice) {
|
||||||
return $paid_invoice->invoice_id == $inv->hashed_id;
|
return $paid_invoice->invoice_id == $inv->hashed_id;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
if($invoice->trashed())
|
if($invoice->trashed())
|
||||||
$invoice->restore();
|
$invoice->restore();
|
||||||
|
|
||||||
@ -62,23 +63,23 @@ class UpdateInvoicePayment
|
|||||||
$paid_amount = $paid_invoice->amount;
|
$paid_amount = $paid_invoice->amount;
|
||||||
}
|
}
|
||||||
|
|
||||||
$client
|
$client->paid_to_date += $paid_amount;
|
||||||
->service()
|
$client->balance -= $paid_amount;
|
||||||
->updatePaidToDate($paid_amount)
|
$client->save();
|
||||||
->save();
|
|
||||||
|
|
||||||
/* Need to determine here is we have an OVER payment - if YES only apply the max invoice amount */
|
/* Need to determine here is we have an OVER payment - if YES only apply the max invoice amount */
|
||||||
if($paid_amount > $invoice->partial && $paid_amount > $invoice->balance)
|
if($paid_amount > $invoice->partial && $paid_amount > $invoice->balance)
|
||||||
$paid_amount = $invoice->balance;
|
$paid_amount = $invoice->balance;
|
||||||
|
|
||||||
/*Improve performance here - 26-01-2022 - also change the order of events for invoice first*/
|
/*Improve performance here - 26-01-2022 - also change the order of events for invoice first*/
|
||||||
$invoice->service() //caution what if we amount paid was less than partial - we wipe it!
|
//caution what if we amount paid was less than partial - we wipe it!
|
||||||
->clearPartial()
|
$invoice = $invoice->service()
|
||||||
->updateBalance($paid_amount * -1)
|
->clearPartial()
|
||||||
->updatePaidToDate($paid_amount)
|
->updateBalance($paid_amount * -1)
|
||||||
->updateStatus()
|
->updatePaidToDate($paid_amount)
|
||||||
->touchPdf()
|
->updateStatus()
|
||||||
->save();
|
->touchPdf()
|
||||||
|
->save();
|
||||||
|
|
||||||
$invoice->service()
|
$invoice->service()
|
||||||
->workFlow()
|
->workFlow()
|
||||||
@ -89,11 +90,6 @@ class UpdateInvoicePayment
|
|||||||
->ledger()
|
->ledger()
|
||||||
->updatePaymentBalance($paid_amount * -1);
|
->updatePaymentBalance($paid_amount * -1);
|
||||||
|
|
||||||
$client
|
|
||||||
->service()
|
|
||||||
->updateBalance($paid_amount * -1)
|
|
||||||
->save();
|
|
||||||
|
|
||||||
$pivot_invoice = $this->payment->invoices->first(function ($inv) use ($paid_invoice) {
|
$pivot_invoice = $this->payment->invoices->first(function ($inv) use ($paid_invoice) {
|
||||||
return $inv->hashed_id == $paid_invoice->invoice_id;
|
return $inv->hashed_id == $paid_invoice->invoice_id;
|
||||||
});
|
});
|
||||||
|
@ -29,6 +29,10 @@ trait CompanyGatewayFeesAndLimitsSaver
|
|||||||
|
|
||||||
foreach ($casts as $key => $value) {
|
foreach ($casts as $key => $value) {
|
||||||
|
|
||||||
|
if($value == 'float' && property_exists($fee_and_limit, $key)){
|
||||||
|
$fee_and_limit->{$key} = floatval($fee_and_limit->{$key});
|
||||||
|
}
|
||||||
|
|
||||||
/* Handles unset settings or blank strings */
|
/* Handles unset settings or blank strings */
|
||||||
if (! property_exists($fee_and_limit, $key) || is_null($fee_and_limit->{$key}) || ! isset($fee_and_limit->{$key}) || $fee_and_limit->{$key} == '') {
|
if (! property_exists($fee_and_limit, $key) || is_null($fee_and_limit->{$key}) || ! isset($fee_and_limit->{$key}) || $fee_and_limit->{$key} == '') {
|
||||||
continue;
|
continue;
|
||||||
|
@ -35,6 +35,12 @@ trait SettingsSaver
|
|||||||
ksort($casts);
|
ksort($casts);
|
||||||
|
|
||||||
foreach ($casts as $key => $value) {
|
foreach ($casts as $key => $value) {
|
||||||
|
|
||||||
|
//try casting floats here
|
||||||
|
if($value == 'float' && property_exists($settings, $key)){
|
||||||
|
$settings->{$key} = floatval($settings->{$key});
|
||||||
|
}
|
||||||
|
|
||||||
if (in_array($key, CompanySettings::$string_casts)) {
|
if (in_array($key, CompanySettings::$string_casts)) {
|
||||||
$value = 'string';
|
$value = 'string';
|
||||||
if (! property_exists($settings, $key)) {
|
if (! property_exists($settings, $key)) {
|
||||||
|
@ -14,8 +14,8 @@ return [
|
|||||||
'require_https' => env('REQUIRE_HTTPS', true),
|
'require_https' => env('REQUIRE_HTTPS', true),
|
||||||
'app_url' => rtrim(env('APP_URL', ''), '/'),
|
'app_url' => rtrim(env('APP_URL', ''), '/'),
|
||||||
'app_domain' => env('APP_DOMAIN', 'invoicing.co'),
|
'app_domain' => env('APP_DOMAIN', 'invoicing.co'),
|
||||||
'app_version' => '5.3.76',
|
'app_version' => '5.3.77',
|
||||||
'app_tag' => '5.3.76',
|
'app_tag' => '5.3.77',
|
||||||
'minimum_client_version' => '5.0.16',
|
'minimum_client_version' => '5.0.16',
|
||||||
'terms_version' => '1.0.1',
|
'terms_version' => '1.0.1',
|
||||||
'api_secret' => env('API_SECRET', ''),
|
'api_secret' => env('API_SECRET', ''),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user