Merge pull request #4607 from turbo124/v5-develop

Display client name if contact name is not present
This commit is contained in:
David Bomba 2021-01-01 11:53:34 +11:00 committed by GitHub
commit 2e2b815371
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 3 deletions

View File

@ -21,7 +21,12 @@ class ClientContactPresenter extends EntityPresenter
*/
public function name()
{
return $this->entity->first_name.' '.$this->entity->last_name;
$contact_name = $this->entity->first_name.' '.$this->entity->last_name;
if(strlen($contact_name) > 1)
return $contact_name;
return $this->entity->client->present()->name();
}
public function first_name()

View File

@ -367,9 +367,13 @@ class RecurringInvoice extends BaseModel
$iterations = 10;
}
$data = [];
if(!$this->next_send_date)
return $data;
$next_send_date = Carbon::parse($this->next_send_date)->copy();
$data = [];
for ($x=0; $x<$iterations; $x++) {
// we don't add the days... we calc the day of the month!!