Fixes for statement

This commit is contained in:
David Bomba 2024-12-07 08:48:34 +11:00
parent 8cb2f8ea19
commit 1d89e89148
3 changed files with 4 additions and 8 deletions

View File

@ -44,7 +44,7 @@ class BulkInvoiceRequest extends Request
throw new DuplicatePaymentException('Action still processing, please wait. ', 429);
}
$delay = $this->input('action', 'delete') == 'delete' ? (ceil(count($this->input('ids', 4)))) : 1;
$delay = $this->input('action', 'delete') == 'delete' ? (ceil(count($this->input('ids', 2)))) : 1;
\Illuminate\Support\Facades\Cache::put(($this->ip()."|".$this->input('action', 0)."|".$user->company()->company_key), true, $delay);
}

View File

@ -160,6 +160,7 @@ class Statement
private function templateStatement($variables)
{
if (isset($this->options['template'])) {
$statement_design_id = $this->options['template'];
} else {
@ -221,12 +222,10 @@ class Statement
$this->entity = $this->getInvoices()->first();//@phpstan-ignore-line
}
else {
nlog("fall back to any invoice/invitation");
$this->entity = $this->client->invoices()->whereHas('invitations')->first();
}
if(\is_null($this->entity)){
$settings = new \stdClass();
$settings->entity = \App\Models\Client::class;
$settings->currency_id = '1';
@ -419,13 +418,12 @@ class Statement
protected function getInvitation()
{
if($this->entity instanceof Invoice) {
// if ($this->entity instanceof Invoice || $this->entity instanceof Payment) {
$invitation = $this->entity->whereHas('invitations')->first()->invitations->first();
$invitation = $this->entity->invitations->first();
if($invitation)
return $invitation;
$invitation = $this->client->invoice()->whereHas('invitations')->first()->invitations->first();
$invitation = $this->client->invoices()->whereHas('invitations')->first()->invitations->first();
if ($invitation)
return $invitation;

View File

@ -29,8 +29,6 @@ class PdfMaker
private $options;
public $xpath;
/** @var CommonMarkConverter */
protected $commonmark;