mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 13:12:50 +01:00
remove invoice_email_list from settings
This commit is contained in:
parent
7ccd9114aa
commit
6c80df9835
@ -88,7 +88,6 @@ class ClientSettings extends BaseSettings
|
||||
*/
|
||||
public $industry_id;
|
||||
public $size_id;
|
||||
public $invoice_email_list; //default comma separated list of contact ids to email
|
||||
|
||||
/**
|
||||
* Cast object values and return entire class
|
||||
@ -116,7 +115,6 @@ class ClientSettings extends BaseSettings
|
||||
'entity' => Client::class,
|
||||
'industry_id' => NULL,
|
||||
'size_id' => NULL,
|
||||
'invoice_email_list' => NULL,
|
||||
];
|
||||
|
||||
}
|
||||
|
@ -58,8 +58,8 @@ class SendRecurring
|
||||
$invoice->save();
|
||||
|
||||
// Queue: Emails for invoice
|
||||
// $this->recurring_invoice->settings->invoice_email_list //todo comma separated list of emails to fire this email to
|
||||
|
||||
// foreach invoice->invitations
|
||||
|
||||
// Fire Payment if auto-bill is enabled
|
||||
if($this->recurring_invoice->settings->auto_bill)
|
||||
//PAYMENT ACTION HERE TODO
|
||||
|
@ -1,63 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Invoice Ninja (https://invoiceninja.com)
|
||||
*
|
||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||
*
|
||||
* @copyright Copyright (c) 2019. Invoice Ninja LLC (https://invoiceninja.com)
|
||||
*
|
||||
* @license https://opensource.org/licenses/AAL
|
||||
*/
|
||||
|
||||
namespace App\Listeners\Invoice;
|
||||
|
||||
use App\Models\ClientContact;
|
||||
use App\Models\InvoiceInvitation;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class CreateInvoiceInvitations
|
||||
{
|
||||
use MakesHash;
|
||||
/**
|
||||
* Create the event listener.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the creation of invitations for an invoice.
|
||||
* We only ever create one invitation per contact.
|
||||
*
|
||||
* @param object $event
|
||||
* @return void
|
||||
*/
|
||||
public function handle($event)
|
||||
{
|
||||
|
||||
$invoice = $event->invoice;
|
||||
|
||||
$contacts = ClientContact::whereIn('id', explode(',', $invoice->settings->invoice_email_list))->get();
|
||||
|
||||
$contacts->each(function ($contact) use($invoice) {
|
||||
|
||||
$i = InvoiceInvitation::firstOrCreate([
|
||||
'client_contact_id' => $contact->id,
|
||||
'invoice_id' => $invoice->id
|
||||
],
|
||||
[
|
||||
'company_id' => $invoice->company_id,
|
||||
'user_id' => $invoice->user_id,
|
||||
'invitation_key' => $this->createDbHash($invoice->company->db),
|
||||
]);
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
}
|
@ -55,7 +55,8 @@ class InvoiceRepository extends BaseRepository
|
||||
|
||||
$invoice->save();
|
||||
|
||||
$this->saveInvitations($data['invitations'], $invoice);
|
||||
if(array_key_exists('invitations', $data))
|
||||
$this->saveInvitations($data['invitations'], $invoice);
|
||||
|
||||
$invoice_calc = new InvoiceCalc($invoice, $invoice->settings);
|
||||
|
||||
@ -128,12 +129,12 @@ class InvoiceRepository extends BaseRepository
|
||||
|
||||
foreach($invitations as $invitation)
|
||||
{
|
||||
//only update new invitations
|
||||
if(strlen($invitation['invitation_key']) == 0)
|
||||
//only insert new invitations
|
||||
if(! array_key_exists('id', $invitation) || strlen($invitation['id']) == 0)
|
||||
{
|
||||
|
||||
$invitation = InvoiceInvitationFactory::create($invoice->company_id, $invoice->user_id);
|
||||
$invitation->client_contact_id = $invitation->['client_contact_id'];
|
||||
$invitation->client_contact_id = $invitation['client_contact_id'];
|
||||
$invitation->invoice_id = $invoice->id;
|
||||
$invitation->save();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user