mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -04:00
Merge branch 'v5-develop' into v5-2804-braintree
This commit is contained in:
commit
f07c911f8b
@ -69,8 +69,10 @@ class Kernel extends ConsoleKernel
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(config('queue.default') == 'database' && Ninja::isSelfHost()) {
|
if(config('queue.default') == 'database' && Ninja::isSelfHost()) {
|
||||||
|
|
||||||
$schedule->command('queue:work')->everyMinute()->withoutOverlapping();
|
$schedule->command('queue:work')->everyMinute()->withoutOverlapping();
|
||||||
$schedule->command('queue:restart')->everyFiveMinutes()->withoutOverlapping();
|
$schedule->command('queue:restart')->everyFiveMinutes()->withoutOverlapping();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
47
app/Events/RecurringInvoice/RecurringInvoiceWasArchived.php
Normal file
47
app/Events/RecurringInvoice/RecurringInvoiceWasArchived.php
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
<?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\Events\RecurringInvoice;
|
||||||
|
|
||||||
|
use App\Models\Company;
|
||||||
|
use App\Models\RecurringInvoice;
|
||||||
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class RecurringInvoiceWasArchived.
|
||||||
|
*/
|
||||||
|
class RecurringInvoiceWasArchived
|
||||||
|
{
|
||||||
|
use SerializesModels;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var Invoice
|
||||||
|
*/
|
||||||
|
public $recurring_invoice;
|
||||||
|
|
||||||
|
public $company;
|
||||||
|
|
||||||
|
public $event_vars;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new event instance.
|
||||||
|
*
|
||||||
|
* @param Invoice $recurring_invoice
|
||||||
|
* @param Company $company
|
||||||
|
* @param array $event_vars
|
||||||
|
*/
|
||||||
|
public function __construct(RecurringInvoice $recurring_invoice, Company $company, array $event_vars)
|
||||||
|
{
|
||||||
|
$this->recurring_invoice = $recurring_invoice;
|
||||||
|
$this->company = $company;
|
||||||
|
$this->event_vars = $event_vars;
|
||||||
|
}
|
||||||
|
}
|
47
app/Events/RecurringInvoice/RecurringInvoiceWasCreated.php
Normal file
47
app/Events/RecurringInvoice/RecurringInvoiceWasCreated.php
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
<?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\Events\RecurringInvoice;
|
||||||
|
|
||||||
|
use App\Models\Company;
|
||||||
|
use App\Models\RecurringInvoice;
|
||||||
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class RecurringInvoiceWasCreated.
|
||||||
|
*/
|
||||||
|
class RecurringInvoiceWasCreated
|
||||||
|
{
|
||||||
|
use SerializesModels;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var RecurringInvoice
|
||||||
|
*/
|
||||||
|
public $recurring_invoice;
|
||||||
|
|
||||||
|
public $company;
|
||||||
|
|
||||||
|
public $event_vars;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new event instance.
|
||||||
|
*
|
||||||
|
* @param RecurringInvoice $recurring_invoice
|
||||||
|
* @param Company $company
|
||||||
|
* @param array $event_vars
|
||||||
|
*/
|
||||||
|
public function __construct(RecurringInvoice $recurring_invoice, Company $company, array $event_vars)
|
||||||
|
{
|
||||||
|
$this->recurring_invoice = $recurring_invoice;
|
||||||
|
$this->company = $company;
|
||||||
|
$this->event_vars = $event_vars;
|
||||||
|
}
|
||||||
|
}
|
47
app/Events/RecurringInvoice/RecurringInvoiceWasDeleted.php
Normal file
47
app/Events/RecurringInvoice/RecurringInvoiceWasDeleted.php
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
<?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\Events\RecurringInvoice;
|
||||||
|
|
||||||
|
use App\Models\Company;
|
||||||
|
use App\Models\RecurringInvoice;
|
||||||
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class RecurringInvoiceWasDeleted.
|
||||||
|
*/
|
||||||
|
class RecurringInvoiceWasDeleted
|
||||||
|
{
|
||||||
|
use SerializesModels;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var RecurringInvoice
|
||||||
|
*/
|
||||||
|
public $recurring_invoice;
|
||||||
|
|
||||||
|
public $company;
|
||||||
|
|
||||||
|
public $event_vars;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new event instance.
|
||||||
|
*
|
||||||
|
* @param Invoice $invoice
|
||||||
|
* @param Company $company
|
||||||
|
* @param array $event_vars
|
||||||
|
*/
|
||||||
|
public function __construct(RecurringInvoice $recurring_invoice, Company $company, array $event_vars)
|
||||||
|
{
|
||||||
|
$this->recurring_invoice = $recurring_invoice;
|
||||||
|
$this->company = $company;
|
||||||
|
$this->event_vars = $event_vars;
|
||||||
|
}
|
||||||
|
}
|
51
app/Events/RecurringInvoice/RecurringInvoiceWasRestored.php
Normal file
51
app/Events/RecurringInvoice/RecurringInvoiceWasRestored.php
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
<?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\Events\RecurringInvoice;
|
||||||
|
|
||||||
|
use App\Models\Company;
|
||||||
|
use App\Models\RecurringInvoice;
|
||||||
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class RecurringInvoiceWasRestored.
|
||||||
|
*/
|
||||||
|
class RecurringInvoiceWasRestored
|
||||||
|
{
|
||||||
|
use SerializesModels;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var RecurringInvoice
|
||||||
|
*/
|
||||||
|
public $recurring_invoice;
|
||||||
|
|
||||||
|
public $fromDeleted;
|
||||||
|
|
||||||
|
public $company;
|
||||||
|
|
||||||
|
public $event_vars;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new event instance.
|
||||||
|
*
|
||||||
|
* @param Invoice $invoice
|
||||||
|
* @param $fromDeleted
|
||||||
|
* @param Company $company
|
||||||
|
* @param array $event_vars
|
||||||
|
*/
|
||||||
|
public function __construct(RecurringInvoice $recurring_invoice, $fromDeleted, Company $company, array $event_vars)
|
||||||
|
{
|
||||||
|
$this->recurring_invoice = $recurring_invoice;
|
||||||
|
$this->fromDeleted = $fromDeleted;
|
||||||
|
$this->company = $company;
|
||||||
|
$this->event_vars = $event_vars;
|
||||||
|
}
|
||||||
|
}
|
49
app/Events/RecurringInvoice/RecurringInvoiceWasUpdated.php
Normal file
49
app/Events/RecurringInvoice/RecurringInvoiceWasUpdated.php
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
<?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\Events\RecurringInvoice;
|
||||||
|
|
||||||
|
use App\Models\Company;
|
||||||
|
use App\Models\RecurringInvoice;
|
||||||
|
use Illuminate\Broadcasting\InteractsWithSockets;
|
||||||
|
use Illuminate\Foundation\Events\Dispatchable;
|
||||||
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class RecurringInvoiceWasUpdated.
|
||||||
|
*/
|
||||||
|
class RecurringInvoiceWasUpdated
|
||||||
|
{
|
||||||
|
use Dispatchable, InteractsWithSockets, SerializesModels;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var Invoice
|
||||||
|
*/
|
||||||
|
public $recurring_invoice;
|
||||||
|
|
||||||
|
public $company;
|
||||||
|
|
||||||
|
public $event_vars;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new event instance.
|
||||||
|
*
|
||||||
|
* @param RecurringInvoice $recurring_invoice
|
||||||
|
* @param Company $company
|
||||||
|
* @param array $event_vars
|
||||||
|
*/
|
||||||
|
public function __construct(RecurringInvoice $recurring_invoice, Company $company, array $event_vars)
|
||||||
|
{
|
||||||
|
$this->recurring_invoice = $recurring_invoice;
|
||||||
|
$this->company = $company;
|
||||||
|
$this->event_vars = $event_vars;
|
||||||
|
}
|
||||||
|
}
|
@ -30,6 +30,7 @@ function nlog($output, $context = []): void
|
|||||||
}
|
}
|
||||||
|
|
||||||
$trace = debug_backtrace();
|
$trace = debug_backtrace();
|
||||||
|
//nlog( debug_backtrace()[1]['function']);
|
||||||
// \Illuminate\Support\Facades\Log::channel('invoiceninja')->info(print_r($trace[1]['class'],1), []);
|
// \Illuminate\Support\Facades\Log::channel('invoiceninja')->info(print_r($trace[1]['class'],1), []);
|
||||||
\Illuminate\Support\Facades\Log::channel('invoiceninja')->info($output, $context);
|
\Illuminate\Support\Facades\Log::channel('invoiceninja')->info($output, $context);
|
||||||
|
|
||||||
|
@ -334,8 +334,6 @@ class BaseController extends Controller
|
|||||||
'company.task_statuses'=> function ($query) use ($updated_at, $user) {
|
'company.task_statuses'=> function ($query) use ($updated_at, $user) {
|
||||||
$query->where('updated_at', '>=', $updated_at);
|
$query->where('updated_at', '>=', $updated_at);
|
||||||
|
|
||||||
if(!$user->isAdmin())
|
|
||||||
$query->where('task_statuses.user_id', $user->id);
|
|
||||||
|
|
||||||
},
|
},
|
||||||
'company.activities'=> function ($query) use($user) {
|
'company.activities'=> function ($query) use($user) {
|
||||||
@ -518,9 +516,6 @@ class BaseController extends Controller
|
|||||||
'company.task_statuses'=> function ($query) use ($created_at, $user) {
|
'company.task_statuses'=> function ($query) use ($created_at, $user) {
|
||||||
$query->where('created_at', '>=', $created_at);
|
$query->where('created_at', '>=', $created_at);
|
||||||
|
|
||||||
if(!$user->isAdmin())
|
|
||||||
$query->where('task_statuses.user_id', $user->id);
|
|
||||||
|
|
||||||
},
|
},
|
||||||
'company.activities'=> function ($query) use($user) {
|
'company.activities'=> function ($query) use($user) {
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ class InvoiceController extends Controller
|
|||||||
];
|
];
|
||||||
|
|
||||||
if ($request->query('mode') === 'fullscreen') {
|
if ($request->query('mode') === 'fullscreen') {
|
||||||
return response()->file($invoice->pdf_file_path(null, 'path'));
|
return render('invoices.show-fullscreen', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->render('invoices.show', $data);
|
return $this->render('invoices.show', $data);
|
||||||
|
@ -44,7 +44,7 @@ class QuoteController extends Controller
|
|||||||
];
|
];
|
||||||
|
|
||||||
if ($request->query('mode') === 'fullscreen') {
|
if ($request->query('mode') === 'fullscreen') {
|
||||||
return response()->file($quote->pdf_file_path(null, 'path'));
|
return render('quotes.show-fullscreen', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->render('quotes.show', $data);
|
return $this->render('quotes.show', $data);
|
||||||
@ -76,9 +76,9 @@ class QuoteController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($quotes->count() == 1) {
|
if ($quotes->count() == 1) {
|
||||||
return response()->streamDownload(function () use ($invoices) {
|
return response()->streamDownload(function () use ($quotes) {
|
||||||
echo file_get_contents($invoices->first()->pdf_file_path());
|
echo file_get_contents($quotes->first()->pdf_file_path());
|
||||||
}, basename($invoices->first()->pdf_file_path()), ['Cache-Control:' => 'no-cache']);
|
}, basename($quotes->first()->pdf_file_path()), ['Cache-Control:' => 'no-cache']);
|
||||||
//return response()->download(TempFile::path($invoices->first()->pdf_file_path()), basename($quotes->first()->pdf_file_path()));
|
//return response()->download(TempFile::path($invoices->first()->pdf_file_path()), basename($quotes->first()->pdf_file_path()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,6 +11,8 @@
|
|||||||
|
|
||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Events\RecurringInvoice\RecurringInvoiceWasCreated;
|
||||||
|
use App\Events\RecurringInvoice\RecurringInvoiceWasUpdated;
|
||||||
use App\Factory\RecurringInvoiceFactory;
|
use App\Factory\RecurringInvoiceFactory;
|
||||||
use App\Filters\RecurringInvoiceFilters;
|
use App\Filters\RecurringInvoiceFilters;
|
||||||
use App\Http\Requests\RecurringInvoice\ActionRecurringInvoiceRequest;
|
use App\Http\Requests\RecurringInvoice\ActionRecurringInvoiceRequest;
|
||||||
@ -25,6 +27,7 @@ use App\Models\Account;
|
|||||||
use App\Models\RecurringInvoice;
|
use App\Models\RecurringInvoice;
|
||||||
use App\Repositories\RecurringInvoiceRepository;
|
use App\Repositories\RecurringInvoiceRepository;
|
||||||
use App\Transformers\RecurringInvoiceTransformer;
|
use App\Transformers\RecurringInvoiceTransformer;
|
||||||
|
use App\Utils\Ninja;
|
||||||
use App\Utils\Traits\MakesHash;
|
use App\Utils\Traits\MakesHash;
|
||||||
use App\Utils\Traits\SavesDocuments;
|
use App\Utils\Traits\SavesDocuments;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
@ -200,6 +203,8 @@ class RecurringInvoiceController extends BaseController
|
|||||||
{
|
{
|
||||||
$recurring_invoice = $this->recurring_invoice_repo->save($request->all(), RecurringInvoiceFactory::create(auth()->user()->company()->id, auth()->user()->id));
|
$recurring_invoice = $this->recurring_invoice_repo->save($request->all(), RecurringInvoiceFactory::create(auth()->user()->company()->id, auth()->user()->id));
|
||||||
|
|
||||||
|
event(new RecurringInvoiceWasCreated($recurring_invoice, $recurring_invoice->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));
|
||||||
|
|
||||||
return $this->itemResponse($recurring_invoice);
|
return $this->itemResponse($recurring_invoice);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -376,6 +381,8 @@ class RecurringInvoiceController extends BaseController
|
|||||||
|
|
||||||
$recurring_invoice->service()->deletePdf()->save();
|
$recurring_invoice->service()->deletePdf()->save();
|
||||||
|
|
||||||
|
event(new RecurringInvoiceWasUpdated($recurring_invoice, $recurring_invoice->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));
|
||||||
|
|
||||||
return $this->itemResponse($recurring_invoice);
|
return $this->itemResponse($recurring_invoice);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,12 +59,8 @@ class StripeConnectController extends BaseController
|
|||||||
|
|
||||||
$account = Account::create($data);
|
$account = Account::create($data);
|
||||||
|
|
||||||
nlog($account);
|
|
||||||
|
|
||||||
$link = Account::link($account->id, $token);
|
$link = Account::link($account->id, $token);
|
||||||
|
|
||||||
nlog($link);
|
|
||||||
|
|
||||||
if(!$company_gateway)
|
if(!$company_gateway)
|
||||||
$company_gateway = CompanyGatewayFactory::create($request->getCompany()->id, $request->getContact()->id);
|
$company_gateway = CompanyGatewayFactory::create($request->getCompany()->id, $request->getContact()->id);
|
||||||
|
|
||||||
|
@ -88,7 +88,9 @@ class RequiredClientInfo extends Component
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($this->updateClientDetails($data)) {
|
if ($this->updateClientDetails($data)) {
|
||||||
$this->emit('passed-required-fields-check');
|
$this->emit('passed-required-fields-check', [
|
||||||
|
'client_postal_code' => $this->contact->client->postal_code,
|
||||||
|
]);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -32,11 +32,14 @@ class CheckClientExistence
|
|||||||
->where('email', auth('contact')->user()->email)
|
->where('email', auth('contact')->user()->email)
|
||||||
->whereNotNull('email')
|
->whereNotNull('email')
|
||||||
->distinct('company_id')
|
->distinct('company_id')
|
||||||
|
->whereNotNull('company_id')
|
||||||
->whereHas('client', function ($query) {
|
->whereHas('client', function ($query) {
|
||||||
return $query->whereNull('deleted_at');
|
return $query->whereNull('deleted_at');
|
||||||
})
|
})
|
||||||
->get();
|
->get();
|
||||||
|
|
||||||
|
nlog($multiple_contacts);
|
||||||
|
|
||||||
if (count($multiple_contacts) == 0) {
|
if (count($multiple_contacts) == 0) {
|
||||||
Auth::logout();
|
Auth::logout();
|
||||||
|
|
||||||
|
@ -37,10 +37,6 @@ class ContactKeyLogin
|
|||||||
if (Auth::guard('contact')->check()) {
|
if (Auth::guard('contact')->check()) {
|
||||||
Auth::guard('contact')->logout();
|
Auth::guard('contact')->logout();
|
||||||
}
|
}
|
||||||
nlog("merp");
|
|
||||||
nlog($request->has('magic_link'));
|
|
||||||
nlog($request->input('magic_link'));
|
|
||||||
nlog($request->all());
|
|
||||||
|
|
||||||
if ($request->segment(3) && config('ninja.db.multi_db_enabled')) {
|
if ($request->segment(3) && config('ninja.db.multi_db_enabled')) {
|
||||||
if (MultiDB::findAndSetDbByContactKey($request->segment(3))) {
|
if (MultiDB::findAndSetDbByContactKey($request->segment(3))) {
|
||||||
@ -71,7 +67,6 @@ nlog($request->all());
|
|||||||
}
|
}
|
||||||
} elseif ($request->segment(2) && $request->segment(2) == 'magic_link' && $request->segment(3)) {
|
} elseif ($request->segment(2) && $request->segment(2) == 'magic_link' && $request->segment(3)) {
|
||||||
$contact_email = Cache::get($request->segment(3));
|
$contact_email = Cache::get($request->segment(3));
|
||||||
nlog("double merp");
|
|
||||||
if($client_contact = ClientContact::where('email', $contact_email)->first()){
|
if($client_contact = ClientContact::where('email', $contact_email)->first()){
|
||||||
Auth::guard('contact')->login($client_contact, true);
|
Auth::guard('contact')->login($client_contact, true);
|
||||||
|
|
||||||
@ -83,7 +78,6 @@ nlog("double merp");
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
nlog("exit");
|
|
||||||
|
|
||||||
return $next($request);
|
return $next($request);
|
||||||
}
|
}
|
||||||
|
@ -22,15 +22,6 @@ class Cors
|
|||||||
return Response::make('OK', 200, $headers);
|
return Response::make('OK', 200, $headers);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Work around for file downloads where the response cannot contain have headers set */
|
|
||||||
// if($request instanceOf BinaryFileResponse)
|
|
||||||
// return $next($request);
|
|
||||||
// else
|
|
||||||
// return $next($request)
|
|
||||||
// ->header('Access-Control-Allow-Origin', '*')
|
|
||||||
// ->header('Access-Control-Allow-Methods', 'GET, POST, PUT, DELETE, OPTIONS')
|
|
||||||
// ->header('Access-Control-Allow-Headers', 'X-API-SECRET,X-API-TOKEN,DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range');
|
|
||||||
|
|
||||||
$response = $next($request);
|
$response = $next($request);
|
||||||
|
|
||||||
$response->headers->set('Access-Control-Allow-Origin', '*');
|
$response->headers->set('Access-Control-Allow-Origin', '*');
|
||||||
|
@ -53,7 +53,6 @@ class QueryLogging
|
|||||||
$time = $timeEnd - $timeStart;
|
$time = $timeEnd - $timeStart;
|
||||||
|
|
||||||
nlog($request->method().' - '.urldecode($request->url()).": $count queries - ".$time);
|
nlog($request->method().' - '.urldecode($request->url()).": $count queries - ".$time);
|
||||||
// nlog($request->method().' - '.urldecode($request->fullUrl()).": $count queries - ".$time);
|
|
||||||
|
|
||||||
// if($count > 50)
|
// if($count > 50)
|
||||||
//nlog($queries);
|
//nlog($queries);
|
||||||
|
@ -13,7 +13,7 @@ class ShowCreditRequest extends FormRequest
|
|||||||
*/
|
*/
|
||||||
public function authorize()
|
public function authorize()
|
||||||
{
|
{
|
||||||
return true;
|
return !$this->credit->is_deleted;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -64,16 +64,6 @@ class StoreRecurringInvoiceRequest extends Request
|
|||||||
{
|
{
|
||||||
$input = $this->all();
|
$input = $this->all();
|
||||||
|
|
||||||
// foreach($this->input('documents') as $document)
|
|
||||||
// {
|
|
||||||
// if($document instanceof UploadedFile){
|
|
||||||
// nlog("i am an uploaded file");
|
|
||||||
// nlog($document);
|
|
||||||
// }
|
|
||||||
// else
|
|
||||||
// nlog($document);
|
|
||||||
// }
|
|
||||||
|
|
||||||
if (array_key_exists('design_id', $input) && is_string($input['design_id'])) {
|
if (array_key_exists('design_id', $input) && is_string($input['design_id'])) {
|
||||||
$input['design_id'] = $this->decodePrimaryKey($input['design_id']);
|
$input['design_id'] = $this->decodePrimaryKey($input['design_id']);
|
||||||
}
|
}
|
||||||
|
@ -59,10 +59,6 @@ class StoreUserRequest extends Request
|
|||||||
|
|
||||||
//unique user rule - check company_user table for user_id / company_id / account_id if none exist we can add the user. ELSE return false
|
//unique user rule - check company_user table for user_id / company_id / account_id if none exist we can add the user. ELSE return false
|
||||||
|
|
||||||
//nlog($this->all());
|
|
||||||
//nlog($this->input('company_user.account'));
|
|
||||||
// nlog($this->input('company_user.account.id'));
|
|
||||||
// nlog($this->input('company_user.account.id'));
|
|
||||||
|
|
||||||
if (isset($input['company_user'])) {
|
if (isset($input['company_user'])) {
|
||||||
if (! isset($input['company_user']['is_admin'])) {
|
if (! isset($input['company_user']['is_admin'])) {
|
||||||
|
@ -91,15 +91,15 @@ class StartMigration implements ShouldQueue
|
|||||||
$archive = $zip->open(public_path("storage/{$this->filepath}"));
|
$archive = $zip->open(public_path("storage/{$this->filepath}"));
|
||||||
$filename = pathinfo($this->filepath, PATHINFO_FILENAME);
|
$filename = pathinfo($this->filepath, PATHINFO_FILENAME);
|
||||||
|
|
||||||
if($this->company->id == $this->company->account->default_company_id)
|
// if($this->company->id == $this->company->account->default_company_id)
|
||||||
{
|
// {
|
||||||
$new_default_company = $this->company->account->companies->first();
|
// $new_default_company = $this->company->account->companies->first();
|
||||||
|
|
||||||
if ($new_default_company) {
|
// if ($new_default_company) {
|
||||||
$this->company->account->default_company_id = $new_default_company->id;
|
// $this->company->account->default_company_id = $new_default_company->id;
|
||||||
$this->company->account->save();
|
// $this->company->account->save();
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
$update_product_flag = $this->company->update_products;
|
$update_product_flag = $this->company->update_products;
|
||||||
|
|
||||||
@ -128,8 +128,8 @@ class StartMigration implements ShouldQueue
|
|||||||
|
|
||||||
Storage::deleteDirectory(public_path("storage/migrations/{$filename}"));
|
Storage::deleteDirectory(public_path("storage/migrations/{$filename}"));
|
||||||
|
|
||||||
$this->company->account->default_company_id = $this->company->id;
|
// $this->company->account->default_company_id = $this->company->id;
|
||||||
$this->company->account->save();
|
// $this->company->account->save();
|
||||||
|
|
||||||
$this->company->update_products = $update_product_flag;
|
$this->company->update_products = $update_product_flag;
|
||||||
$this->company->save();
|
$this->company->save();
|
||||||
|
@ -0,0 +1,54 @@
|
|||||||
|
<?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\Listeners\RecurringInvoice;
|
||||||
|
|
||||||
|
use App\Libraries\MultiDB;
|
||||||
|
use App\Models\Activity;
|
||||||
|
use App\Repositories\ActivityRepository;
|
||||||
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||||
|
use stdClass;
|
||||||
|
|
||||||
|
class CreateRecurringInvoiceActivity implements ShouldQueue
|
||||||
|
{
|
||||||
|
protected $activity_repo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create the event listener.
|
||||||
|
*
|
||||||
|
* @param ActivityRepository $activity_repo
|
||||||
|
*/
|
||||||
|
public function __construct(ActivityRepository $activity_repo)
|
||||||
|
{
|
||||||
|
$this->activity_repo = $activity_repo;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle the event.
|
||||||
|
*
|
||||||
|
* @param object $event
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function handle($event)
|
||||||
|
{
|
||||||
|
MultiDB::setDb($event->company->db);
|
||||||
|
|
||||||
|
$fields = new stdClass;
|
||||||
|
|
||||||
|
$fields->recurring_invoice_id = $event->recurring_invoice->id;
|
||||||
|
$fields->client_id = $event->recurring_invoice->client_id;
|
||||||
|
$fields->user_id = $event->recurring_invoice->user_id;
|
||||||
|
$fields->company_id = $event->recurring_invoice->company_id;
|
||||||
|
$fields->activity_type_id = Activity::CREATE_RECURRING_INVOICE;
|
||||||
|
|
||||||
|
$this->activity_repo->save($fields, $event->recurring_invoice, $event->event_vars);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,56 @@
|
|||||||
|
<?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\Listeners\RecurringInvoice;
|
||||||
|
|
||||||
|
use App\Libraries\MultiDB;
|
||||||
|
use App\Models\Activity;
|
||||||
|
use App\Repositories\ActivityRepository;
|
||||||
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||||
|
use stdClass;
|
||||||
|
|
||||||
|
class RecurringInvoiceArchivedActivity implements ShouldQueue
|
||||||
|
{
|
||||||
|
protected $activity_repo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create the event listener.
|
||||||
|
*
|
||||||
|
* @param ActivityRepository $activity_repo
|
||||||
|
*/
|
||||||
|
public function __construct(ActivityRepository $activity_repo)
|
||||||
|
{
|
||||||
|
$this->activity_repo = $activity_repo;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle the event.
|
||||||
|
*
|
||||||
|
* @param object $event
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function handle($event)
|
||||||
|
{
|
||||||
|
MultiDB::setDb($event->company->db);
|
||||||
|
|
||||||
|
$event->recurring_invoice->service()->deletePdf();
|
||||||
|
|
||||||
|
$fields = new stdClass;
|
||||||
|
|
||||||
|
$fields->recurring_invoice_id = $event->recurring_invoice->id;
|
||||||
|
$fields->client_id = $event->recurring_invoice->client_id;
|
||||||
|
$fields->user_id = $event->recurring_invoice->user_id;
|
||||||
|
$fields->company_id = $event->recurring_invoice->company_id;
|
||||||
|
$fields->activity_type_id = Activity::ARCHIVE_RECURRING_INVOICE;
|
||||||
|
|
||||||
|
$this->activity_repo->save($fields, $event->recurring_invoice, $event->event_vars);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,54 @@
|
|||||||
|
<?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\Listeners\RecurringInvoice;
|
||||||
|
|
||||||
|
use App\Libraries\MultiDB;
|
||||||
|
use App\Models\Activity;
|
||||||
|
use App\Repositories\ActivityRepository;
|
||||||
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||||
|
use stdClass;
|
||||||
|
|
||||||
|
class RecurringInvoiceDeletedActivity implements ShouldQueue
|
||||||
|
{
|
||||||
|
protected $activity_repo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create the event listener.
|
||||||
|
*
|
||||||
|
* @param ActivityRepository $activity_repo
|
||||||
|
*/
|
||||||
|
public function __construct(ActivityRepository $activity_repo)
|
||||||
|
{
|
||||||
|
$this->activity_repo = $activity_repo;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle the event.
|
||||||
|
*
|
||||||
|
* @param object $event
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function handle($event)
|
||||||
|
{
|
||||||
|
MultiDB::setDb($event->company->db);
|
||||||
|
|
||||||
|
$fields = new stdClass;
|
||||||
|
|
||||||
|
$fields->recurring_invoice_id = $event->recurring_invoice->id;
|
||||||
|
$fields->client_id = $event->recurring_invoice->client_id;
|
||||||
|
$fields->user_id = $event->recurring_invoice->user_id;
|
||||||
|
$fields->company_id = $event->recurring_invoice->company_id;
|
||||||
|
$fields->activity_type_id = Activity::DELETE_RECURRING_INVOICE;
|
||||||
|
|
||||||
|
$this->activity_repo->save($fields, $event->recurring_invoice, $event->event_vars);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,54 @@
|
|||||||
|
<?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\Listeners\RecurringInvoice;
|
||||||
|
|
||||||
|
use App\Libraries\MultiDB;
|
||||||
|
use App\Models\Activity;
|
||||||
|
use App\Repositories\ActivityRepository;
|
||||||
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||||
|
use stdClass;
|
||||||
|
|
||||||
|
class RecurringInvoiceRestoredActivity implements ShouldQueue
|
||||||
|
{
|
||||||
|
protected $activity_repo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create the event listener.
|
||||||
|
*
|
||||||
|
* @param ActivityRepository $activity_repo
|
||||||
|
*/
|
||||||
|
public function __construct(ActivityRepository $activity_repo)
|
||||||
|
{
|
||||||
|
$this->activity_repo = $activity_repo;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle the event.
|
||||||
|
*
|
||||||
|
* @param object $event
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function handle($event)
|
||||||
|
{
|
||||||
|
MultiDB::setDb($event->company->db);
|
||||||
|
|
||||||
|
$fields = new stdClass;
|
||||||
|
|
||||||
|
$fields->recurring_invoice_id = $event->recurring_invoice->id;
|
||||||
|
$fields->client_id = $event->recurring_invoice->client_id;
|
||||||
|
$fields->user_id = $event->recurring_invoice->user_id;
|
||||||
|
$fields->company_id = $event->recurring_invoice->company_id;
|
||||||
|
$fields->activity_type_id = Activity::RESTORE_RECURRING_INVOICE;
|
||||||
|
|
||||||
|
$this->activity_repo->save($fields, $event->recurring_invoice, $event->event_vars);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,54 @@
|
|||||||
|
<?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\Listeners\RecurringInvoice;
|
||||||
|
|
||||||
|
use App\Libraries\MultiDB;
|
||||||
|
use App\Models\Activity;
|
||||||
|
use App\Repositories\ActivityRepository;
|
||||||
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||||
|
use stdClass;
|
||||||
|
|
||||||
|
class UpdateRecurringInvoiceActivity implements ShouldQueue
|
||||||
|
{
|
||||||
|
protected $activity_repo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create the event listener.
|
||||||
|
*
|
||||||
|
* @param ActivityRepository $activity_repo
|
||||||
|
*/
|
||||||
|
public function __construct(ActivityRepository $activity_repo)
|
||||||
|
{
|
||||||
|
$this->activity_repo = $activity_repo;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle the event.
|
||||||
|
*
|
||||||
|
* @param object $event
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function handle($event)
|
||||||
|
{
|
||||||
|
MultiDB::setDB($event->company->db);
|
||||||
|
|
||||||
|
$fields = new stdClass;
|
||||||
|
|
||||||
|
$fields->client_id = $event->recurring_invoice->client_id;
|
||||||
|
$fields->user_id = $event->recurring_invoice->user_id;
|
||||||
|
$fields->company_id = $event->recurring_invoice->company_id;
|
||||||
|
$fields->activity_type_id = Activity::UPDATE_RECURRING_INVOICE;
|
||||||
|
$fields->recurring_invoice_id = $event->recurring_invoice->id;
|
||||||
|
|
||||||
|
$this->activity_repo->save($fields, $event->recurring_invoice, $event->event_vars);
|
||||||
|
}
|
||||||
|
}
|
@ -90,6 +90,12 @@ class Activity extends StaticModel
|
|||||||
const DELETE_SUBSCRIPTION = 83;
|
const DELETE_SUBSCRIPTION = 83;
|
||||||
const RESTORE_SUBSCRIPTION = 84;
|
const RESTORE_SUBSCRIPTION = 84;
|
||||||
|
|
||||||
|
const CREATE_RECURRING_INVOICE = 100;
|
||||||
|
const UPDATE_RECURRING_INVOICE = 101;
|
||||||
|
const ARCHIVE_RECURRING_INVOICE = 102;
|
||||||
|
const DELETE_RECURRING_INVOICE = 103;
|
||||||
|
const RESTORE_RECURRING_INVOICE = 104;
|
||||||
|
|
||||||
protected $casts = [
|
protected $casts = [
|
||||||
'is_system' => 'boolean',
|
'is_system' => 'boolean',
|
||||||
'updated_at' => 'timestamp',
|
'updated_at' => 'timestamp',
|
||||||
|
@ -157,6 +157,16 @@ class RecurringInvoice extends BaseModel
|
|||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function activities()
|
||||||
|
{
|
||||||
|
return $this->hasMany(Activity::class)->orderBy('id', 'DESC')->take(300);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function history()
|
||||||
|
{
|
||||||
|
return $this->hasManyThrough(Backup::class, Activity::class);
|
||||||
|
}
|
||||||
|
|
||||||
public function company()
|
public function company()
|
||||||
{
|
{
|
||||||
return $this->belongsTo(Company::class);
|
return $this->belongsTo(Company::class);
|
||||||
|
@ -68,6 +68,11 @@ use App\Events\Quote\QuoteWasEmailed;
|
|||||||
use App\Events\Quote\QuoteWasRestored;
|
use App\Events\Quote\QuoteWasRestored;
|
||||||
use App\Events\Quote\QuoteWasUpdated;
|
use App\Events\Quote\QuoteWasUpdated;
|
||||||
use App\Events\Quote\QuoteWasViewed;
|
use App\Events\Quote\QuoteWasViewed;
|
||||||
|
use App\Events\RecurringInvoice\RecurringInvoiceWasArchived;
|
||||||
|
use App\Events\RecurringInvoice\RecurringInvoiceWasCreated;
|
||||||
|
use App\Events\RecurringInvoice\RecurringInvoiceWasDeleted;
|
||||||
|
use App\Events\RecurringInvoice\RecurringInvoiceWasRestored;
|
||||||
|
use App\Events\RecurringInvoice\RecurringInvoiceWasUpdated;
|
||||||
use App\Events\Subscription\SubscriptionWasArchived;
|
use App\Events\Subscription\SubscriptionWasArchived;
|
||||||
use App\Events\Subscription\SubscriptionWasCreated;
|
use App\Events\Subscription\SubscriptionWasCreated;
|
||||||
use App\Events\Subscription\SubscriptionWasDeleted;
|
use App\Events\Subscription\SubscriptionWasDeleted;
|
||||||
@ -164,6 +169,11 @@ use App\Listeners\Quote\QuoteEmailedNotification;
|
|||||||
use App\Listeners\Quote\QuoteRestoredActivity;
|
use App\Listeners\Quote\QuoteRestoredActivity;
|
||||||
use App\Listeners\Quote\QuoteViewedActivity;
|
use App\Listeners\Quote\QuoteViewedActivity;
|
||||||
use App\Listeners\Quote\ReachWorkflowSettings;
|
use App\Listeners\Quote\ReachWorkflowSettings;
|
||||||
|
use App\Listeners\RecurringInvoice\CreateRecurringInvoiceActivity;
|
||||||
|
use App\Listeners\RecurringInvoice\RecurringInvoiceArchivedActivity;
|
||||||
|
use App\Listeners\RecurringInvoice\RecurringInvoiceDeletedActivity;
|
||||||
|
use App\Listeners\RecurringInvoice\RecurringInvoiceRestoredActivity;
|
||||||
|
use App\Listeners\RecurringInvoice\UpdateRecurringInvoiceActivity;
|
||||||
use App\Listeners\SendVerificationNotification;
|
use App\Listeners\SendVerificationNotification;
|
||||||
use App\Listeners\User\ArchivedUserActivity;
|
use App\Listeners\User\ArchivedUserActivity;
|
||||||
use App\Listeners\User\CreatedUserActivity;
|
use App\Listeners\User\CreatedUserActivity;
|
||||||
@ -400,6 +410,21 @@ class EventServiceProvider extends ServiceProvider
|
|||||||
QuoteWasRestored::class => [
|
QuoteWasRestored::class => [
|
||||||
QuoteRestoredActivity::class,
|
QuoteRestoredActivity::class,
|
||||||
],
|
],
|
||||||
|
RecurringInvoiceWasUpdated::class => [
|
||||||
|
UpdateRecurringInvoiceActivity::class,
|
||||||
|
],
|
||||||
|
RecurringInvoiceWasCreated::class => [
|
||||||
|
CreateRecurringInvoiceActivity::class,
|
||||||
|
],
|
||||||
|
RecurringInvoiceWasDeleted::class => [
|
||||||
|
RecurringInvoiceDeletedActivity::class,
|
||||||
|
],
|
||||||
|
RecurringInvoiceWasArchived::class => [
|
||||||
|
RecurringInvoiceArchivedActivity::class,
|
||||||
|
],
|
||||||
|
RecurringInvoiceWasRestored::class => [
|
||||||
|
RecurringInvoiceRestoredActivity::class,
|
||||||
|
],
|
||||||
TaskWasCreated::class => [
|
TaskWasCreated::class => [
|
||||||
CreatedTaskActivity::class,
|
CreatedTaskActivity::class,
|
||||||
],
|
],
|
||||||
|
@ -80,7 +80,11 @@ class ActivityRepository extends BaseRepository
|
|||||||
|
|
||||||
$backup = new Backup();
|
$backup = new Backup();
|
||||||
|
|
||||||
if (get_class($entity) == Invoice::class || get_class($entity) == Quote::class || get_class($entity) == Credit::class) {
|
if (get_class($entity) == Invoice::class
|
||||||
|
|| get_class($entity) == Quote::class
|
||||||
|
|| get_class($entity) == Credit::class
|
||||||
|
|| get_class($entity) == RecurringInvoice::class
|
||||||
|
) {
|
||||||
$contact = $entity->client->primary_contact()->first();
|
$contact = $entity->client->primary_contact()->first();
|
||||||
$backup->html_backup = $this->generateHtml($entity);
|
$backup->html_backup = $this->generateHtml($entity);
|
||||||
$backup->amount = $entity->amount;
|
$backup->amount = $entity->amount;
|
||||||
|
@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
class AddRecurringInvoiceIdToActivitiesTable extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::table('activities', function (Blueprint $table) {
|
||||||
|
$table->unsignedInteger('recurring_invoice_id')->nullable();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
2
public/flutter_service_worker.js
vendored
2
public/flutter_service_worker.js
vendored
@ -30,7 +30,7 @@ const RESOURCES = {
|
|||||||
"favicon.png": "dca91c54388f52eded692718d5a98b8b",
|
"favicon.png": "dca91c54388f52eded692718d5a98b8b",
|
||||||
"version.json": "7069906ad6cc610c71d600bca7105f49",
|
"version.json": "7069906ad6cc610c71d600bca7105f49",
|
||||||
"manifest.json": "ce1b79950eb917ea619a0a30da27c6a3",
|
"manifest.json": "ce1b79950eb917ea619a0a30da27c6a3",
|
||||||
"main.dart.js": "fd54043017e0f068af3799eeac80ee9f",
|
"main.dart.js": "d9423588e1972cdda4d056651bf3f84f",
|
||||||
"favicon.ico": "51636d3a390451561744c42188ccd628",
|
"favicon.ico": "51636d3a390451561744c42188ccd628",
|
||||||
"/": "23224b5e03519aaa87594403d54412cf"
|
"/": "23224b5e03519aaa87594403d54412cf"
|
||||||
};
|
};
|
||||||
|
File diff suppressed because one or more lines are too long
79231
public/main.dart.js
vendored
79231
public/main.dart.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
75325
public/main.foss.dart.js
vendored
75325
public/main.foss.dart.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -12,7 +12,7 @@
|
|||||||
"/js/clients/payments/checkout-credit-card.js": "/js/clients/payments/checkout-credit-card.js?id=98e406fa8e4db0e93427",
|
"/js/clients/payments/checkout-credit-card.js": "/js/clients/payments/checkout-credit-card.js?id=98e406fa8e4db0e93427",
|
||||||
"/js/clients/payments/stripe-ach.js": "/js/clients/payments/stripe-ach.js?id=76d8ba6a814b3015e359",
|
"/js/clients/payments/stripe-ach.js": "/js/clients/payments/stripe-ach.js?id=76d8ba6a814b3015e359",
|
||||||
"/js/clients/payments/stripe-alipay.js": "/js/clients/payments/stripe-alipay.js?id=7a4ce306366be98be5f7",
|
"/js/clients/payments/stripe-alipay.js": "/js/clients/payments/stripe-alipay.js?id=7a4ce306366be98be5f7",
|
||||||
"/js/clients/payments/stripe-credit-card.js": "/js/clients/payments/stripe-credit-card.js?id=2c828298b04fe30a4fe7",
|
"/js/clients/payments/stripe-credit-card.js": "/js/clients/payments/stripe-credit-card.js?id=5c762e4a21bdbce9c0c0",
|
||||||
"/js/clients/payments/stripe-sofort.js": "/js/clients/payments/stripe-sofort.js?id=282f5d57f1c1efe8f896",
|
"/js/clients/payments/stripe-sofort.js": "/js/clients/payments/stripe-sofort.js?id=282f5d57f1c1efe8f896",
|
||||||
"/js/clients/quotes/action-selectors.js": "/js/clients/quotes/action-selectors.js?id=1b8f9325aa6e8595e7fa",
|
"/js/clients/quotes/action-selectors.js": "/js/clients/quotes/action-selectors.js?id=1b8f9325aa6e8595e7fa",
|
||||||
"/js/clients/quotes/approve.js": "/js/clients/quotes/approve.js?id=85bcae0a646882e56b12",
|
"/js/clients/quotes/approve.js": "/js/clients/quotes/approve.js?id=85bcae0a646882e56b12",
|
||||||
|
@ -19,7 +19,7 @@ class StripeCreditCard {
|
|||||||
setupStripe() {
|
setupStripe() {
|
||||||
this.stripe = Stripe(this.key);
|
this.stripe = Stripe(this.key);
|
||||||
|
|
||||||
if(this.stripeConnect)
|
if (this.stripeConnect)
|
||||||
this.stripe.stripeAccount = this.stripeConnect;
|
this.stripe.stripeAccount = this.stripeConnect;
|
||||||
|
|
||||||
this.elements = this.stripe.elements();
|
this.elements = this.stripe.elements();
|
||||||
@ -28,7 +28,11 @@ class StripeCreditCard {
|
|||||||
}
|
}
|
||||||
|
|
||||||
createElement() {
|
createElement() {
|
||||||
this.cardElement = this.elements.create('card');
|
this.cardElement = this.elements.create('card', {
|
||||||
|
value: {
|
||||||
|
postalCode: document.querySelector('meta[name=client-postal-code]').content,
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
@ -206,7 +210,11 @@ const secret =
|
|||||||
const onlyAuthorization =
|
const onlyAuthorization =
|
||||||
document.querySelector('meta[name="only-authorization"]').content ?? '';
|
document.querySelector('meta[name="only-authorization"]').content ?? '';
|
||||||
|
|
||||||
const stripeConnect =
|
const stripeConnect =
|
||||||
document.querySelector('meta[name="stripe-account-id"]').content;
|
document.querySelector('meta[name="stripe-account-id"]').content;
|
||||||
|
|
||||||
new StripeCreditCard(publishableKey, secret, onlyAuthorization, stripeConnect).handle();
|
let s = new StripeCreditCard(publishableKey, secret, onlyAuthorization, stripeConnect);
|
||||||
|
|
||||||
|
s.handle();
|
||||||
|
|
||||||
|
Livewire.on('passed-required-fields-check', () => s.handle());
|
||||||
|
@ -4239,9 +4239,13 @@ $LANG = array(
|
|||||||
'max_companies_desc' => 'You have reached your maximum number of companies. Delete existing companies to migrate new ones.',
|
'max_companies_desc' => 'You have reached your maximum number of companies. Delete existing companies to migrate new ones.',
|
||||||
'migration_already_completed' => 'Company already migrated',
|
'migration_already_completed' => 'Company already migrated',
|
||||||
'migration_already_completed_desc' => 'Looks like you already migrated <b> :company_name </b>to the V5 version of the Invoice Ninja. In case you want to start over, you can force migrate to wipe existing data.',
|
'migration_already_completed_desc' => 'Looks like you already migrated <b> :company_name </b>to the V5 version of the Invoice Ninja. In case you want to start over, you can force migrate to wipe existing data.',
|
||||||
|
|
||||||
'payment_method_cannot_be_authorized_first' => 'This payment method can be can saved for future use, once you complete your first transaction. Don\'t forget to check "Store credit card details" during payment process.',
|
'payment_method_cannot_be_authorized_first' => 'This payment method can be can saved for future use, once you complete your first transaction. Don\'t forget to check "Store credit card details" during payment process.',
|
||||||
'new_account' => 'New account',
|
'new_account' => 'New account',
|
||||||
|
'activity_100' => ':user created recurring invoice :recurring_invoice',
|
||||||
|
'activity_101' => ':user updated recurring invoice :recurring_invoice',
|
||||||
|
'activity_102' => ':user archived recurring invoice :recurring_invoice',
|
||||||
|
'activity_103' => ':user deleted recurring invoice :recurring_invoice',
|
||||||
|
'activity_104' => ':user restored recurring invoice :recurring_invoice',
|
||||||
);
|
);
|
||||||
|
|
||||||
return $LANG;
|
return $LANG;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<footer class="app-footer">
|
<footer class="app-footer">
|
||||||
<div class="ml-auto">
|
<div class="ml-auto">
|
||||||
<span>Powered by</span>
|
<span>Powered by</span>
|
||||||
<a href="https://invoiceninja.com">InvoiceNinja</a> © 2018 Invoice Ninja LLC.
|
<a href="https://invoiceninja.com">InvoiceNinja</a> © 2021 Invoice Ninja LLC.
|
||||||
</div>
|
</div>
|
||||||
</footer>
|
</footer>
|
||||||
|
|
||||||
|
@ -5,6 +5,8 @@
|
|||||||
<meta name="stripe-account-id" content="{{ $gateway->company_gateway->getConfigField('account_id') }}">
|
<meta name="stripe-account-id" content="{{ $gateway->company_gateway->getConfigField('account_id') }}">
|
||||||
<meta name="stripe-secret" content="{{ $intent->client_secret }}">
|
<meta name="stripe-secret" content="{{ $intent->client_secret }}">
|
||||||
<meta name="only-authorization" content="">
|
<meta name="only-authorization" content="">
|
||||||
|
|
||||||
|
<meta name="client-postal-code" content="{{ $client->postal_code ?? '' }}">
|
||||||
@endsection
|
@endsection
|
||||||
|
|
||||||
@section('gateway_content')
|
@section('gateway_content')
|
||||||
@ -58,6 +60,14 @@
|
|||||||
@endsection
|
@endsection
|
||||||
|
|
||||||
@section('gateway_footer')
|
@section('gateway_footer')
|
||||||
|
<script>
|
||||||
|
Livewire.on('passed-required-fields-check', (event) => {
|
||||||
|
if (event.hasOwnProperty('client_postal_code')) {
|
||||||
|
document.querySelector('meta[name=client-postal-code]').content = event.client_postal_code;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
<script src="https://js.stripe.com/v3/"></script>
|
<script src="https://js.stripe.com/v3/"></script>
|
||||||
<script src="{{ asset('js/clients/payments/stripe-credit-card.js') }}"></script>
|
<script src="{{ asset('js/clients/payments/stripe-credit-card.js') }}"></script>
|
||||||
@endsection
|
@endsection
|
||||||
|
@ -0,0 +1,2 @@
|
|||||||
|
<iframe src="{{ $invoice->pdf_file_path() }}"
|
||||||
|
style="position:fixed; top:0; left:0; bottom:0; right:0; width:100%; height:100%; border:none; margin:0; padding:0; overflow:hidden; z-index:999999;"></iframe>
|
@ -1,8 +1,9 @@
|
|||||||
<form action="{{ route('client.quotes.bulk') }}" method="post" onsubmit="return confirm('{{ ctrans('texts.quote_approval_confirmation_label') }}')">
|
<form action="{{ route('client.quotes.bulk') }}" method="post" id="approve-form" />
|
||||||
@csrf
|
@csrf
|
||||||
<input type="hidden" name="action" value="approve">
|
<input type="hidden" name="action" value="approve">
|
||||||
<input type="hidden" name="process" value="true">
|
<input type="hidden" name="process" value="true">
|
||||||
<input type="hidden" name="quotes[]" value="{{ $quote->hashed_id }}">
|
<input type="hidden" name="quotes[]" value="{{ $quote->hashed_id }}">
|
||||||
|
<input type="hidden" name="signature">
|
||||||
|
|
||||||
<div class="bg-white shadow sm:rounded-lg">
|
<div class="bg-white shadow sm:rounded-lg">
|
||||||
<div class="px-4 py-5 sm:p-6">
|
<div class="px-4 py-5 sm:p-6">
|
||||||
@ -16,10 +17,11 @@
|
|||||||
|
|
||||||
<div class="inline-flex rounded-md shadow-sm">
|
<div class="inline-flex rounded-md shadow-sm">
|
||||||
<input type="hidden" name="action" value="payment">
|
<input type="hidden" name="action" value="payment">
|
||||||
<button class="button button-primary bg-primary">{{ ctrans('texts.approve') }}</button>
|
<button type="button" class="button button-primary bg-primary" id="approve-button">{{ ctrans('texts.approve') }}</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
@ -0,0 +1,2 @@
|
|||||||
|
<iframe src="{{ $quote->pdf_file_path() }}"
|
||||||
|
style="position:fixed; top:0; left:0; bottom:0; right:0; width:100%; height:100%; border:none; margin:0; padding:0; overflow:hidden; z-index:999999;"></iframe>
|
@ -4,6 +4,11 @@
|
|||||||
@push('head')
|
@push('head')
|
||||||
<meta name="pdf-url" content="{{ asset($quote->pdf_file_path()) }}">
|
<meta name="pdf-url" content="{{ asset($quote->pdf_file_path()) }}">
|
||||||
<script src="{{ asset('js/vendor/pdf.js/pdf.min.js') }}"></script>
|
<script src="{{ asset('js/vendor/pdf.js/pdf.min.js') }}"></script>
|
||||||
|
|
||||||
|
<meta name="show-quote-terms" content="{{ $settings->show_accept_quote_terms ? true : false }}">
|
||||||
|
<meta name="require-quote-signature" content="{{ $client->company->account->hasFeature(\App\Models\Account::FEATURE_INVOICE_SETTINGS) && $settings->require_quote_signature }}">
|
||||||
|
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/signature_pad@2.3.2/dist/signature_pad.min.js"></script>
|
||||||
@endpush
|
@endpush
|
||||||
|
|
||||||
@section('body')
|
@section('body')
|
||||||
@ -74,8 +79,12 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<iframe src="{{ $quote->pdf_file_path() }}" class="h-screen w-full border-0 hidden lg:block mt-4"></iframe>
|
<iframe src="{{ $quote->pdf_file_path() }}" class="h-screen w-full border-0 hidden lg:block mt-4"></iframe>
|
||||||
|
|
||||||
|
@include('portal.ninja2020.invoices.includes.terms', ['entities' => [$quote], 'entity_type' => ctrans('texts.quote')])
|
||||||
|
@include('portal.ninja2020.invoices.includes.signature')
|
||||||
@endsection
|
@endsection
|
||||||
|
|
||||||
@section('footer')
|
@section('footer')
|
||||||
|
<script src="{{ asset('js/clients/quotes/approve.js') }}"></script>
|
||||||
<script src="{{ asset('js/clients/shared/pdf.js') }}"></script>
|
<script src="{{ asset('js/clients/shared/pdf.js') }}"></script>
|
||||||
@endsection
|
@endsection
|
||||||
|
@ -41,6 +41,11 @@ use App\Events\Quote\QuoteWasCreated;
|
|||||||
use App\Events\Quote\QuoteWasDeleted;
|
use App\Events\Quote\QuoteWasDeleted;
|
||||||
use App\Events\Quote\QuoteWasRestored;
|
use App\Events\Quote\QuoteWasRestored;
|
||||||
use App\Events\Quote\QuoteWasUpdated;
|
use App\Events\Quote\QuoteWasUpdated;
|
||||||
|
use App\Events\RecurringInvoice\RecurringInvoiceWasArchived;
|
||||||
|
use App\Events\RecurringInvoice\RecurringInvoiceWasCreated;
|
||||||
|
use App\Events\RecurringInvoice\RecurringInvoiceWasDeleted;
|
||||||
|
use App\Events\RecurringInvoice\RecurringInvoiceWasRestored;
|
||||||
|
use App\Events\RecurringInvoice\RecurringInvoiceWasUpdated;
|
||||||
use App\Events\Subscription\SubscriptionWasArchived;
|
use App\Events\Subscription\SubscriptionWasArchived;
|
||||||
use App\Events\Subscription\SubscriptionWasCreated;
|
use App\Events\Subscription\SubscriptionWasCreated;
|
||||||
use App\Events\Subscription\SubscriptionWasDeleted;
|
use App\Events\Subscription\SubscriptionWasDeleted;
|
||||||
@ -68,6 +73,7 @@ use App\Utils\Traits\MakesHash;
|
|||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||||
use Illuminate\Routing\Middleware\ThrottleRequests;
|
use Illuminate\Routing\Middleware\ThrottleRequests;
|
||||||
|
use Illuminate\Validation\ValidationException;
|
||||||
use Tests\MockAccountData;
|
use Tests\MockAccountData;
|
||||||
use Tests\TestCase;
|
use Tests\TestCase;
|
||||||
|
|
||||||
@ -538,6 +544,76 @@ class EventTest extends TestCase
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public function testRecurringInvoiceEvents()
|
||||||
|
{
|
||||||
|
/* Test fire new invoice */
|
||||||
|
$data = [
|
||||||
|
'client_id' => $this->client->hashed_id,
|
||||||
|
'number' => 'dudex',
|
||||||
|
'frequency_id' => 1,
|
||||||
|
];
|
||||||
|
|
||||||
|
$this->expectsEvents([
|
||||||
|
RecurringInvoiceWasCreated::class,
|
||||||
|
RecurringInvoiceWasUpdated::class,
|
||||||
|
RecurringInvoiceWasArchived::class,
|
||||||
|
RecurringInvoiceWasRestored::class,
|
||||||
|
RecurringInvoiceWasDeleted::class,
|
||||||
|
]);
|
||||||
|
|
||||||
|
try {
|
||||||
|
$response = $this->withHeaders([
|
||||||
|
'X-API-SECRET' => config('ninja.api_secret'),
|
||||||
|
'X-API-TOKEN' => $this->token,
|
||||||
|
])->post('/api/v1/recurring_invoices/', $data);
|
||||||
|
} catch (ValidationException $e) {
|
||||||
|
$message = json_decode($e->validator->getMessageBag(), 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
$response->assertStatus(200);
|
||||||
|
|
||||||
|
|
||||||
|
$arr = $response->json();
|
||||||
|
|
||||||
|
$data = [
|
||||||
|
'client_id' => $this->client->hashed_id,
|
||||||
|
'number' => 'dude2',
|
||||||
|
'frequency_id' => 1,
|
||||||
|
];
|
||||||
|
|
||||||
|
$response = $this->withHeaders([
|
||||||
|
'X-API-SECRET' => config('ninja.api_secret'),
|
||||||
|
'X-API-TOKEN' => $this->token,
|
||||||
|
])->put('/api/v1/recurring_invoices/' . $arr['data']['id'], $data)
|
||||||
|
->assertStatus(200);
|
||||||
|
|
||||||
|
|
||||||
|
$data = [
|
||||||
|
'ids' => [$arr['data']['id']],
|
||||||
|
];
|
||||||
|
|
||||||
|
$response = $this->withHeaders([
|
||||||
|
'X-API-SECRET' => config('ninja.api_secret'),
|
||||||
|
'X-API-TOKEN' => $this->token,
|
||||||
|
])->post('/api/v1/recurring_invoices/bulk?action=archive', $data)
|
||||||
|
->assertStatus(200);
|
||||||
|
|
||||||
|
$response = $this->withHeaders([
|
||||||
|
'X-API-SECRET' => config('ninja.api_secret'),
|
||||||
|
'X-API-TOKEN' => $this->token,
|
||||||
|
])->post('/api/v1/recurring_invoices/bulk?action=restore', $data)
|
||||||
|
->assertStatus(200);
|
||||||
|
|
||||||
|
$response = $this->withHeaders([
|
||||||
|
'X-API-SECRET' => config('ninja.api_secret'),
|
||||||
|
'X-API-TOKEN' => $this->token,
|
||||||
|
])->post('/api/v1/recurring_invoices/bulk?action=delete', $data)
|
||||||
|
->assertStatus(200);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public function testClientEvents()
|
public function testClientEvents()
|
||||||
{
|
{
|
||||||
$this->expectsEvents([
|
$this->expectsEvents([
|
||||||
|
Loading…
x
Reference in New Issue
Block a user