Merge pull request #7242 from turbo124/v5-develop

v5.3.63
This commit is contained in:
David Bomba 2022-02-28 16:55:45 +11:00 committed by GitHub
commit fdfea57665
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 54 additions and 16 deletions

View File

@ -1 +1 @@
5.3.62 5.3.63

View File

@ -51,7 +51,7 @@ class ContactHashLoginController extends Controller
return render('generic.error', ['title' => session()->get('title'), 'notification' => session()->get('notification')]); return render('generic.error', ['title' => session()->get('title'), 'notification' => session()->get('notification')]);
} }
private function setRedirectPath() private function setRedirectPath()
{ {
if(auth()->guard('contact')->user()->company->enabled_modules & PortalComposer::MODULE_INVOICES) if(auth()->guard('contact')->user()->company->enabled_modules & PortalComposer::MODULE_INVOICES)

View File

@ -125,7 +125,7 @@ class InvitationController extends Controller
} }
if (auth()->guard('contact') && ! request()->has('silent') && ! $invitation->viewed_date) { if (auth()->guard('contact')->user() && ! request()->has('silent') && ! $invitation->viewed_date) {
$invitation->markViewed(); $invitation->markViewed();
event(new InvitationWasViewed($invitation->{$entity}, $invitation, $invitation->{$entity}->company, Ninja::eventVars())); event(new InvitationWasViewed($invitation->{$entity}, $invitation, $invitation->{$entity}->company, Ninja::eventVars()));

View File

@ -159,6 +159,8 @@ class NinjaPlanController extends Controller
$recurring_invoice->next_send_date = now()->addDays(14)->format('Y-m-d'); $recurring_invoice->next_send_date = now()->addDays(14)->format('Y-m-d');
$recurring_invoice->save(); $recurring_invoice->save();
$recurring_invoice = $recurring_invoice->calc()->getRecurringInvoice();
$recurring_invoice->service()->start(); $recurring_invoice->service()->start();
return redirect('/'); return redirect('/');

View File

@ -123,6 +123,8 @@ class ContactKeyLogin
return redirect($this->setRedirectPath()); return redirect($this->setRedirectPath());
} }
} }
//28-02-2022 middleware should not allow this to progress as we should have redirected by this stage.
abort(404, "Unable to authenticate.");
return $next($request); return $next($request);
} }

View File

@ -46,6 +46,9 @@ class SetInviteDb
if($entity == "pay") if($entity == "pay")
$entity = "invoice"; $entity = "invoice";
if(!in_array($entity, ['invoice','quote','credit','recurring_invoice']))
abort(404,'I could not find this resource.');
/* Try and determine the DB from the invitation key STRING*/ /* Try and determine the DB from the invitation key STRING*/
if (config('ninja.db.multi_db_enabled')) { if (config('ninja.db.multi_db_enabled')) {

View File

@ -125,7 +125,7 @@ class InvoiceTransformer extends BaseTransformer
$this->getString($invoice_data, 'invoice.status') $this->getString($invoice_data, 'invoice.status')
)) ))
] ?? Invoice::STATUS_SENT, ] ?? Invoice::STATUS_SENT,
'archived' => $status === 'archived', // 'archived' => $status === 'archived',
]; ];
/* If we can't find the client, then lets try and create a client */ /* If we can't find the client, then lets try and create a client */

View File

@ -110,13 +110,10 @@ class PaymentFailedMailer implements ShouldQueue
}); });
//add client payment failures here. //add client payment failures here.
nlog("pre client failure email"); //
if($contact = $this->client->primary_contact()->first()) if($contact = $this->client->primary_contact()->first())
{ {
nlog("inside failure");
$mail_obj = (new ClientPaymentFailureObject($this->client, $this->error, $this->company, $this->payment_hash))->build(); $mail_obj = (new ClientPaymentFailureObject($this->client, $this->error, $this->company, $this->payment_hash))->build();
$nmo = new NinjaMailerObject; $nmo = new NinjaMailerObject;

View File

@ -57,7 +57,6 @@ class ClientPaymentFailureObject
public function build() public function build()
{ {
if(!$this->payment_hash){ if(!$this->payment_hash){
nlog("no payment has for failure notification - ClientPaymentFailureObject");
return; return;
} }
@ -124,7 +123,6 @@ class ClientPaymentFailureObject
'settings' => $this->client->getMergedSettings(), 'settings' => $this->client->getMergedSettings(),
'whitelabel' => $this->company->account->isPaid() ? true : false, 'whitelabel' => $this->company->account->isPaid() ? true : false,
'url' => $this->invoices->first()->invitations->first()->getPaymentLink(), 'url' => $this->invoices->first()->invitations->first()->getPaymentLink(),
// 'button' => 'texts.pay_now',
'button' => ctrans('texts.pay_now'), 'button' => ctrans('texts.pay_now'),
'additional_info' => false, 'additional_info' => false,
'company' => $this->company, 'company' => $this->company,

View File

@ -498,6 +498,20 @@ class Invoice extends BaseModel
return $this->calc()->getTotal(); return $this->calc()->getTotal();
} }
public function getPayableAmount()
{
if($this->partial > 0)
return $this->partial;
if($this->balance > 0)
return $this->balance;
if($this->status_id = 1)
return $this->amount;
return 0;
}
public function entityEmailEvent($invitation, $reminder_template, $template) public function entityEmailEvent($invitation, $reminder_template, $template)
{ {
switch ($reminder_template) { switch ($reminder_template) {

View File

@ -228,10 +228,14 @@ class SubscriptionService
->where('is_deleted', 0) ->where('is_deleted', 0)
->orderBy('id', 'desc') ->orderBy('id', 'desc')
->first(); ->first();
} }
if ($outstanding->count() == 0){ //need to ensure at this point that a refund is appropriate!!
//28-02-2022
if($recurring_invoice->invoices()->count() == 0){
return $target->price;
}
elseif ($outstanding->count() == 0){
//nothing outstanding //nothing outstanding
return $target->price - $this->calculateProRataRefundForSubscription($outstanding_invoice); return $target->price - $this->calculateProRataRefundForSubscription($outstanding_invoice);
} }

View File

@ -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.62', 'app_version' => '5.3.63',
'app_tag' => '5.3.62', 'app_tag' => '5.3.63',
'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', ''),

View File

@ -4547,7 +4547,25 @@ $LANG = array(
'to_view_entity_set_password' => 'To view the :entity you need to set password.', 'to_view_entity_set_password' => 'To view the :entity you need to set password.',
'unsubscribe' => 'Unsubscribe', 'unsubscribe' => 'Unsubscribe',
'unsubscribed' => 'Unsubscribed', 'unsubscribed' => 'Unsubscribed',
'unsubscribed_text' => 'You have been removed from notifications for this document' 'unsubscribed_text' => 'You have been removed from notifications for this document',
'client_shipping_state' => 'Client Shipping State',
'client_shipping_city' => 'Client Shipping City',
'client_shipping_postal_code' => 'Client Shipping Postal Code',
'client_shipping_country' => 'Client Shipping Country',
'load_pdf' => 'Load PDF',
'start_free_trial' => 'Start Free Trial',
'start_free_trial_message' => 'Start your FREE 14 day trial of the pro plan',
'due_on_receipt' => 'Due on Receipt',
'is_paid' => 'Is Paid',
'age_group_paid' => 'Paid',
'id' => 'Id',
'convert_to' => 'Convert To',
'client_currency' => 'Client Currency',
'company_currency' => 'Company Currency',
'custom_emails_disabled_help' => 'To prevent spam we require upgrading to a paid account to customize the email',
'upgrade_to_add_company' => 'Upgrade your plan to add companies',
'file_saved_in_downloads_folder' => 'The file has been saved in the downloads folder',
'small' => 'Small',
); );
return $LANG; return $LANG;

View File

@ -59,7 +59,7 @@
@if($settings->client_portal_allow_under_payment || $settings->client_portal_allow_over_payment) @if($settings->client_portal_allow_under_payment || $settings->client_portal_allow_over_payment)
<button class="button button-primary bg-primary">{{ ctrans('texts.pay_now') }}</button> <button class="button button-primary bg-primary">{{ ctrans('texts.pay_now') }}</button>
@else @else
@livewire('pay-now-dropdown', ['total' => $invoice->partial > 0 ? $invoice->partial : $invoice->balance, 'company' => $company]) @livewire('pay-now-dropdown', ['total' => $invoice->getPayableAmount(), 'company' => $company])
@endif @endif
</div> </div>
</div> </div>