mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-23 20:00:33 -04:00
Merge pull request #4680 from turbo124/v5-develop
Refactor notifications to be more specific, ie. Invoice -> Reminder 1
This commit is contained in:
commit
1dc932b85e
@ -30,7 +30,7 @@ class CompanySettings extends BaseSettings
|
||||
public $enable_client_portal_tasks = false; //@ben to implement
|
||||
public $enable_client_portal_password = false; //@implemented
|
||||
public $enable_client_portal = true; //@implemented
|
||||
public $enable_client_portal_dashboard = true; // @TODO There currently is no dashboard so this is pending
|
||||
public $enable_client_portal_dashboard = false; // @TODO There currently is no dashboard so this is pending
|
||||
public $signature_on_pdf = false; //@implemented
|
||||
public $document_email_attachment = false; //@TODO I assume this is 3rd party attachments on the entity to be included
|
||||
|
||||
@ -634,6 +634,7 @@ class CompanySettings extends BaseSettings
|
||||
'$product.description',
|
||||
'$product.unit_cost',
|
||||
'$product.quantity',
|
||||
'$product.discount',
|
||||
'$product.tax',
|
||||
'$product.line_total',
|
||||
],
|
||||
@ -642,6 +643,7 @@ class CompanySettings extends BaseSettings
|
||||
'$task.description',
|
||||
'$task.rate',
|
||||
'$task.hours',
|
||||
'$task.discount',
|
||||
'$task.tax',
|
||||
'$task.line_total',
|
||||
],
|
||||
|
@ -27,6 +27,7 @@ class CreditWasEmailed
|
||||
|
||||
public $event_vars;
|
||||
|
||||
public $template;
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
@ -34,10 +35,11 @@ class CreditWasEmailed
|
||||
* @param Company $company
|
||||
* @param array $event_vars
|
||||
*/
|
||||
public function __construct(CreditInvitation $invitation, Company $company, array $event_vars)
|
||||
public function __construct(CreditInvitation $invitation, Company $company, array $event_vars, string $template)
|
||||
{
|
||||
$this->invitation = $invitation;
|
||||
$this->company = $company;
|
||||
$this->event_vars = $event_vars;
|
||||
$this->template = $template;
|
||||
}
|
||||
}
|
||||
|
@ -31,6 +31,8 @@ class InvoiceWasEmailed
|
||||
|
||||
public $event_vars;
|
||||
|
||||
public $template;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
@ -38,10 +40,11 @@ class InvoiceWasEmailed
|
||||
* @param Company $company
|
||||
* @param array $event_vars
|
||||
*/
|
||||
public function __construct(InvoiceInvitation $invitation, Company $company, array $event_vars)
|
||||
public function __construct(InvoiceInvitation $invitation, Company $company, array $event_vars, string $template)
|
||||
{
|
||||
$this->invitation = $invitation;
|
||||
$this->company = $company;
|
||||
$this->event_vars = $event_vars;
|
||||
$this->template = $template;
|
||||
}
|
||||
}
|
||||
|
@ -29,6 +29,7 @@ class QuoteWasEmailed
|
||||
|
||||
public $event_vars;
|
||||
|
||||
public $template;
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
@ -37,10 +38,11 @@ class QuoteWasEmailed
|
||||
* @param Company $company
|
||||
* @param array $event_vars
|
||||
*/
|
||||
public function __construct(QuoteInvitation $invitation, Company $company, array $event_vars)
|
||||
public function __construct(QuoteInvitation $invitation, Company $company, array $event_vars, string $template)
|
||||
{
|
||||
$this->invitation = $invitation;
|
||||
$this->company = $company;
|
||||
$this->event_vars = $event_vars;
|
||||
$this->template = $template;
|
||||
}
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ class CloneQuoteToInvoiceFactory
|
||||
$invoice->due_date = null;
|
||||
$invoice->partial_due_date = null;
|
||||
$invoice->number = null;
|
||||
|
||||
$invoice->date = now()->format('Y-m-d');
|
||||
return $invoice;
|
||||
}
|
||||
}
|
||||
|
@ -22,6 +22,6 @@ class DashboardController extends Controller
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
return redirect()->route('client.invoices.index');
|
||||
return $this->render('dashboard.index');
|
||||
}
|
||||
}
|
||||
|
@ -51,6 +51,7 @@ class InvitationController extends Controller
|
||||
->with('contact.client')
|
||||
->firstOrFail();
|
||||
|
||||
|
||||
/* Return early if we have the correct client_hash embedded */
|
||||
|
||||
if (request()->has('client_hash') && request()->input('client_hash') == $invitation->contact->client->client_hash) {
|
||||
|
@ -32,6 +32,7 @@ use App\Transformers\CompanyTransformer;
|
||||
use App\Transformers\CompanyUserTransformer;
|
||||
use App\Utils\Ninja;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use App\Utils\Traits\SavesDocuments;
|
||||
use App\Utils\Traits\Uploadable;
|
||||
use Illuminate\Foundation\Bus\DispatchesJobs;
|
||||
use Illuminate\Http\Request;
|
||||
@ -47,6 +48,7 @@ class CompanyController extends BaseController
|
||||
use DispatchesJobs;
|
||||
use MakesHash;
|
||||
use Uploadable;
|
||||
use SavesDocuments;
|
||||
|
||||
protected $entity_type = Company::class;
|
||||
|
||||
@ -402,14 +404,17 @@ class CompanyController extends BaseController
|
||||
*/
|
||||
public function update(UpdateCompanyRequest $request, Company $company)
|
||||
{
|
||||
if ($request->hasFile('company_logo') || (is_array($request->input('settings')) && !array_key_exists('company_logo', $request->input('settings')))) {
|
||||
if ($request->hasFile('company_logo') || (is_array($request->input('settings')) && !array_key_exists('company_logo', $request->input('settings'))))
|
||||
$this->removeLogo($company);
|
||||
}
|
||||
|
||||
|
||||
$company = $this->company_repo->save($request->all(), $company);
|
||||
|
||||
$company->saveSettings($request->input('settings'), $company);
|
||||
|
||||
if ($request->has('documents'))
|
||||
$this->saveDocuments($request->input('documents'), $company, false);
|
||||
|
||||
$this->uploadLogo($request->file('company_logo'), $company, $company);
|
||||
|
||||
return $this->itemResponse($company);
|
||||
|
@ -1,38 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Invoice Ninja (https://invoiceninja.com).
|
||||
*
|
||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||
*
|
||||
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
||||
*
|
||||
* @license https://opensource.org/licenses/AAL
|
||||
*/
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class DashboardController extends BaseController
|
||||
{
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('auth:user');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the application dashboard.
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
// dd(json_decode(auth()->user()->permissions(),true));
|
||||
return view('dashboard.index');
|
||||
}
|
||||
}
|
@ -140,15 +140,13 @@ class EmailController extends BaseController
|
||||
$entity_obj->save();
|
||||
|
||||
/*Only notify the admin ONCE, not once per contact/invite*/
|
||||
// $invitation = $entity_obj->invitations->first();
|
||||
// EntitySentMailer::dispatch($invitation, $entity_string, $entity_obj->user, $invitation->company);
|
||||
|
||||
if ($entity_obj instanceof Invoice) {
|
||||
$this->entity_type = Invoice::class;
|
||||
$this->entity_transformer = InvoiceTransformer::class;
|
||||
|
||||
if ($entity_obj->invitations->count() >= 1) {
|
||||
$entity_obj->entityEmailEvent($entity_obj->invitations->first(), 'invoice');
|
||||
$entity_obj->entityEmailEvent($entity_obj->invitations->first(), 'invoice', $template);
|
||||
}
|
||||
}
|
||||
|
||||
@ -157,7 +155,7 @@ class EmailController extends BaseController
|
||||
$this->entity_transformer = QuoteTransformer::class;
|
||||
|
||||
if ($entity_obj->invitations->count() >= 1) {
|
||||
event(new QuoteWasEmailed($entity_obj->invitations->first(), $entity_obj->company, Ninja::eventVars()));
|
||||
event(new QuoteWasEmailed($entity_obj->invitations->first(), $entity_obj->company, Ninja::eventVars(), 'quote'));
|
||||
}
|
||||
}
|
||||
|
||||
@ -166,7 +164,7 @@ class EmailController extends BaseController
|
||||
$this->entity_transformer = CreditTransformer::class;
|
||||
|
||||
if ($entity_obj->invitations->count() >= 1) {
|
||||
event(new CreditWasEmailed($entity_obj->invitations->first(), $entity_obj->company, Ninja::eventVars()));
|
||||
event(new CreditWasEmailed($entity_obj->invitations->first(), $entity_obj->company, Ninja::eventVars(), 'credit'));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -426,10 +426,9 @@ class ExpenseController extends BaseController
|
||||
*/
|
||||
public function destroy(DestroyExpenseRequest $request, Expense $expense)
|
||||
{
|
||||
//may not need these destroy routes as we are using actions to 'archive/delete'
|
||||
$expense->delete();
|
||||
$this->expense_repo->delete($expense);
|
||||
|
||||
return response()->json([], 200);
|
||||
return $this->itemResponse($expense->fresh());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -50,7 +50,7 @@ class StoreClientRequest extends Request
|
||||
//$rules['name'] = 'required|min:1';
|
||||
$rules['id_number'] = 'unique:clients,id_number,'.$this->id.',id,company_id,'.$this->company_id;
|
||||
$rules['settings'] = new ValidClientGroupSettingsRule();
|
||||
$rules['contacts.*.email'] = 'nullable|distinct';
|
||||
$rules['contacts.*.email'] = 'bail|nullable|distinct|sometimes|email';
|
||||
$rules['contacts.*.password'] = [
|
||||
'nullable',
|
||||
'sometimes',
|
||||
|
@ -54,7 +54,7 @@ class UpdateClientRequest extends Request
|
||||
//$rules['id_number'] = 'unique:clients,id_number,,id,company_id,' . auth()->user()->company()->id;
|
||||
$rules['id_number'] = 'unique:clients,id_number,'.$this->id.',id,company_id,'.$this->company_id;
|
||||
$rules['settings'] = new ValidClientGroupSettingsRule();
|
||||
$rules['contacts.*.email'] = 'nullable|distinct';
|
||||
$rules['contacts.*.email'] = 'bail|nullable|distinct|sometimes|email';
|
||||
$rules['contacts.*.password'] = [
|
||||
'nullable',
|
||||
'sometimes',
|
||||
|
@ -39,9 +39,9 @@ class StoreUserRequest extends Request
|
||||
$rules['last_name'] = 'required|string|max:100';
|
||||
|
||||
if (config('ninja.db.multi_db_enabled')) {
|
||||
$rules['email'] = [new ValidUserForCompany(), Rule::unique('users')];
|
||||
$rules['email'] = ['email', new ValidUserForCompany(), Rule::unique('users')];
|
||||
} else {
|
||||
$rules['email'] = Rule::unique('users');
|
||||
$rules['email'] = ['email',Rule::unique('users')];
|
||||
}
|
||||
|
||||
|
||||
|
@ -35,7 +35,7 @@ class UpdateUserRequest extends Request
|
||||
];
|
||||
|
||||
if (isset($input['email'])) {
|
||||
$rules['email'] = ['email:rfc,dns', 'sometimes', new UniqueUserRule($this->user, $input['email'])];
|
||||
$rules['email'] = ['email', 'sometimes', new UniqueUserRule($this->user, $input['email'])];
|
||||
}
|
||||
|
||||
return $rules;
|
||||
|
@ -21,6 +21,8 @@ use Illuminate\View\View;
|
||||
*/
|
||||
class PortalComposer
|
||||
{
|
||||
public $settings;
|
||||
|
||||
/**
|
||||
* Bind data to the view.
|
||||
*
|
||||
@ -45,13 +47,15 @@ class PortalComposer
|
||||
return [];
|
||||
}
|
||||
|
||||
$this->settings = auth()->user()->client->getMergedSettings();
|
||||
|
||||
$data['sidebar'] = $this->sidebarMenu();
|
||||
$data['header'] = [];
|
||||
$data['footer'] = [];
|
||||
$data['countries'] = TranslationHelper::getCountries();
|
||||
$data['company'] = auth()->user()->company;
|
||||
$data['client'] = auth()->user()->client;
|
||||
$data['settings'] = auth()->user()->client->getMergedSettings();
|
||||
$data['settings'] = $this->settings;
|
||||
$data['currencies'] = TranslationHelper::getCurrencies();
|
||||
|
||||
$data['multiple_contacts'] = session()->get('multiple_contacts');
|
||||
@ -63,7 +67,9 @@ class PortalComposer
|
||||
{
|
||||
$data = [];
|
||||
|
||||
// $data[] = [ 'title' => ctrans('texts.dashboard'), 'url' => 'client.dashboard', 'icon' => 'activity'];
|
||||
if($this->settings->enable_client_portal_dashboard == TRUE)
|
||||
$data[] = [ 'title' => ctrans('texts.dashboard'), 'url' => 'client.dashboard', 'icon' => 'activity'];
|
||||
|
||||
$data[] = ['title' => ctrans('texts.invoices'), 'url' => 'client.invoices.index', 'icon' => 'file-text'];
|
||||
$data[] = ['title' => ctrans('texts.recurring_invoices'), 'url' => 'client.recurring_invoices.index', 'icon' => 'file'];
|
||||
$data[] = ['title' => ctrans('texts.payments'), 'url' => 'client.payments.index', 'icon' => 'credit-card'];
|
||||
|
@ -39,6 +39,7 @@ class EntitySentMailer extends BaseMailerJob implements ShouldQueue
|
||||
|
||||
public $settings;
|
||||
|
||||
public $template;
|
||||
/**
|
||||
* Create a new job instance.
|
||||
*
|
||||
@ -47,7 +48,7 @@ class EntitySentMailer extends BaseMailerJob implements ShouldQueue
|
||||
* @param $user
|
||||
* @param $company
|
||||
*/
|
||||
public function __construct($invitation, $entity_type, $user, $company)
|
||||
public function __construct($invitation, $entity_type, $user, $company, $template)
|
||||
{
|
||||
$this->company = $company;
|
||||
|
||||
@ -60,6 +61,8 @@ class EntitySentMailer extends BaseMailerJob implements ShouldQueue
|
||||
$this->entity_type = $entity_type;
|
||||
|
||||
$this->settings = $invitation->contact->client->getMergedSettings();
|
||||
|
||||
$this->template = $template;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -69,6 +72,8 @@ class EntitySentMailer extends BaseMailerJob implements ShouldQueue
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
nlog("entity sent mailer");
|
||||
|
||||
/*If we are migrating data we don't want to fire these notification*/
|
||||
if ($this->company->is_disabled) {
|
||||
return true;
|
||||
@ -80,7 +85,7 @@ class EntitySentMailer extends BaseMailerJob implements ShouldQueue
|
||||
//if we need to set an email driver do it now
|
||||
$this->setMailDriver();
|
||||
|
||||
$mail_obj = (new EntitySentObject($this->invitation, $this->entity_type))->build();
|
||||
$mail_obj = (new EntitySentObject($this->invitation, $this->entity_type, $this->template))->build();
|
||||
$mail_obj->from = [config('mail.from.address'), config('mail.from.name')];
|
||||
|
||||
try {
|
||||
|
@ -216,7 +216,7 @@ class SendReminders implements ShouldQueue
|
||||
|
||||
|
||||
if ($this->checkSendSetting($invoice, $template)) {
|
||||
event(new InvoiceWasEmailed($invoice->invitations->first(), $invoice->company, Ninja::eventVars()));
|
||||
event(new InvoiceWasEmailed($invoice->invitations->first(), $invoice->company, Ninja::eventVars(), $template));
|
||||
}
|
||||
|
||||
$invoice->last_sent_date = now();
|
||||
|
@ -95,9 +95,6 @@ class SendRecurring implements ShouldQueue
|
||||
|
||||
$this->recurring_invoice->save();
|
||||
|
||||
//this is duplicated!!
|
||||
// if ($invoice->invitations->count() > 0)
|
||||
// event(new InvoiceWasEmailed($invoice->invitations->first(), $invoice->company, Ninja::eventVars()));
|
||||
}
|
||||
|
||||
public function failed($exception = null)
|
||||
|
@ -66,7 +66,7 @@ class ReminderJob implements ShouldQueue
|
||||
});
|
||||
|
||||
if ($invoice->invitations->count() > 0) {
|
||||
event(new InvoiceWasEmailed($invoice->invitations->first(), $invoice->company, Ninja::eventVars()));
|
||||
event(new InvoiceWasEmailed($invoice->invitations->first(), $invoice->company, Ninja::eventVars(), $reminder_template));
|
||||
}
|
||||
} else {
|
||||
$invoice->next_send_date = null;
|
||||
|
@ -66,6 +66,9 @@ class UploadFile implements ShouldQueue
|
||||
*/
|
||||
public function handle() : ?Document
|
||||
{
|
||||
if(!$this->file)
|
||||
return null;
|
||||
|
||||
$path = self::PROPERTIES[$this->type]['path'];
|
||||
|
||||
if ($this->company) {
|
||||
|
@ -51,7 +51,7 @@ class CreditEmailedNotification implements ShouldQueue
|
||||
if (($key = array_search('mail', $methods)) !== false && $first_notification_sent === true) {
|
||||
unset($methods[$key]);
|
||||
|
||||
EntitySentMailer::dispatch($event->invitation, 'credit', $user, $event->invitation->company);
|
||||
EntitySentMailer::dispatch($event->invitation, 'credit', $user, $event->invitation->company, $event->template);
|
||||
$first_notification_sent = false;
|
||||
}
|
||||
|
||||
|
@ -36,8 +36,26 @@ class CreateInvoicePdf implements ShouldQueue
|
||||
{
|
||||
MultiDB::setDb($event->company->db);
|
||||
|
||||
if(isset($event->invoice))
|
||||
{
|
||||
$event->invoice->invitations->each(function ($invitation) {
|
||||
CreateEntityPdf::dispatch($invitation);
|
||||
});
|
||||
}
|
||||
|
||||
if(isset($event->quote))
|
||||
{
|
||||
$event->quote->invitations->each(function ($invitation) {
|
||||
CreateEntityPdf::dispatch($invitation);
|
||||
});
|
||||
}
|
||||
|
||||
if(isset($event->credit))
|
||||
{
|
||||
$event->credit->invitations->each(function ($invitation) {
|
||||
CreateEntityPdf::dispatch($invitation);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ class InvoiceEmailedNotification implements ShouldQueue
|
||||
if (($key = array_search('mail', $methods)) !== false && $first_notification_sent === true) {
|
||||
unset($methods[$key]);
|
||||
|
||||
EntitySentMailer::dispatch($event->invitation, 'invoice', $user, $event->invitation->company);
|
||||
EntitySentMailer::dispatch($event->invitation, 'invoice', $user, $event->invitation->company, $event->template);
|
||||
$first_notification_sent = false;
|
||||
}
|
||||
|
||||
|
@ -51,7 +51,7 @@ class QuoteEmailedNotification implements ShouldQueue
|
||||
if (($key = array_search('mail', $methods)) !== false && $first_notification_sent === true) {
|
||||
unset($methods[$key]);
|
||||
|
||||
EntitySentMailer::dispatch($event->invitation, 'quote', $user, $event->invitation->company);
|
||||
EntitySentMailer::dispatch($event->invitation, 'quote', $user, $event->invitation->company, $event->template);
|
||||
$first_notification_sent = false;
|
||||
}
|
||||
|
||||
|
@ -28,17 +28,26 @@ class EntitySentObject
|
||||
|
||||
public $settings;
|
||||
|
||||
public function __construct($invitation, $entity_type)
|
||||
public $template;
|
||||
|
||||
private $template_subject;
|
||||
|
||||
private $template_body;
|
||||
|
||||
public function __construct($invitation, $entity_type, $template)
|
||||
{
|
||||
$this->invitation = $invitation;
|
||||
$this->entity_type = $entity_type;
|
||||
$this->entity = $invitation->{$entity_type};
|
||||
$this->contact = $invitation->contact;
|
||||
$this->company = $invitation->company;
|
||||
$this->template = $template;
|
||||
}
|
||||
|
||||
public function build()
|
||||
{
|
||||
$this->setTemplate();
|
||||
|
||||
$mail_obj = new stdClass;
|
||||
$mail_obj->amount = $this->getAmount();
|
||||
$mail_obj->subject = $this->getSubject();
|
||||
@ -49,6 +58,47 @@ class EntitySentObject
|
||||
return $mail_obj;
|
||||
}
|
||||
|
||||
private function setTemplate()
|
||||
{
|
||||
nlog($this->template);
|
||||
|
||||
switch ($this->template) {
|
||||
case 'invoice':
|
||||
$this->template_subject = "texts.notification_invoice_sent_subject";
|
||||
$this->template_body = "texts.notification_invoice_sent";
|
||||
break;
|
||||
case 'reminder1':
|
||||
$this->template_subject = "texts.notification_invoice_reminder1_sent_subject";
|
||||
$this->template_body = "texts.notification_invoice_sent";
|
||||
break;
|
||||
case 'reminder2':
|
||||
$this->template_subject = "texts.notification_invoice_reminder2_sent_subject";
|
||||
$this->template_body = "texts.notification_invoice_sent";
|
||||
break;
|
||||
case 'reminder3':
|
||||
$this->template_subject = "texts.notification_invoice_reminder3_sent_subject";
|
||||
$this->template_body = "texts.notification_invoice_sent";
|
||||
break;
|
||||
case 'reminder_endless':
|
||||
$this->template_subject = "texts.notification_invoice_reminder_endless_sent_subject";
|
||||
$this->template_body = "texts.notification_invoice_sent";
|
||||
break;
|
||||
case 'quote':
|
||||
$this->template_subject = "texts.notification_quote_sent_subject";
|
||||
$this->template_body = "texts.notification_quote_sent";
|
||||
break;
|
||||
case 'credit':
|
||||
$this->template_subject = "texts.notification_credit_sent_subject";
|
||||
$this->template_body = "texts.notification_credit_sent";
|
||||
break;
|
||||
|
||||
default:
|
||||
$this->template_subject = "texts.notification_invoice_sent_subject";
|
||||
$this->template_body = "texts.notification_invoice_sent";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private function getAmount()
|
||||
{
|
||||
return Number::formatMoney($this->entity->amount, $this->entity->client);
|
||||
@ -58,7 +108,7 @@ class EntitySentObject
|
||||
{
|
||||
return
|
||||
ctrans(
|
||||
"texts.notification_{$this->entity_type}_sent_subject",
|
||||
$this->template_subject,
|
||||
[
|
||||
'client' => $this->contact->present()->name(),
|
||||
'invoice' => $this->entity->number,
|
||||
@ -73,7 +123,7 @@ class EntitySentObject
|
||||
return [
|
||||
'title' => $this->getSubject(),
|
||||
'message' => ctrans(
|
||||
"texts.notification_{$this->entity_type}_sent",
|
||||
$this->template_body,
|
||||
[
|
||||
'amount' => $this->getAmount(),
|
||||
'client' => $this->contact->present()->name(),
|
||||
|
@ -52,7 +52,6 @@ class Credit extends BaseModel
|
||||
'terms',
|
||||
'public_notes',
|
||||
'private_notes',
|
||||
'invoice_type_id',
|
||||
'tax_name1',
|
||||
'tax_rate1',
|
||||
'tax_name2',
|
||||
|
@ -63,7 +63,6 @@ class Invoice extends BaseModel
|
||||
'terms',
|
||||
'public_notes',
|
||||
'private_notes',
|
||||
'invoice_type_id',
|
||||
'tax_name1',
|
||||
'tax_rate1',
|
||||
'tax_name2',
|
||||
@ -434,12 +433,11 @@ class Invoice extends BaseModel
|
||||
return $this->calc()->getTotal();
|
||||
}
|
||||
|
||||
|
||||
public function entityEmailEvent($invitation, $reminder_template)
|
||||
public function entityEmailEvent($invitation, $reminder_template, $template)
|
||||
{
|
||||
switch ($reminder_template) {
|
||||
case 'invoice':
|
||||
event(new InvoiceWasEmailed($invitation, $invitation->company, Ninja::eventVars()));
|
||||
event(new InvoiceWasEmailed($invitation, $invitation->company, Ninja::eventVars(), $template));
|
||||
break;
|
||||
case 'reminder1':
|
||||
event(new InvoiceReminderWasEmailed($invitation, $invitation->company, Ninja::eventVars(), Activity::INVOICE_REMINDER1_SENT));
|
||||
|
@ -52,7 +52,6 @@ class Quote extends BaseModel
|
||||
'public_notes',
|
||||
'private_notes',
|
||||
'project_id',
|
||||
'invoice_type_id',
|
||||
'tax_name1',
|
||||
'tax_rate1',
|
||||
'tax_name2',
|
||||
|
@ -226,6 +226,7 @@ class EventServiceProvider extends ServiceProvider
|
||||
],
|
||||
CreditWasUpdated::class => [
|
||||
UpdatedCreditActivity::class,
|
||||
CreateInvoicePdf::class,
|
||||
],
|
||||
CreditWasEmailedAndFailed::class => [
|
||||
],
|
||||
@ -334,6 +335,7 @@ class EventServiceProvider extends ServiceProvider
|
||||
],
|
||||
QuoteWasUpdated::class => [
|
||||
QuoteUpdatedActivity::class,
|
||||
CreateInvoicePdf::class,
|
||||
],
|
||||
QuoteWasEmailed::class => [
|
||||
QuoteEmailActivity::class,
|
||||
|
@ -66,7 +66,7 @@ class TriggeredActions extends AbstractService
|
||||
});
|
||||
|
||||
if ($this->invoice->invitations->count() > 0) {
|
||||
event(new InvoiceWasEmailed($this->invoice->invitations->first(), $this->invoice->company, Ninja::eventVars()));
|
||||
event(new InvoiceWasEmailed($this->invoice->invitations->first(), $this->invoice->company, Ninja::eventVars(), 'invoice'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ class GetQuotePdf extends AbstractService
|
||||
|
||||
$invitation = $this->quote->invitations->where('client_contact_id', $this->contact->id)->first();
|
||||
|
||||
$path = $this->quote->client->invoice_filepath();
|
||||
$path = $this->quote->client->quote_filepath();
|
||||
|
||||
$file_path = $path.$this->quote->number.'.pdf';
|
||||
|
||||
|
@ -58,9 +58,9 @@ class QuoteService
|
||||
return $this;
|
||||
}
|
||||
|
||||
$convert_quote = new ConvertQuote($this->quote->client);
|
||||
$convert_quote = (new ConvertQuote($this->quote->client))->run($this->quote);
|
||||
|
||||
$this->invoice = $convert_quote->run($this->quote);
|
||||
$this->invoice = $convert_quote;
|
||||
|
||||
$this->quote->fresh();
|
||||
|
||||
@ -96,9 +96,7 @@ class QuoteService
|
||||
|
||||
public function markSent() :self
|
||||
{
|
||||
$mark_sent = new MarkSent($this->quote->client, $this->quote);
|
||||
|
||||
$this->quote = $mark_sent->run();
|
||||
$this->quote = (new MarkSent($this->quote->client, $this->quote))->run();
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
@ -43,7 +43,6 @@ class InvoiceTransformer extends EntityTransformer
|
||||
'terms' => $invoice->terms ?: '',
|
||||
'public_notes' => $invoice->public_notes ?: '',
|
||||
'is_deleted' => (bool) $invoice->is_deleted,
|
||||
'invoice_type_id' => (int) $invoice->invoice_type_id,
|
||||
'tax_name1' => $invoice->tax_name1 ? $invoice->tax_name1 : '',
|
||||
'tax_rate1' => (float) $invoice->tax_rate1,
|
||||
'tax_name2' => $invoice->tax_name2 ? $invoice->tax_name2 : '',
|
||||
|
@ -22,9 +22,11 @@ trait SavesDocuments
|
||||
if ($entity instanceof Company) {
|
||||
$account = $entity->account;
|
||||
$company = $entity;
|
||||
$user = auth()->user();
|
||||
} else {
|
||||
$account = $entity->company->account;
|
||||
$company = $entity->company;
|
||||
$user = $entity->user;
|
||||
}
|
||||
|
||||
if (! $account->hasFeature(Account::FEATURE_DOCUMENTS)) {
|
||||
@ -35,8 +37,8 @@ trait SavesDocuments
|
||||
$document = UploadFile::dispatchNow(
|
||||
$document,
|
||||
UploadFile::DOCUMENT,
|
||||
$entity->user,
|
||||
$entity->company,
|
||||
$user,
|
||||
$company,
|
||||
$entity,
|
||||
null,
|
||||
$is_public
|
||||
@ -49,9 +51,11 @@ trait SavesDocuments
|
||||
if ($entity instanceof Company) {
|
||||
$account = $entity->account;
|
||||
$company = $entity;
|
||||
$user = auth()->user();
|
||||
} else {
|
||||
$account = $entity->company->account;
|
||||
$company = $entity->company;
|
||||
$user = $entity->user;
|
||||
}
|
||||
|
||||
if (! $account->hasFeature(Account::FEATURE_DOCUMENTS)) {
|
||||
@ -61,8 +65,8 @@ trait SavesDocuments
|
||||
$document = UploadFile::dispatchNow(
|
||||
$document,
|
||||
UploadFile::DOCUMENT,
|
||||
$entity->user,
|
||||
$entity->company,
|
||||
$user,
|
||||
$company,
|
||||
$entity,
|
||||
null,
|
||||
$is_public
|
||||
|
@ -3,7 +3,7 @@
|
||||
*
|
||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||
*
|
||||
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
|
||||
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
||||
*
|
||||
* @license https://opensource.org/licenses/AAL
|
||||
*/
|
||||
|
2
resources/js/clients/invoices/payment.js
vendored
2
resources/js/clients/invoices/payment.js
vendored
@ -3,7 +3,7 @@
|
||||
*
|
||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||
*
|
||||
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
|
||||
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
||||
*
|
||||
* @license https://opensource.org/licenses/AAL
|
||||
*/
|
||||
|
@ -3,7 +3,7 @@
|
||||
*
|
||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||
*
|
||||
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
|
||||
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
||||
*
|
||||
* @license https://opensource.org/licenses/AAL
|
||||
*/
|
||||
|
@ -3,7 +3,7 @@
|
||||
*
|
||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||
*
|
||||
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
|
||||
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
||||
*
|
||||
* @license https://opensource.org/licenses/AAL
|
||||
*/
|
||||
|
@ -3,7 +3,7 @@
|
||||
*
|
||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||
*
|
||||
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
|
||||
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
||||
*
|
||||
* @license https://opensource.org/licenses/AAL
|
||||
*/
|
||||
|
2
resources/js/clients/payments/stripe-ach.js
vendored
2
resources/js/clients/payments/stripe-ach.js
vendored
@ -3,7 +3,7 @@
|
||||
*
|
||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||
*
|
||||
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
|
||||
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
||||
*
|
||||
* @license https://opensource.org/licenses/AAL
|
||||
*/
|
||||
|
@ -3,7 +3,7 @@
|
||||
*
|
||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||
*
|
||||
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
|
||||
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
||||
*
|
||||
* @license https://opensource.org/licenses/AAL
|
||||
*/
|
||||
|
@ -3,7 +3,7 @@
|
||||
*
|
||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||
*
|
||||
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
|
||||
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
||||
*
|
||||
* @license https://opensource.org/licenses/AAL
|
||||
*/
|
||||
|
@ -3,7 +3,7 @@
|
||||
*
|
||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||
*
|
||||
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
|
||||
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
||||
*
|
||||
* @license https://opensource.org/licenses/AAL
|
||||
*/
|
||||
|
@ -3,7 +3,7 @@
|
||||
*
|
||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||
*
|
||||
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
|
||||
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
||||
*
|
||||
* @license https://opensource.org/licenses/AAL
|
||||
*/
|
||||
|
2
resources/js/clients/quotes/approve.js
vendored
2
resources/js/clients/quotes/approve.js
vendored
@ -3,7 +3,7 @@
|
||||
*
|
||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||
*
|
||||
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
|
||||
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
||||
*
|
||||
* @license https://opensource.org/licenses/AAL
|
||||
*/
|
||||
|
@ -3,7 +3,7 @@
|
||||
*
|
||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||
*
|
||||
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
|
||||
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
||||
*
|
||||
* @license https://opensource.org/licenses/AAL
|
||||
*/
|
||||
|
2
resources/js/clients/shared/pdf.js
vendored
2
resources/js/clients/shared/pdf.js
vendored
@ -3,7 +3,7 @@
|
||||
*
|
||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||
*
|
||||
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
|
||||
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
||||
*
|
||||
* @license https://opensource.org/licenses/AAL
|
||||
*/
|
||||
|
2
resources/js/setup/setup.js
vendored
2
resources/js/setup/setup.js
vendored
@ -3,7 +3,7 @@
|
||||
*
|
||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||
*
|
||||
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
|
||||
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
||||
*
|
||||
* @license https://opensource.org/licenses/AAL
|
||||
*/
|
||||
|
@ -3242,7 +3242,7 @@ return [
|
||||
|
||||
'checkout_com' => 'Checkout.com',
|
||||
|
||||
'footer_label' => 'Copyright © :year :company. All rights reserved.',
|
||||
'footer_label' => 'Copyright © :year :company.',
|
||||
|
||||
'credit_card_invalid' => 'Provided credit card number is not valid.',
|
||||
'month_invalid' => 'Provided month is not valid.',
|
||||
|
@ -8,9 +8,9 @@
|
||||
@endif
|
||||
|
||||
@if(strlen($client->getSetting('client_portal_privacy_policy')) > 1 && strlen($client->getSetting('client_portal_terms')) > 1)
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-minus">
|
||||
<!-- <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-minus">
|
||||
<line x1="5" y1="12" x2="19" y2="12"></line>
|
||||
</svg> <!-- Long dash between items. -->
|
||||
</svg> Long dash between items. -->
|
||||
@endif
|
||||
|
||||
@if(strlen($client->getSetting('client_portal_terms')) > 1)
|
||||
|
@ -2,7 +2,7 @@
|
||||
<div class="flex flex-col w-64">
|
||||
<div class="flex items-center h-16 flex-shrink-0 px-4 bg-primary-darken justify-center">
|
||||
<a href="{{ route('client.dashboard') }}">
|
||||
<img class="h-8 w-auto" src="{!! url('') . $settings->company_logo ?: asset('images/invoiceninja-white-logo.png') !!}" alt="{{ config('app.name') }}" />
|
||||
<img class="h-8 w-auto" src="{!! $settings->company_logo ? url('') . $settings->company_logo : asset('images/invoiceninja-white-logo.png') !!}" alt="{{ config('app.name') }}" />
|
||||
</a>
|
||||
</div>
|
||||
<div class="h-0 flex-1 flex flex-col overflow-y-auto">
|
||||
|
Loading…
x
Reference in New Issue
Block a user