mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-11 21:52:35 +01:00
commit
e2310ac12c
@ -1 +1 @@
|
||||
5.3.76
|
||||
5.3.77
|
@ -180,7 +180,7 @@ class EmailTemplateDefaults
|
||||
|
||||
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()
|
||||
@ -190,7 +190,7 @@ class EmailTemplateDefaults
|
||||
|
||||
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()
|
||||
@ -200,7 +200,7 @@ class EmailTemplateDefaults
|
||||
|
||||
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()
|
||||
@ -210,7 +210,7 @@ class EmailTemplateDefaults
|
||||
|
||||
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()
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -623,8 +623,8 @@ class BaseController extends Controller
|
||||
$query->with($includes);
|
||||
|
||||
// 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)))) {
|
||||
if (auth()->user() && ! auth()->user()->hasPermission('view_'.lcfirst(class_basename(Str::snake($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))))) {
|
||||
$query->where('user_id', '=', auth()->user()->id);
|
||||
}
|
||||
|
||||
|
@ -198,7 +198,7 @@ class NinjaPlanController extends Controller
|
||||
if($account)
|
||||
{
|
||||
//offer the option to have a free trial
|
||||
if(!$account->trial_started)
|
||||
if(!$account->trial_started && !$account->plan)
|
||||
return $this->trial();
|
||||
|
||||
if(Carbon::parse($account->plan_expires)->lt(now())){
|
||||
|
@ -100,9 +100,10 @@ class SelfUpdateController extends BaseController
|
||||
|
||||
$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');
|
||||
|
||||
|
@ -42,6 +42,7 @@ class QueryLogging
|
||||
$timeStart = microtime(true);
|
||||
DB::enableQueryLog();
|
||||
|
||||
$response = $next($request);
|
||||
// hide requests made by debugbar
|
||||
if (strstr($request->url(), '_debugbar') === false) {
|
||||
|
||||
@ -71,7 +72,6 @@ class QueryLogging
|
||||
->queue();
|
||||
}
|
||||
|
||||
|
||||
return $next($request);
|
||||
return $response;
|
||||
}
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ class CreatePaymentMethodRequest extends FormRequest
|
||||
public function authorize(): bool
|
||||
{
|
||||
/** @var Client $client */
|
||||
$client = auth()->('guard')->user()->client;
|
||||
$client = auth()->guard('contact')->user()->client;
|
||||
|
||||
$available_methods = [];
|
||||
|
||||
|
@ -383,8 +383,11 @@ class RecurringInvoice extends BaseModel
|
||||
case self::FREQUENCY_TWO_YEARS:
|
||||
return ctrans('texts.freq_two_years');
|
||||
break;
|
||||
case self::FREQUENCY_THREE_YEARS:
|
||||
return ctrans('texts.freq_three_years');
|
||||
break;
|
||||
default:
|
||||
// code...
|
||||
return '';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ class QuoteObserver
|
||||
|
||||
if ($subscriptions) {
|
||||
$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) {
|
||||
$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) {
|
||||
$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')) {
|
||||
$invoice->service()->toggleFeesPaid()->save();
|
||||
// $invoice->client->service()->updateBalance($fee_total)->save();
|
||||
// $invoice->ledger()->updateInvoiceBalance($fee_total, "Gateway fee adjustment for invoice {$invoice->number}");
|
||||
}
|
||||
|
||||
$transaction = [
|
||||
|
@ -28,21 +28,21 @@ class ClientService
|
||||
|
||||
public function updateBalance(float $amount)
|
||||
{
|
||||
$this->client->increment('balance', $amount);
|
||||
$this->client->balance += $amount;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function updatePaidToDate(float $amount)
|
||||
{
|
||||
$this->client->increment('paid_to_date', $amount);
|
||||
$this->client->paid_to_date += $amount;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function adjustCreditBalance(float $amount)
|
||||
{
|
||||
$this->client->increment('credit_balance', $amount);
|
||||
$this->client->credit_balance += $amount;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
@ -167,25 +167,22 @@ class CreditService
|
||||
|
||||
public function adjustBalance($adjustment)
|
||||
{
|
||||
// $this->credit->balance += $adjustment;
|
||||
$this->credit->increment('balance', $adjustment);
|
||||
|
||||
$this->credit->balance += $adjustment;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function updatePaidToDate($adjustment)
|
||||
{
|
||||
// $this->credit->paid_to_date += $adjustment;
|
||||
$this->credit->increment('paid_to_date', $adjustment);
|
||||
|
||||
$this->credit->paid_to_date += $adjustment;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function updateBalance($adjustment)
|
||||
{
|
||||
// $this->credit->balance -= $adjustment;
|
||||
$this->credit->decrement('balance', $adjustment);
|
||||
|
||||
$this->credit->balance -= $adjustment;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
@ -403,8 +403,7 @@ class InvoiceService
|
||||
/*Update the partial amount of a invoice*/
|
||||
public function updatePartial($amount)
|
||||
{
|
||||
// $this->invoice->partial += $amount;
|
||||
$this->invoice->increment('partial', $amount);
|
||||
$this->invoice->partial += $amount;
|
||||
|
||||
return $this;
|
||||
}
|
||||
@ -535,7 +534,7 @@ class InvoiceService
|
||||
/* Throws: Payment amount xxx does not match invoice totals. */
|
||||
|
||||
if ($this->invoice->trashed())
|
||||
return;
|
||||
return $this;
|
||||
|
||||
$this->invoice->delete();
|
||||
|
||||
|
@ -40,19 +40,20 @@ class UpdateInvoicePayment
|
||||
$paid_invoices = $this->payment_hash->invoices();
|
||||
|
||||
$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->restore();
|
||||
$client = $client->fresh();
|
||||
|
||||
$invoice = $invoices->first(function ($inv) use ($paid_invoice) {
|
||||
return $paid_invoice->invoice_id == $inv->hashed_id;
|
||||
});
|
||||
|
||||
|
||||
if($invoice->trashed())
|
||||
$invoice->restore();
|
||||
|
||||
@ -62,23 +63,23 @@ class UpdateInvoicePayment
|
||||
$paid_amount = $paid_invoice->amount;
|
||||
}
|
||||
|
||||
$client
|
||||
->service()
|
||||
->updatePaidToDate($paid_amount)
|
||||
->save();
|
||||
$client->paid_to_date += $paid_amount;
|
||||
$client->balance -= $paid_amount;
|
||||
$client->save();
|
||||
|
||||
/* 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)
|
||||
$paid_amount = $invoice->balance;
|
||||
|
||||
/*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!
|
||||
->clearPartial()
|
||||
->updateBalance($paid_amount * -1)
|
||||
->updatePaidToDate($paid_amount)
|
||||
->updateStatus()
|
||||
->touchPdf()
|
||||
->save();
|
||||
//caution what if we amount paid was less than partial - we wipe it!
|
||||
$invoice = $invoice->service()
|
||||
->clearPartial()
|
||||
->updateBalance($paid_amount * -1)
|
||||
->updatePaidToDate($paid_amount)
|
||||
->updateStatus()
|
||||
->touchPdf()
|
||||
->save();
|
||||
|
||||
$invoice->service()
|
||||
->workFlow()
|
||||
@ -89,11 +90,6 @@ class UpdateInvoicePayment
|
||||
->ledger()
|
||||
->updatePaymentBalance($paid_amount * -1);
|
||||
|
||||
$client
|
||||
->service()
|
||||
->updateBalance($paid_amount * -1)
|
||||
->save();
|
||||
|
||||
$pivot_invoice = $this->payment->invoices->first(function ($inv) use ($paid_invoice) {
|
||||
return $inv->hashed_id == $paid_invoice->invoice_id;
|
||||
});
|
||||
|
@ -29,6 +29,10 @@ trait CompanyGatewayFeesAndLimitsSaver
|
||||
|
||||
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 */
|
||||
if (! property_exists($fee_and_limit, $key) || is_null($fee_and_limit->{$key}) || ! isset($fee_and_limit->{$key}) || $fee_and_limit->{$key} == '') {
|
||||
continue;
|
||||
|
@ -35,6 +35,12 @@ trait SettingsSaver
|
||||
ksort($casts);
|
||||
|
||||
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)) {
|
||||
$value = 'string';
|
||||
if (! property_exists($settings, $key)) {
|
||||
|
@ -14,8 +14,8 @@ return [
|
||||
'require_https' => env('REQUIRE_HTTPS', true),
|
||||
'app_url' => rtrim(env('APP_URL', ''), '/'),
|
||||
'app_domain' => env('APP_DOMAIN', 'invoicing.co'),
|
||||
'app_version' => '5.3.76',
|
||||
'app_tag' => '5.3.76',
|
||||
'app_version' => '5.3.77',
|
||||
'app_tag' => '5.3.77',
|
||||
'minimum_client_version' => '5.0.16',
|
||||
'terms_version' => '1.0.1',
|
||||
'api_secret' => env('API_SECRET', ''),
|
||||
|
Loading…
Reference in New Issue
Block a user