diff --git a/VERSION.txt b/VERSION.txt index 2b025406babb..96b71d396c40 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1 +1 @@ -5.3.63 \ No newline at end of file +5.3.64 \ No newline at end of file diff --git a/app/Console/Commands/CheckData.php b/app/Console/Commands/CheckData.php index be3c02e075f7..74f5187afab2 100644 --- a/app/Console/Commands/CheckData.php +++ b/app/Console/Commands/CheckData.php @@ -480,11 +480,11 @@ class CheckData extends Command LEFT JOIN paymentables ON payments.id = paymentables.payment_id - WHERE paymentable_type = 'App\\Models\\Credit' + WHERE paymentable_type = ? AND paymentables.deleted_at is NULL AND payments.is_deleted = 0 AND payments.client_id = ?; - "), [$client->id] ); + "), [App\Models\Credit::class, $client->id] ); return $results; } @@ -507,7 +507,7 @@ class CheckData extends Command $this->wrong_paid_to_dates++; - $this->logMessage($client->present()->name.' id = # '.$client->id." - Paid to date does not match Client Paid To Date = {$client->paid_to_date} - Invoice Payments = {$total_paid_to_date}"); + $this->logMessage($client->present()->name.' id = # '.$client->id." - Client Paid To Date = {$client->paid_to_date} != Invoice Payments = {$total_paid_to_date} - {$_client->payments_applied} + {$credits_used_for_payments[0]->credit_payment}"); $this->isValid = false; diff --git a/app/Jobs/Import/CSVIngest.php b/app/Jobs/Import/CSVIngest.php index cffa87a80c0a..0d9a9609a5a5 100644 --- a/app/Jobs/Import/CSVIngest.php +++ b/app/Jobs/Import/CSVIngest.php @@ -46,6 +46,8 @@ class CSVIngest implements ShouldQueue { public array $request; + public $tries = 1; + public function __construct( array $request, Company $company ) { $this->company = $company; $this->request = $request; diff --git a/app/Jobs/Util/Import.php b/app/Jobs/Util/Import.php index 89a89458c2d8..ca5b45dd00b0 100644 --- a/app/Jobs/Util/Import.php +++ b/app/Jobs/Util/Import.php @@ -362,6 +362,7 @@ class Import implements ShouldQueue ) { $data['settings']['invoice_design_id'] = 1; } + $data['settings']['email_sending_method'] = 'default'; $data = $this->transformCompanyData($data); @@ -374,9 +375,6 @@ class Import implements ShouldQueue $data['subdomain'] = MultiDB::randomSubdomainGenerator(); } - else { - $data['email_sending_method'] = 'default'; - } $rules = (new UpdateCompanyRequest())->rules(); diff --git a/app/Services/Client/ClientService.php b/app/Services/Client/ClientService.php index 1fa8ee4b7324..2f2152429f4f 100644 --- a/app/Services/Client/ClientService.php +++ b/app/Services/Client/ClientService.php @@ -99,6 +99,6 @@ class ClientService { $this->client->save(); - return $this->client; + return $this->client->fresh(); } } diff --git a/app/Services/Payment/DeletePayment.php b/app/Services/Payment/DeletePayment.php index 60ea86d86ed6..f9a92cecb64c 100644 --- a/app/Services/Payment/DeletePayment.php +++ b/app/Services/Payment/DeletePayment.php @@ -145,10 +145,23 @@ class DeletePayment $multiplier = -1; $paymentable_credit->service() - ->updateBalance($paymentable_credit->pivot->amount*$multiplier) - ->updatePaidToDate($paymentable_credit->pivot->amount*-1) + ->updateBalance($paymentable_credit->pivot->amount*$multiplier*-1) + ->updatePaidToDate($paymentable_credit->pivot->amount*$multiplier) ->setStatus(Credit::STATUS_SENT) ->save(); + + $this->payment + ->client + ->service() + ->updatePaidToDate(($paymentable_credit->pivot->amount)*-1) + ->save(); + + //01-03-2022 + // $paymentable_credit->service() + // ->updateBalance($paymentable_credit->pivot->amount*$multiplier) + // ->updatePaidToDate($paymentable_credit->pivot->amount*-1) + // ->setStatus(Credit::STATUS_SENT) + // ->save(); }); } diff --git a/app/Services/Subscription/SubscriptionService.php b/app/Services/Subscription/SubscriptionService.php index b4c2c2187eeb..34eec1e31ad7 100644 --- a/app/Services/Subscription/SubscriptionService.php +++ b/app/Services/Subscription/SubscriptionService.php @@ -412,7 +412,10 @@ class SubscriptionService ->orderBy('id', 'desc') ->first(); - if(!$last_invoice){ + if($recurring_invoice->invoices()->count() == 0){ + $pro_rata_refund_amount = 0; + } + elseif(!$last_invoice){ $is_credit = true; diff --git a/config/ninja.php b/config/ninja.php index e42bd3a24016..f31cfae39381 100644 --- a/config/ninja.php +++ b/config/ninja.php @@ -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.63', - 'app_tag' => '5.3.63', + 'app_version' => '5.3.64', + 'app_tag' => '5.3.64', 'minimum_client_version' => '5.0.16', 'terms_version' => '1.0.1', 'api_secret' => env('API_SECRET', ''),