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 = $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)));
|
event(new InvoiceWasUpdated($invoice, $invoice->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));
|
||||||
|
|
||||||
@ -708,7 +708,7 @@ class InvoiceController extends BaseController
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'cancel':
|
case 'cancel':
|
||||||
$invoice = $invoice->service()->handleCancellation()->deletePdf()->save();
|
$invoice = $invoice->service()->handleCancellation()->deletePdf()->touchPdf()->save();
|
||||||
|
|
||||||
if (! $bulk) {
|
if (! $bulk) {
|
||||||
$this->itemResponse($invoice);
|
$this->itemResponse($invoice);
|
||||||
|
@ -95,7 +95,7 @@ class SendRecurring implements ShouldQueue
|
|||||||
$invoice = $this->createRecurringInvitations($invoice);
|
$invoice = $this->createRecurringInvitations($invoice);
|
||||||
|
|
||||||
/* 09-01-2022 ensure we create the PDFs at this point in time! */
|
/* 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");
|
nlog("updating recurring invoice dates");
|
||||||
/* Set next date here to prevent a recurring loop forming */
|
/* 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->service()->touchReminder($reminder_template)->save();
|
||||||
$invoice = $this->calcLateFee($invoice, $reminder_template);
|
$invoice = $this->calcLateFee($invoice, $reminder_template);
|
||||||
|
|
||||||
|
$invoice->service()->touchPdf();
|
||||||
|
|
||||||
//check if this reminder needs to be emailed
|
//check if this reminder needs to be emailed
|
||||||
if(in_array($reminder_template, ['reminder1','reminder2','reminder3','reminder_endless']) && $invoice->client->getSetting("enable_".$reminder_template))
|
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);
|
MultiDB::setDb($event->company->db);
|
||||||
|
|
||||||
$event->invoice->service()->deletePdf();
|
// $event->invoice->service()->deletePdf();
|
||||||
|
|
||||||
$fields = new stdClass;
|
$fields = new stdClass;
|
||||||
|
|
||||||
|
@ -442,7 +442,7 @@ class BaseDriver extends AbstractPaymentDriver
|
|||||||
|
|
||||||
$invoices->each(function ($invoice) {
|
$invoices->each(function ($invoice) {
|
||||||
|
|
||||||
$invoice->service()->deletePdf();
|
$invoice->service()->touchPdf();
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -494,7 +494,7 @@ class BaseDriver extends AbstractPaymentDriver
|
|||||||
|
|
||||||
$invoices->each(function ($invoice){
|
$invoices->each(function ($invoice){
|
||||||
|
|
||||||
$invoice->service()->deletePdf();
|
$invoice->service()->touchPdf();
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -194,13 +194,18 @@ class BrowserPay implements MethodInterface
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$domain = config('ninja.app_url');
|
// $domain = config('ninja.app_url');
|
||||||
|
|
||||||
if (Ninja::isHosted()) {
|
// if (Ninja::isHosted()) {
|
||||||
$domain = isset($this->stripe->company_gateway->company->portal_domain)
|
// $domain = isset($this->stripe->company_gateway->company->portal_domain)
|
||||||
? $this->stripe->company_gateway->company->portal_domain
|
// ? $this->stripe->company_gateway->company->portal_domain
|
||||||
: $this->stripe->company_gateway->company->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([
|
$response = ApplePayDomain::create([
|
||||||
'domain_name' => $domain,
|
'domain_name' => $domain,
|
||||||
@ -212,4 +217,36 @@ class BrowserPay implements MethodInterface
|
|||||||
|
|
||||||
$this->stripe->company_gateway->save();
|
$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)
|
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) {
|
$this->invoice->invitations->each(function ($invitation) {
|
||||||
CreateEntityPdf::dispatchNow($invitation);
|
CreateEntityPdf::dispatch($invitation);
|
||||||
});
|
});
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
}
|
||||||
|
catch(\Exception $e){
|
||||||
|
|
||||||
$this->invoice->invitations->each(function ($invitation) {
|
nlog("failed creating invoices in Touch PDF");
|
||||||
CreateEntityPdf::dispatch($invitation);
|
|
||||||
});
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
@ -89,6 +89,7 @@ class MarkPaid extends AbstractService
|
|||||||
->service()
|
->service()
|
||||||
->applyNumber()
|
->applyNumber()
|
||||||
->deletePdf()
|
->deletePdf()
|
||||||
|
->touchPdf()
|
||||||
->save();
|
->save();
|
||||||
|
|
||||||
$payment->ledger()
|
$payment->ledger()
|
||||||
|
@ -87,7 +87,7 @@ class UpdateInvoicePayment
|
|||||||
$invoice->refresh();
|
$invoice->refresh();
|
||||||
|
|
||||||
$invoice->service()
|
$invoice->service()
|
||||||
->deletePdf()
|
->touchPdf()
|
||||||
->workFlow()
|
->workFlow()
|
||||||
->save();
|
->save();
|
||||||
|
|
||||||
|
@ -94,7 +94,7 @@ trait SettingsSaver
|
|||||||
case 'double':
|
case 'double':
|
||||||
return is_float($value) || is_numeric(strval($value));
|
return is_float($value) || is_numeric(strval($value));
|
||||||
case 'string':
|
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 'bool':
|
||||||
case 'boolean':
|
case 'boolean':
|
||||||
return is_bool($value) || (int) filter_var($value, FILTER_VALIDATE_BOOLEAN);
|
return is_bool($value) || (int) filter_var($value, FILTER_VALIDATE_BOOLEAN);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user