mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 05:02:36 +01:00
Working on templates
This commit is contained in:
parent
7f31d076b6
commit
cf7ee6338e
@ -22,6 +22,7 @@ use App\Utils\Traits\MakesDates;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
/**
|
||||
* Class InvitationController.
|
||||
@ -33,9 +34,10 @@ class InvitationController extends Controller
|
||||
|
||||
public function router(string $entity, string $invitation_key)
|
||||
{
|
||||
|
||||
$key = $entity.'_id';
|
||||
|
||||
$entity_obj = 'App\Models\\'.ucfirst($entity).'Invitation';
|
||||
$entity_obj = 'App\Models\\'.ucfirst(Str::camel($entity)).'Invitation'; //todo sensitive to the route parameters here
|
||||
|
||||
$invitation = $entity_obj::whereRaw('BINARY `key`= ?', [$invitation_key])
|
||||
->with('contact.client')
|
||||
|
@ -65,8 +65,27 @@ class StartupCheck
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*Build template cache*/
|
||||
$name = 'templates';
|
||||
|
||||
if ($request->has('clear_cache') || ! Cache::has($name)) {
|
||||
|
||||
}
|
||||
|
||||
$response = $next($request);
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
|
||||
private function buildTemplates()
|
||||
{
|
||||
$data = [];
|
||||
|
||||
$data['invoice'][
|
||||
'subject' => EmailTemplateDefaults::emailInvoiceSubject(),
|
||||
'body' => EmailTemplateDefaults::emailInvoiceTemplate),
|
||||
]
|
||||
}
|
||||
}
|
||||
|
@ -53,7 +53,8 @@ class AutoBillInvoice extends AbstractService
|
||||
if ((int)$this->invoice->balance == 0)
|
||||
return $this->invoice->service()->markPaid()->save();
|
||||
|
||||
$this->applyCreditPayment(); //if the credits cover the payments, we stop here, build the payment with credits and exit early
|
||||
//if the credits cover the payments, we stop here, build the payment with credits and exit early
|
||||
$this->applyCreditPayment();
|
||||
|
||||
/* Determine $amount */
|
||||
if ($this->invoice->partial > 0)
|
||||
@ -70,7 +71,7 @@ class AutoBillInvoice extends AbstractService
|
||||
return $this->invoice;
|
||||
|
||||
/* $gateway fee */
|
||||
$fee = $gateway_token->gateway->calcGatewayFee($this->invoice->partial);
|
||||
$fee = $gateway_token->gateway->calcGatewayFee($amount);
|
||||
|
||||
/* Build payment hash */
|
||||
$payment_hash = PaymentHash::create([
|
||||
@ -98,7 +99,7 @@ class AutoBillInvoice extends AbstractService
|
||||
info("finalizing");
|
||||
info(print_r($this->used_credit,1));
|
||||
$amount = array_sum(array_column($this->used_credit, 'amount'));
|
||||
info("amount {$amount}");
|
||||
info("amount {$amount}");
|
||||
|
||||
$payment = PaymentFactory::create($this->invoice->company_id, $this->invoice->user_id);
|
||||
$payment->amount = $amount;
|
||||
|
@ -55,12 +55,19 @@ class RecurringService
|
||||
if($this->recurring_entity->remaining_cycles == 0)
|
||||
return $this;
|
||||
|
||||
$this->recurring_entity->status_id = RecurringInvoice::STATUS_ACTIVE;
|
||||
$this->createInvitations()->setStatus(RecurringInvoice::STATUS_ACTIVE);
|
||||
|
||||
return $this;
|
||||
|
||||
}
|
||||
|
||||
public function setStatus($status)
|
||||
{
|
||||
$this->recurring_entity->status_id = $status;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Applies the invoice number.
|
||||
* @return $this InvoiceService object
|
||||
|
Loading…
Reference in New Issue
Block a user