mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -04:00
Fixes for pdf regeneration
This commit is contained in:
parent
386131f618
commit
239b180a21
@ -401,7 +401,7 @@ class InvoiceController extends BaseController
|
||||
|
||||
$invoice = $this->invoice_repo->save($request->all(), $invoice);
|
||||
|
||||
$invoice->service()->triggeredActions($request)->deletePdf();
|
||||
$invoice->service()->triggeredActions($request)->deletePdf()->touchPdf();
|
||||
|
||||
event(new InvoiceWasUpdated($invoice, $invoice->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));
|
||||
|
||||
@ -708,7 +708,7 @@ class InvoiceController extends BaseController
|
||||
}
|
||||
break;
|
||||
case 'cancel':
|
||||
$invoice = $invoice->service()->handleCancellation()->deletePdf()->save();
|
||||
$invoice = $invoice->service()->handleCancellation()->deletePdf()->touchPdf()->save();
|
||||
|
||||
if (! $bulk) {
|
||||
$this->itemResponse($invoice);
|
||||
|
@ -95,7 +95,7 @@ class SendRecurring implements ShouldQueue
|
||||
$invoice = $this->createRecurringInvitations($invoice);
|
||||
|
||||
/* 09-01-2022 ensure we create the PDFs at this point in time! */
|
||||
$invoice->service()->touchPdf();
|
||||
$invoice->service()->touchPdf(true);
|
||||
|
||||
nlog("updating recurring invoice dates");
|
||||
/* Set next date here to prevent a recurring loop forming */
|
||||
|
@ -80,6 +80,8 @@ class ReminderJob implements ShouldQueue
|
||||
$invoice->service()->touchReminder($reminder_template)->save();
|
||||
$invoice = $this->calcLateFee($invoice, $reminder_template);
|
||||
|
||||
$invoice->service()->touchPdf();
|
||||
|
||||
//check if this reminder needs to be emailed
|
||||
if(in_array($reminder_template, ['reminder1','reminder2','reminder3','reminder_endless']) && $invoice->client->getSetting("enable_".$reminder_template))
|
||||
{
|
||||
|
@ -43,7 +43,7 @@ class InvoiceArchivedActivity implements ShouldQueue
|
||||
{
|
||||
MultiDB::setDb($event->company->db);
|
||||
|
||||
$event->invoice->service()->deletePdf();
|
||||
// $event->invoice->service()->deletePdf();
|
||||
|
||||
$fields = new stdClass;
|
||||
|
||||
|
@ -442,7 +442,7 @@ class BaseDriver extends AbstractPaymentDriver
|
||||
|
||||
$invoices->each(function ($invoice) {
|
||||
|
||||
$invoice->service()->deletePdf();
|
||||
$invoice->service()->touchPdf();
|
||||
|
||||
});
|
||||
|
||||
@ -494,7 +494,7 @@ class BaseDriver extends AbstractPaymentDriver
|
||||
|
||||
$invoices->each(function ($invoice){
|
||||
|
||||
$invoice->service()->deletePdf();
|
||||
$invoice->service()->touchPdf();
|
||||
|
||||
});
|
||||
|
||||
|
@ -194,13 +194,18 @@ class BrowserPay implements MethodInterface
|
||||
return;
|
||||
}
|
||||
|
||||
$domain = config('ninja.app_url');
|
||||
// $domain = config('ninja.app_url');
|
||||
|
||||
if (Ninja::isHosted()) {
|
||||
$domain = isset($this->stripe->company_gateway->company->portal_domain)
|
||||
? $this->stripe->company_gateway->company->portal_domain
|
||||
: $this->stripe->company_gateway->company->domain();
|
||||
}
|
||||
// if (Ninja::isHosted()) {
|
||||
// $domain = isset($this->stripe->company_gateway->company->portal_domain)
|
||||
// ? $this->stripe->company_gateway->company->portal_domain
|
||||
// : $this->stripe->company_gateway->company->domain();
|
||||
// }
|
||||
|
||||
$domain = $this->getAppleDomain();
|
||||
|
||||
if(!$domain)
|
||||
throw new PaymentFailed('Unable to register Domain with Apple Pay', 500);
|
||||
|
||||
$response = ApplePayDomain::create([
|
||||
'domain_name' => $domain,
|
||||
@ -212,4 +217,36 @@ class BrowserPay implements MethodInterface
|
||||
|
||||
$this->stripe->company_gateway->save();
|
||||
}
|
||||
|
||||
|
||||
private function getAppleDomain()
|
||||
{
|
||||
|
||||
$domain = '';
|
||||
|
||||
if(Ninja::isHosted())
|
||||
{
|
||||
|
||||
if($this->company_gateway->company->portal_mode == 'domain'){
|
||||
$domain = $this->company_gateway->company->portal_domain;
|
||||
}
|
||||
else{
|
||||
$domain = $this->company_gateway->company->subdomain . '.' . config('ninja.app_domain');
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
$domain = config('ninja.app_url');
|
||||
}
|
||||
|
||||
$parsed_url = parse_url($domain);
|
||||
|
||||
if(array_key_exists('host', $parsed_url))
|
||||
return $parsed_url['host'];
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -390,18 +390,27 @@ class InvoiceService
|
||||
*/
|
||||
public function touchPdf($force = false)
|
||||
{
|
||||
if($force){
|
||||
try {
|
||||
|
||||
if($force){
|
||||
|
||||
$this->invoice->invitations->each(function ($invitation) {
|
||||
CreateEntityPdf::dispatchNow($invitation);
|
||||
});
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
$this->invoice->invitations->each(function ($invitation) {
|
||||
CreateEntityPdf::dispatchNow($invitation);
|
||||
CreateEntityPdf::dispatch($invitation);
|
||||
});
|
||||
|
||||
return $this;
|
||||
|
||||
}
|
||||
catch(\Exception $e){
|
||||
|
||||
$this->invoice->invitations->each(function ($invitation) {
|
||||
CreateEntityPdf::dispatch($invitation);
|
||||
});
|
||||
nlog("failed creating invoices in Touch PDF");
|
||||
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
@ -89,6 +89,7 @@ class MarkPaid extends AbstractService
|
||||
->service()
|
||||
->applyNumber()
|
||||
->deletePdf()
|
||||
->touchPdf()
|
||||
->save();
|
||||
|
||||
$payment->ledger()
|
||||
|
@ -87,7 +87,7 @@ class UpdateInvoicePayment
|
||||
$invoice->refresh();
|
||||
|
||||
$invoice->service()
|
||||
->deletePdf()
|
||||
->touchPdf()
|
||||
->workFlow()
|
||||
->save();
|
||||
|
||||
|
@ -94,7 +94,7 @@ trait SettingsSaver
|
||||
case 'double':
|
||||
return is_float($value) || is_numeric(strval($value));
|
||||
case 'string':
|
||||
return ( is_string( $value ) && method_exists($value, '__toString') ) || is_null($value) || is_string($value);
|
||||
return !is_int($value) || ( is_string( $value ) && method_exists($value, '__toString') ) || is_null($value) || is_string($value);
|
||||
case 'bool':
|
||||
case 'boolean':
|
||||
return is_bool($value) || (int) filter_var($value, FILTER_VALIDATE_BOOLEAN);
|
||||
|
Loading…
x
Reference in New Issue
Block a user