Merge branch 'v5-develop' into v5-stable

This commit is contained in:
David Bomba 2021-04-21 20:16:33 +10:00
commit ae35a1ed26
113 changed files with 391339 additions and 382013 deletions

View File

@ -48,11 +48,12 @@ jobs:
run: |
sudo rm -rf bootstrap/cache/*
sudo rm -rf node_modules
- name: Prune Git History
run: |
sudo git gc
sudo git gc --aggressive
sudo git prune
sudo rm -rf .git
# - name: Prune Git History
# run: |
# sudo git gc
# sudo git gc --aggressive
# sudo git prune
- name: Build project # This would actually build your project, using zip for an example artifact
run: |
zip -r ./invoiceninja.zip .* -x "../*"

View File

@ -1,6 +1,14 @@
# Release notes
## [Unreleased (daily channel)](https://github.com/invoiceninja/invoiceninja/tree/v5-develop)
## Fixed:
- Refactor of e-mail templates
- Client portal: Invoices & recurring invoices are now sorted by date (by default)
## Added:
- Public notes of entities will now show in #footer section of designs (previously totals table).
## [v5.1.47-release](https://github.com/invoiceninja/invoiceninja/releases/tag/v5.1.47-release)
### Added:
- Subscriptions are now going to show the frequency in the table (#5412)

View File

@ -1 +1 @@
5.1.44
5.1.49

View File

@ -32,6 +32,7 @@ use App\Models\Expense;
use App\Models\Product;
use App\Models\Project;
use App\Models\Quote;
use App\Models\RecurringInvoice;
use App\Models\Task;
use App\Models\User;
use App\Models\Vendor;
@ -227,9 +228,19 @@ class CreateSingleAccount extends Command
'user_id' => $user->id,
'company_id' => $company->id,
'product_key' => 'enterprise_plan',
'notes' => 'The Pro Plan',
'cost' => 10,
'price' => 10,
'notes' => 'The Enterprise Plan',
'cost' => 14,
'price' => 14,
'quantity' => 1,
]);
$p3 = Product::factory()->create([
'user_id' => $user->id,
'company_id' => $company->id,
'product_key' => 'free_plan',
'notes' => 'The Free Plan',
'cost' => 0,
'price' => 0,
'quantity' => 1,
]);
@ -245,6 +256,7 @@ class CreateSingleAccount extends Command
$sub->recurring_product_ids = "{$p1->hashed_id}";
$sub->webhook_configuration = $webhook_config;
$sub->allow_plan_changes = true;
$sub->frequency_id = RecurringInvoice::FREQUENCY_MONTHLY;
$sub->save();
$sub = SubscriptionFactory::create($company->id, $user->id);
@ -253,6 +265,16 @@ class CreateSingleAccount extends Command
$sub->recurring_product_ids = "{$p2->hashed_id}";
$sub->webhook_configuration = $webhook_config;
$sub->allow_plan_changes = true;
$sub->frequency_id = RecurringInvoice::FREQUENCY_MONTHLY;
$sub->save();
$sub = SubscriptionFactory::create($company->id, $user->id);
$sub->name = "Free Plan";
$sub->group_id = $gs->id;
$sub->recurring_product_ids = "{$p3->hashed_id}";
$sub->webhook_configuration = $webhook_config;
$sub->allow_plan_changes = true;
$sub->frequency_id = RecurringInvoice::FREQUENCY_MONTHLY;
$sub->save();
}

View File

@ -33,6 +33,7 @@ use App\Models\Project;
use App\Models\Quote;
use App\Models\RecurringInvoice;
use App\Models\Task;
use App\Models\TaskStatus;
use App\Models\User;
use App\Models\Vendor;
use App\Models\VendorContact;
@ -353,6 +354,8 @@ class DemoMode extends Command
'client_id' => $client->id
]);
$task->status_id = TaskStatus::all()->random()->id;
$task->number = $this->getNextTaskNumber($task);
$task->save();
@ -388,20 +391,20 @@ class DemoMode extends Command
$invoice->line_items = $this->buildLineItems(rand(1, 10));
$invoice->uses_inclusive_taxes = false;
if (rand(0, 1)) {
$invoice->tax_name1 = 'GST';
$invoice->tax_rate1 = 10.00;
}
// if (rand(0, 1)) {
// $invoice->tax_name1 = 'GST';
// $invoice->tax_rate1 = 10.00;
// }
if (rand(0, 1)) {
$invoice->tax_name2 = 'VAT';
$invoice->tax_rate2 = 17.50;
}
// if (rand(0, 1)) {
// $invoice->tax_name2 = 'VAT';
// $invoice->tax_rate2 = 17.50;
// }
if (rand(0, 1)) {
$invoice->tax_name3 = 'CA Sales Tax';
$invoice->tax_rate3 = 5;
}
// if (rand(0, 1)) {
// $invoice->tax_name3 = 'CA Sales Tax';
// $invoice->tax_rate3 = 5;
// }
// $invoice->custom_value1 = $faker->date;
// $invoice->custom_value2 = rand(0, 1) ? 'yes' : 'no';
@ -455,20 +458,20 @@ class DemoMode extends Command
$invoice->line_items = $this->buildLineItems(rand(1, 10));
$invoice->uses_inclusive_taxes = false;
if (rand(0, 1)) {
$invoice->tax_name1 = 'GST';
$invoice->tax_rate1 = 10.00;
}
// if (rand(0, 1)) {
// $invoice->tax_name1 = 'GST';
// $invoice->tax_rate1 = 10.00;
// }
if (rand(0, 1)) {
$invoice->tax_name2 = 'VAT';
$invoice->tax_rate2 = 17.50;
}
// if (rand(0, 1)) {
// $invoice->tax_name2 = 'VAT';
// $invoice->tax_rate2 = 17.50;
// }
if (rand(0, 1)) {
$invoice->tax_name3 = 'CA Sales Tax';
$invoice->tax_rate3 = 5;
}
// if (rand(0, 1)) {
// $invoice->tax_name3 = 'CA Sales Tax';
// $invoice->tax_rate3 = 5;
// }
// $invoice->custom_value1 = $faker->date;
// $invoice->custom_value2 = rand(0, 1) ? 'yes' : 'no';
@ -504,20 +507,20 @@ class DemoMode extends Command
$credit->line_items = $this->buildLineItems(rand(1, 10));
$credit->uses_inclusive_taxes = false;
if (rand(0, 1)) {
$credit->tax_name1 = 'GST';
$credit->tax_rate1 = 10.00;
}
// if (rand(0, 1)) {
// $credit->tax_name1 = 'GST';
// $credit->tax_rate1 = 10.00;
// }
if (rand(0, 1)) {
$credit->tax_name2 = 'VAT';
$credit->tax_rate2 = 17.50;
}
// if (rand(0, 1)) {
// $credit->tax_name2 = 'VAT';
// $credit->tax_rate2 = 17.50;
// }
if (rand(0, 1)) {
$credit->tax_name3 = 'CA Sales Tax';
$credit->tax_rate3 = 5;
}
// if (rand(0, 1)) {
// $credit->tax_name3 = 'CA Sales Tax';
// $credit->tax_rate3 = 5;
// }
$credit->save();
@ -559,20 +562,20 @@ class DemoMode extends Command
$quote->line_items = $this->buildLineItems(rand(1, 10));
$quote->uses_inclusive_taxes = false;
if (rand(0, 1)) {
$quote->tax_name1 = 'GST';
$quote->tax_rate1 = 10.00;
}
// if (rand(0, 1)) {
// $quote->tax_name1 = 'GST';
// $quote->tax_rate1 = 10.00;
// }
if (rand(0, 1)) {
$quote->tax_name2 = 'VAT';
$quote->tax_rate2 = 17.50;
}
// if (rand(0, 1)) {
// $quote->tax_name2 = 'VAT';
// $quote->tax_rate2 = 17.50;
// }
if (rand(0, 1)) {
$quote->tax_name3 = 'CA Sales Tax';
$quote->tax_rate3 = 5;
}
// if (rand(0, 1)) {
// $quote->tax_name3 = 'CA Sales Tax';
// $quote->tax_rate3 = 5;
// }
$quote->save();
@ -600,20 +603,20 @@ class DemoMode extends Command
$item->quantity = 1;
//$item->cost = 10;
if (rand(0, 1)) {
$item->tax_name1 = 'GST';
$item->tax_rate1 = 10.00;
}
// if (rand(0, 1)) {
// $item->tax_name1 = 'GST';
// $item->tax_rate1 = 10.00;
// }
if (rand(0, 1)) {
$item->tax_name1 = 'VAT';
$item->tax_rate1 = 17.50;
}
// if (rand(0, 1)) {
// $item->tax_name1 = 'VAT';
// $item->tax_rate1 = 17.50;
// }
if (rand(0, 1)) {
$item->tax_name1 = 'Sales Tax';
$item->tax_rate1 = 5;
}
// if (rand(0, 1)) {
// $item->tax_name1 = 'Sales Tax';
// $item->tax_rate1 = 5;
// }
$product = Product::all()->random();

View File

@ -68,6 +68,11 @@ class Kernel extends ConsoleKernel
}
if(config('queue.default') == 'database' && Ninja::isSelfHost()) {
$schedule->command('queue:work')->everyMinute()->withoutOverlapping();
$schedule->command('queue:restart')->everyFiveMinutes()->withoutOverlapping();
}
}
/**

View File

@ -0,0 +1,31 @@
<?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\Factory;
use App\Models\ClientGatewayToken;
use Illuminate\Support\Str;
class ClientGatewayTokenFactory
{
public static function create(int $company_id) :ClientGatewayToken
{
$client_gateway_token = new ClientGatewayToken;
$client_gateway_token->company_id = $company_id;
$client_gateway_token->is_default = false;
$client_gateway_token->meta = '';
$client_gateway_token->is_deleted = false;
$client_gateway_token->token = '';
$client_gateway_token->routing_number = '';
return $client_gateway_token;
}
}

View File

@ -22,6 +22,7 @@ class TaskStatusFactory
$task_status->company_id = $company_id;
$task_status->name = '';
$task_status->color = '#fff';
$task_status->status_order = 9999;
return $task_status;
}

View File

@ -0,0 +1,437 @@
<?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 App\Events\ClientGatewayToken\ClientGatewayTokenWasCreated;
use App\Events\ClientGatewayToken\ClientGatewayTokenWasUpdated;
use App\Factory\ClientGatewayTokenFactory;
use App\Filters\ClientGatewayTokenFilters;
use App\Http\Requests\ClientGatewayToken\CreateClientGatewayTokenRequest;
use App\Http\Requests\ClientGatewayToken\DestroyClientGatewayTokenRequest;
use App\Http\Requests\ClientGatewayToken\EditClientGatewayTokenRequest;
use App\Http\Requests\ClientGatewayToken\ShowClientGatewayTokenRequest;
use App\Http\Requests\ClientGatewayToken\StoreClientGatewayTokenRequest;
use App\Http\Requests\ClientGatewayToken\UpdateClientGatewayTokenRequest;
use App\Http\Requests\ClientGatewayToken\UploadClientGatewayTokenRequest;
use App\Jobs\ClientGatewayToken\StoreClientGatewayToken;
use App\Jobs\ClientGatewayToken\UpdateClientGatewayToken;
use App\Models\Account;
use App\Models\ClientGatewayToken;
use App\Repositories\ClientGatewayTokenRepository;
use App\Transformers\ClientGatewayTokenTransformer;
use App\Utils\Ninja;
use App\Utils\Traits\BulkOptions;
use App\Utils\Traits\MakesHash;
use App\Utils\Traits\SavesDocuments;
use App\Utils\Traits\Uploadable;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
/**
* Class ClientGatewayTokenController.
* @covers App\Http\Controllers\ClientGatewayTokenController
*/
class ClientGatewayTokenController extends BaseController
{
use MakesHash;
use Uploadable;
use BulkOptions;
use SavesDocuments;
protected $entity_type = ClientGatewayToken::class;
protected $entity_transformer = ClientGatewayTokenTransformer::class;
/**
* @var ClientGatewayTokenRepository
*/
protected $client_gateway_token_gateway_token_repo;
/**
* ClientGatewayTokenController constructor.
* @param ClientGatewayTokenRepository $client_gateway_token_gateway_token_repo
*/
public function __construct(ClientGatewayTokenRepository $client_gateway_token_gateway_token_repo)
{
parent::__construct();
$this->client_gateway_token_repo = $client_gateway_token_gateway_token_repo;
}
/**
* @OA\Get(
* path="/api/v1/client_gateway_tokens",
* operationId="getClientGatewayTokens",
* tags={"client_gateway_tokens"},
* summary="Gets a list of client_gateway_tokens",
* description="Lists client_gateway_tokens, search and filters allow fine grained lists to be generated.
Query parameters can be added to performed more fine grained filtering of the client_gateway_tokens, these are handled by the ClientGatewayTokenFilters class which defines the methods available",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
* @OA\Parameter(ref="#/components/parameters/index"),
* @OA\Response(
* response=200,
* description="A list of client_gateway_tokens",
* @OA\Header(header="X-MINIMUM-CLIENT-VERSION", ref="#/components/headers/X-MINIMUM-CLIENT-VERSION"),
* @OA\Header(header="X-RateLimit-Remaining", ref="#/components/headers/X-RateLimit-Remaining"),
* @OA\Header(header="X-RateLimit-Limit", ref="#/components/headers/X-RateLimit-Limit"),
* @OA\JsonContent(ref="#/components/schemas/ClientGatewayToken"),
* ),
* @OA\Response(
* response=422,
* description="Validation error",
* @OA\JsonContent(ref="#/components/schemas/ValidationError"),
* ),
* @OA\Response(
* response="default",
* description="Unexpected Error",
* @OA\JsonContent(ref="#/components/schemas/Error"),
* ),
* )
* @param ClientGatewayTokenFilters $filters
* @return Response|mixed
*/
public function index(Request $request)
{
$client_gateway_token_gateway_tokens = ClientGatewayToken::scope();
return $this->listResponse($client_gateway_token_gateway_tokens);
}
/**
* Display the specified resource.
*
* @param ShowClientGatewayTokenRequest $request
* @param ClientGatewayToken $client_gateway_token
* @return Response
*
*
* @OA\Get(
* path="/api/v1/client_gateway_tokens/{id}",
* operationId="showClientGatewayToken",
* tags={"client_gateway_tokens"},
* summary="Shows a client",
* description="Displays a client by id",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
* @OA\Parameter(
* name="id",
* in="path",
* description="The ClientGatewayToken Hashed ID",
* example="D2J234DFA",
* required=true,
* @OA\Schema(
* type="string",
* format="string",
* ),
* ),
* @OA\Response(
* response=200,
* description="Returns the cl.ient object",
* @OA\Header(header="X-MINIMUM-CLIENT-VERSION", ref="#/components/headers/X-MINIMUM-CLIENT-VERSION"),
* @OA\Header(header="X-RateLimit-Remaining", ref="#/components/headers/X-RateLimit-Remaining"),
* @OA\Header(header="X-RateLimit-Limit", ref="#/components/headers/X-RateLimit-Limit"),
* @OA\JsonContent(ref="#/components/schemas/ClientGatewayToken"),
* ),
* @OA\Response(
* response=422,
* description="Validation error",
* @OA\JsonContent(ref="#/components/schemas/ValidationError"),
*
* ),
* @OA\Response(
* response="default",
* description="Unexpected Error",
* @OA\JsonContent(ref="#/components/schemas/Error"),
* ),
* )
*/
public function show(ShowClientGatewayTokenRequest $request, ClientGatewayToken $client_gateway_token)
{
return $this->itemResponse($client_gateway_token);
}
/**
* Show the form for editing the specified resource.
*
* @param EditClientGatewayTokenRequest $request
* @param ClientGatewayToken $client_gateway_token
* @return Response
*
*
* @OA\Get(
* path="/api/v1/client_gateway_tokens/{id}/edit",
* operationId="editClientGatewayToken",
* tags={"client_gateway_tokens"},
* summary="Shows a client for editting",
* description="Displays a client by id",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
* @OA\Parameter(
* name="id",
* in="path",
* description="The ClientGatewayToken Hashed ID",
* example="D2J234DFA",
* required=true,
* @OA\Schema(
* type="string",
* format="string",
* ),
* ),
* @OA\Response(
* response=200,
* description="Returns the client object",
* @OA\Header(header="X-MINIMUM-CLIENT-VERSION", ref="#/components/headers/X-MINIMUM-CLIENT-VERSION"),
* @OA\Header(header="X-RateLimit-Remaining", ref="#/components/headers/X-RateLimit-Remaining"),
* @OA\Header(header="X-RateLimit-Limit", ref="#/components/headers/X-RateLimit-Limit"),
* @OA\JsonContent(ref="#/components/schemas/ClientGatewayToken"),
* ),
* @OA\Response(
* response=422,
* description="Validation error",
* @OA\JsonContent(ref="#/components/schemas/ValidationError"),
*
* ),
* @OA\Response(
* response="default",
* description="Unexpected Error",
* @OA\JsonContent(ref="#/components/schemas/Error"),
* ),
* )
*/
public function edit(EditClientGatewayTokenRequest $request, ClientGatewayToken $client_gateway_token)
{
return $this->itemResponse($client_gateway_token);
}
/**
* Update the specified resource in storage.
*
* @param UpdateClientGatewayTokenRequest $request
* @param ClientGatewayToken $client_gateway_token
* @return Response
*
*
*
* @OA\Put(
* path="/api/v1/client_gateway_tokens/{id}",
* operationId="updateClientGatewayToken",
* tags={"client_gateway_tokens"},
* summary="Updates a client",
* description="Handles the updating of a client by id",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
* @OA\Parameter(
* name="id",
* in="path",
* description="The ClientGatewayToken Hashed ID",
* example="D2J234DFA",
* required=true,
* @OA\Schema(
* type="string",
* format="string",
* ),
* ),
* @OA\Response(
* response=200,
* description="Returns the client object",
* @OA\Header(header="X-MINIMUM-CLIENT-VERSION", ref="#/components/headers/X-MINIMUM-CLIENT-VERSION"),
* @OA\Header(header="X-RateLimit-Remaining", ref="#/components/headers/X-RateLimit-Remaining"),
* @OA\Header(header="X-RateLimit-Limit", ref="#/components/headers/X-RateLimit-Limit"),
* @OA\JsonContent(ref="#/components/schemas/ClientGatewayToken"),
* ),
* @OA\Response(
* response=422,
* description="Validation error",
* @OA\JsonContent(ref="#/components/schemas/ValidationError"),
*
* ),
* @OA\Response(
* response="default",
* description="Unexpected Error",
* @OA\JsonContent(ref="#/components/schemas/Error"),
* ),
* )
*/
public function update(UpdateClientGatewayTokenRequest $request, ClientGatewayToken $client_gateway_token)
{
$client_gateway_token = $this->client_gateway_token_repo->save($request->all(), $client_gateway_token);
return $this->itemResponse($client_gateway_token->fresh());
}
/**
* Show the form for creating a new resource.
*
* @param CreateClientGatewayTokenRequest $request
* @return Response
*
*
*
* @OA\Get(
* path="/api/v1/client_gateway_tokens/create",
* operationId="getClientGatewayTokensCreate",
* tags={"client_gateway_tokens"},
* summary="Gets a new blank client object",
* description="Returns a blank object with default values",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
* @OA\Response(
* response=200,
* description="A blank client object",
* @OA\Header(header="X-MINIMUM-CLIENT-VERSION", ref="#/components/headers/X-MINIMUM-CLIENT-VERSION"),
* @OA\Header(header="X-RateLimit-Remaining", ref="#/components/headers/X-RateLimit-Remaining"),
* @OA\Header(header="X-RateLimit-Limit", ref="#/components/headers/X-RateLimit-Limit"),
* @OA\JsonContent(ref="#/components/schemas/ClientGatewayToken"),
* ),
* @OA\Response(
* response=422,
* description="Validation error",
* @OA\JsonContent(ref="#/components/schemas/ValidationError"),
*
* ),
* @OA\Response(
* response="default",
* description="Unexpected Error",
* @OA\JsonContent(ref="#/components/schemas/Error"),
* ),
* )
*/
public function create(CreateClientGatewayTokenRequest $request)
{
$client_gateway_token = ClientGatewayTokenFactory::create(auth()->user()->company()->id);
$client_gateway_token = $this->client_gateway_token_repo->save($request->all(), $client_gateway_token);
return $this->itemResponse($client_gateway_token);
}
/**
* Store a newly created resource in storage.
*
* @param StoreClientGatewayTokenRequest $request
* @return Response
*
*
*
* @OA\Post(
* path="/api/v1/client_gateway_tokens",
* operationId="storeClientGatewayToken",
* tags={"client_gateway_tokens"},
* summary="Adds a client",
* description="Adds an client to a company",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
* @OA\Response(
* response=200,
* description="Returns the saved client object",
* @OA\Header(header="X-MINIMUM-CLIENT-VERSION", ref="#/components/headers/X-MINIMUM-CLIENT-VERSION"),
* @OA\Header(header="X-RateLimit-Remaining", ref="#/components/headers/X-RateLimit-Remaining"),
* @OA\Header(header="X-RateLimit-Limit", ref="#/components/headers/X-RateLimit-Limit"),
* @OA\JsonContent(ref="#/components/schemas/ClientGatewayToken"),
* ),
* @OA\Response(
* response=422,
* description="Validation error",
* @OA\JsonContent(ref="#/components/schemas/ValidationError"),
*
* ),
* @OA\Response(
* response="default",
* description="Unexpected Error",
* @OA\JsonContent(ref="#/components/schemas/Error"),
* ),
* )
*/
public function store(StoreClientGatewayTokenRequest $request)
{
$client_gateway_token = ClientGatewayTokenFactory::create(auth()->user()->company()->id);
$client_gateway_token = $this->client_gateway_token_repo->save($request->all(), $client_gateway_token);
return $this->itemResponse($client_gateway_token);
}
/**
* Remove the specified resource from storage.
*
* @param DestroyClientGatewayTokenRequest $request
* @param ClientGatewayToken $client_gateway_token
* @return Response
*
*
* @throws \Exception
* @OA\Delete(
* path="/api/v1/client_gateway_tokens/{id}",
* operationId="deleteClientGatewayToken",
* tags={"client_gateway_tokens"},
* summary="Deletes a client",
* description="Handles the deletion of a client by id",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
* @OA\Parameter(
* name="id",
* in="path",
* description="The ClientGatewayToken Hashed ID",
* example="D2J234DFA",
* required=true,
* @OA\Schema(
* type="string",
* format="string",
* ),
* ),
* @OA\Response(
* response=200,
* description="Returns a HTTP status",
* @OA\Header(header="X-MINIMUM-CLIENT-VERSION", ref="#/components/headers/X-MINIMUM-CLIENT-VERSION"),
* @OA\Header(header="X-RateLimit-Remaining", ref="#/components/headers/X-RateLimit-Remaining"),
* @OA\Header(header="X-RateLimit-Limit", ref="#/components/headers/X-RateLimit-Limit"),
* ),
* @OA\Response(
* response=422,
* description="Validation error",
* @OA\JsonContent(ref="#/components/schemas/ValidationError"),
*
* ),
* @OA\Response(
* response="default",
* description="Unexpected Error",
* @OA\JsonContent(ref="#/components/schemas/Error"),
* ),
* )
*/
public function destroy(DestroyClientGatewayTokenRequest $request, ClientGatewayToken $client_gateway_token)
{
$this->client_gateway_token_repo->delete($client_gateway_token);
return $this->itemResponse($client_gateway_token->fresh());
}
}

View File

@ -23,6 +23,7 @@ use App\Models\Invoice;
use App\Models\Payment;
use App\Models\PaymentHash;
use App\Models\SystemLog;
use App\Services\Subscription\SubscriptionService;
use App\Utils\Number;
use App\Utils\Traits\MakesDates;
use App\Utils\Traits\MakesHash;
@ -342,6 +343,12 @@ class PaymentController extends Controller
$payment = $payment->service()->applyCredits($payment_hash)->save();
if (property_exists($payment_hash->data, 'billing_context')) {
$billing_subscription = \App\Models\Subscription::find($payment_hash->data->billing_context->subscription_id);
return (new SubscriptionService($billing_subscription))->completePurchase($payment_hash);
}
return redirect()->route('client.payments.show', ['payment' => $this->encodePrimaryKey($payment->id)]);
}

View File

@ -17,6 +17,7 @@ use App\Http\Requests\ClientPortal\Subscriptions\ShowPlanSwitchRequest;
use App\Models\RecurringInvoice;
use App\Models\Subscription;
use Illuminate\Http\Request;
use Illuminate\Support\Str;
class SubscriptionPlanSwitchController extends Controller
{
@ -30,11 +31,10 @@ class SubscriptionPlanSwitchController extends Controller
*/
public function index(ShowPlanSwitchRequest $request, RecurringInvoice $recurring_invoice, Subscription $target)
{
$amount = $recurring_invoice->subscription
->service()
->calculateUpgradePrice($recurring_invoice, $target);
/**
*
* Null value here is a proxy for

View File

@ -482,9 +482,9 @@ class CompanyController extends BaseController
$company_user->user->forceDelete();
});
if (Ninja::isHosted()) {
RefundCancelledAccount::dispatchNow($account);
}
// if (Ninja::isHosted()) {
// RefundCancelledAccount::dispatchNow($account);
// }
$account->delete();

View File

@ -81,6 +81,7 @@ class LicenseController extends BaseController
*/
public function index()
{
$this->checkLicense();
/* Catch claim license requests */
if (config('ninja.environment') == 'selfhost' && request()->has('license_key')) {
@ -140,4 +141,15 @@ class LicenseController extends BaseController
return response()->json($error, 400);
}
private function checkLicense()
{
$account = auth()->user()->company()->account;
if($account->plan == 'white_label' && $account->plan_expires->lt(now())){
$account->plan = null;
$account->plan_expires = null;
$account->save();
}
}
}

View File

@ -165,6 +165,10 @@ class MigrationController extends BaseController
{
$company->clients()->forceDelete();
$company->products()->forceDelete();
$company->projects()->forceDelete();
$company->tasks()->forceDelete();
$company->vendors()->forceDelete();
$company->expenses()->forceDelete();
$company->save();

View File

@ -72,8 +72,8 @@ class OneTimeTokenController extends BaseController
$data = [
'user_id' => auth()->user()->id,
'company_key'=> auth()->company()->company_key,
'context' => $requst->input('context'),
'company_key'=> auth()->user()->company()->company_key,
'context' => $request->input('context'),
];
Cache::put( $hash, $data, 3600 );

View File

@ -592,7 +592,7 @@ class PaymentController extends BaseController
$this->payment_repo->restore($payment);
if (! $bulk) {
return $this->listResponse($payment);
return $this->itemResponse($payment);
}
break;
@ -600,7 +600,7 @@ class PaymentController extends BaseController
$this->payment_repo->archive($payment);
if (! $bulk) {
return $this->listResponse($payment);
return $this->itemResponse($payment);
}
// code...
break;
@ -608,14 +608,26 @@ class PaymentController extends BaseController
$this->payment_repo->delete($payment);
if (! $bulk) {
return $this->listResponse($payment);
return $this->itemResponse($payment);
}
// code...
break;
case 'email':
//dispatch email to queue
break;
$payment->service()->sendEmail();
if (! $bulk) {
return $this->itemResponse($payment);
}
break;
case 'email_receipt':
$this->payment->service()->sendEmail();
if (! $bulk) {
return $this->itemResponse($payment);
}
break;
default:
// code...
break;
@ -671,6 +683,8 @@ class PaymentController extends BaseController
{
$payment = $request->payment();
// nlog($request->all());
$payment = $payment->refund($request->all());
return $this->itemResponse($payment);

View File

@ -85,7 +85,6 @@ class SelfUpdateController extends BaseController
Artisan::call('clear-compiled');
Artisan::call('cache:clear');
Artisan::call('debugbar:clear');
Artisan::call('route:clear');
Artisan::call('view:clear');
Artisan::call('config:clear');
@ -96,10 +95,17 @@ class SelfUpdateController extends BaseController
private function testWritable()
{
$directoryIterator = new \RecursiveDirectoryIterator(base_path());
$directoryIterator = new \RecursiveDirectoryIterator(base_path(), \RecursiveDirectoryIterator::SKIP_DOTS);
foreach (new \RecursiveIteratorIterator($directoryIterator) as $file) {
if(strpos($file->getPathname(), '.git') !== false)
continue;
// nlog($file->getPathname());
if ($file->isFile() && ! $file->isWritable()) {
throw new FilePermissionsFailure($file);
return false;
}
}

View File

@ -19,11 +19,13 @@ use App\Http\Requests\Task\CreateTaskRequest;
use App\Http\Requests\Task\DestroyTaskRequest;
use App\Http\Requests\Task\EditTaskRequest;
use App\Http\Requests\Task\ShowTaskRequest;
use App\Http\Requests\Task\SortTaskRequest;
use App\Http\Requests\Task\StoreTaskRequest;
use App\Http\Requests\Task\UpdateTaskRequest;
use App\Http\Requests\Task\UploadTaskRequest;
use App\Models\Account;
use App\Models\Task;
use App\Models\TaskStatus;
use App\Repositories\TaskRepository;
use App\Transformers\TaskTransformer;
use App\Utils\Ninja;
@ -279,8 +281,8 @@ class TaskController extends BaseController
$task = $this->task_repo->save($request->all(), $task);
// if($task->status_order != $old_task->status_order)
// $this->task_repo->sortStatuses($old_task, $task);
if($task->status_order != $old_task->status_order)
$this->task_repo->sortStatuses($old_task, $task);
event(new TaskWasUpdated($task, $task->company, Ninja::eventVars(auth()->user()->id)));
@ -579,4 +581,88 @@ class TaskController extends BaseController
return $this->itemResponse($task->fresh());
}
/**
* Store a newly created resource in storage.
*
* @param StoreTaskRequest $request
* @return Response
*
*
*
* @OA\Post(
* path="/api/v1/tasks/stort",
* operationId="sortTasks",
* tags={"tasks"},
* summary="Sort tasks on KanBan",
* description="Sorts tasks after drag and drop on the KanBan.",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
* @OA\Response(
* response=200,
* description="Returns an Ok, 200 HTTP status",
* @OA\Header(header="X-MINIMUM-CLIENT-VERSION", ref="#/components/headers/X-MINIMUM-CLIENT-VERSION"),
* @OA\Header(header="X-RateLimit-Remaining", ref="#/components/headers/X-RateLimit-Remaining"),
* @OA\Header(header="X-RateLimit-Limit", ref="#/components/headers/X-RateLimit-Limit"),
* ),
* @OA\Response(
* response=422,
* description="Validation error",
* @OA\JsonContent(ref="#/components/schemas/ValidationError"),
*
* ),
* @OA\Response(
* response="default",
* description="Unexpected Error",
* @OA\JsonContent(ref="#/components/schemas/Error"),
* ),
* )
*/
public function sort(SortTaskRequest $request)
{
$task_statuses = $request->input('status_ids');
$tasks = $request->input('task_ids');
collect($task_statuses)->each(function ($task_status_hashed_id, $key){
$task_status = TaskStatus::where('id', $this->decodePrimaryKey($task_status_hashed_id))
->where('company_id', auth()->user()->company()->id)
->first();
$task_status->status_order = $key;
$task_status->save();
});
foreach($tasks as $key => $task_list)
{
$sort_status_id = $this->decodePrimaryKey($key);
// nlog($task_list);
foreach ($task_list as $key => $task)
{
// nlog($task);
$task_record = Task::where('id', $this->decodePrimaryKey($task))
->where('company_id', auth()->user()->company()->id)
->first();
// nlog($task_record->id);
$task_record->status_order = $key;
$task_record->status_id = $sort_status_id;
$task_record->save();
}
}
return response()->json(['message' => 'Ok'],200);
}
}

View File

@ -8,6 +8,7 @@ use App\Http\Requests\TaskStatus\DestroyTaskStatusRequest;
use App\Http\Requests\TaskStatus\ShowTaskStatusRequest;
use App\Http\Requests\TaskStatus\StoreTaskStatusRequest;
use App\Http\Requests\TaskStatus\UpdateTaskStatusRequest;
use App\Models\Task;
use App\Models\TaskStatus;
use App\Repositories\TaskStatusRepository;
use App\Transformers\TaskStatusTransformer;
@ -398,9 +399,10 @@ class TaskStatusController extends BaseController
*/
public function destroy(DestroyTaskStatusRequest $request, TaskStatus $task_status)
{
$task_status->delete();
return $this->itemResponse($task_status->fresh());
$task_status = $this->task_status_repo->delete($task_status);
return $this->itemResponse($task_status);
}
/**

View File

@ -11,11 +11,14 @@
namespace App\Http\Controllers;
use App\Utils\Ninja;
use App\Utils\TemplateEngine;
use App\Utils\Traits\MakesHash;
use App\Utils\Traits\MakesInvoiceHtml;
use App\Utils\Traits\MakesTemplateData;
use Illuminate\Http\Response;
use Illuminate\Support\Facades\App;
use Illuminate\Support\Facades\Lang;
class TemplateController extends BaseController
{
@ -89,7 +92,7 @@ class TemplateController extends BaseController
$subject = request()->has('subject') ? request()->input('subject') : '';
$body = request()->has('body') ? request()->input('body') : '';
$template = request()->has('template') ? request()->input('template') : '';
$data = (new TemplateEngine($body, $subject, $entity, $entity_id, $template))->build();
return response()->json($data, 200);

View File

@ -43,6 +43,15 @@ trait VerifiesUserEmail
$user->confirmation_code = null;
$user->save();
if(isset($user->oauth_user_id)){
return $this->render('auth.confirmed', [
'root' => 'themes',
'message' => ctrans('texts.security_confirmation'),
]);
}
if (is_null($user->password) || empty($user->password) || Hash::check('', $user->password)) {
return $this->render('auth.confirmation_with_password', ['root' => 'themes', 'user_id' => $user->hashed_id]);
}

View File

@ -112,6 +112,7 @@ class BillingPortalPurchase extends Component
'show_loading_bar' => false,
'not_eligible' => null,
'not_eligible_message' => null,
'payment_required' => true,
];
/**
@ -269,8 +270,11 @@ class BillingPortalPurchase extends Component
return $this;
}
$this->steps['fetched_payment_methods'] = true;
if((int)$this->subscription->price == 0)
$this->steps['payment_required'] = false;
else
$this->steps['fetched_payment_methods'] = true;
$this->methods = $contact->client->service()->getPaymentMethods($this->price);
@ -326,9 +330,9 @@ class BillingPortalPurchase extends Component
$is_eligible = $this->subscription->service()->isEligible($this->contact);
if (is_array($is_eligible)) {
if ($is_eligible['exception']['message'] != 'Success') {
$this->steps['not_eligible'] = true;
$this->steps['not_eligible_message'] = $is_eligible['exception'];
$this->steps['not_eligible_message'] = $is_eligible['exception']['message'];
$this->steps['show_loading_bar'] = false;
return;
@ -339,6 +343,7 @@ class BillingPortalPurchase extends Component
'email' => $this->email ?? $this->contact->email,
'client_id' => $this->contact->client->id,
'invoice_id' => $this->invoice->id,
'context' => 'purchase',
now()->addMinutes(60)]
);
@ -356,6 +361,30 @@ class BillingPortalPurchase extends Component
'email' => $this->email ?? $this->contact->email,
'quantity' => $this->quantity,
'contact_id' => $this->contact->id,
'client_id' => $this->contact->client->id,
]);
}
public function handlePaymentNotRequired()
{
$is_eligible = $this->subscription->service()->isEligible($this->contact);
if ($is_eligible['status_code'] != 200) {
$this->steps['not_eligible'] = true;
$this->steps['not_eligible_message'] = $is_eligible['exception']['message'];
$this->steps['show_loading_bar'] = false;
return;
}
return $this->subscription->service()->handleNoPaymentRequired([
'email' => $this->email ?? $this->contact->email,
'quantity' => $this->quantity,
'contact_id' => $this->contact->id,
'client_id' => $this->contact->client->id,
'coupon' => '',
]);
}

View File

@ -29,6 +29,8 @@ class InvoicesTable extends Component
public function mount()
{
$this->sort_asc = false;
$this->sort_field = 'date';
}
public function render()

View File

@ -25,7 +25,7 @@ class RecurringInvoiceCancellation extends Component
public function processCancellation()
{
if ($this->invoice->subscription) {
return $this->invoice->subscription->service()->handleCancellation();
return $this->invoice->subscription->service()->handleCancellation($this->invoice);
}
return redirect()->route('client.recurring_invoices.request_cancellation', ['recurring_invoice' => $this->invoice->hashed_id]);

View File

@ -23,6 +23,13 @@ class RecurringInvoicesTable extends Component
public $per_page = 10;
public function mount()
{
$this->sort_asc = false;
$this->sort_field = 'date';
}
public function render()
{
$query = RecurringInvoice::query();

View File

@ -14,6 +14,7 @@ namespace App\Http\Livewire;
use App\Models\ClientContact;
use App\Models\Subscription;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Str;
use Livewire\Component;
@ -74,20 +75,32 @@ class SubscriptionPlanSwitch extends Component
{
$this->total = $this->amount;
$this->methods = $this->contact->client->service()->getPaymentMethods(100);
$this->methods = $this->contact->client->service()->getPaymentMethods($this->amount);
$this->hash = Str::uuid()->toString();
}
public function handleBeforePaymentEvents(): void
{
$this->state['show_loading_bar'] = true;
$this->state['invoice'] = $this->subscription->service()->createChangePlanInvoice([
'recurring_invoice' => $this->recurring_invoice,
'subscription' => $this->subscription,
'target' => $this->target,
]);
$this->state['invoice'] = $this->target->service()->createChangePlanInvoice([
'recurring_invoice' => $this->recurring_invoice,
'subscription' => $this->subscription,
'target' => $this->target,
'hash' => $this->hash,
]);
Cache::put($this->hash, [
'subscription_id' => $this->target->id,
'target_id' => $this->target->id,
'recurring_invoice' => $this->recurring_invoice->id,
'client_id' => $this->recurring_invoice->client->id,
'invoice_id' => $this->state['invoice']->id,
'context' => 'change_plan',
now()->addMinutes(60)]
);
$this->state['payment_initialised'] = true;
@ -109,6 +122,18 @@ class SubscriptionPlanSwitch extends Component
$this->handleBeforePaymentEvents();
}
public function handlePaymentNotRequired()
{
return $this->target->service()->createChangePlanCredit([
'recurring_invoice' => $this->recurring_invoice,
'subscription' => $this->subscription,
'target' => $this->target,
'hash' => $this->hash,
]);
}
public function render()
{
return render('components.livewire.subscription-plan-switch');

View File

@ -0,0 +1,28 @@
<?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\Requests\ClientGatewayToken;
use App\Http\Requests\Request;
use App\Models\ClientGatewayToken;
class CreateClientGatewayTokenRequest extends Request
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize() : bool
{
return auth()->user()->isAdmin();
}
}

View File

@ -0,0 +1,27 @@
<?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\Requests\ClientGatewayToken;
use App\Http\Requests\Request;
class DestroyClientGatewayTokenRequest extends Request
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize() : bool
{
return auth()->user()->isAdmin();
}
}

View File

@ -0,0 +1,28 @@
<?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\Requests\ClientGatewayToken;
use App\Http\Requests\Request;
class EditClientGatewayTokenRequest extends Request
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize() : bool
{
return auth()->user()->isAdmin();
}
}

View File

@ -0,0 +1,27 @@
<?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\Requests\ClientGatewayToken;
use App\Http\Requests\Request;
class ShowClientGatewayTokenRequest extends Request
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize() : bool
{
return auth()->user()->isAdmin();
}
}

View File

@ -0,0 +1,67 @@
<?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\Requests\ClientGatewayToken;
use App\DataMapper\ClientSettings;
use App\Http\Requests\Request;
use App\Http\ValidationRules\Ninja\CanStoreClientsRule;
use App\Http\ValidationRules\ValidClientGroupSettingsRule;
use App\Models\Client;
use App\Models\GroupSetting;
use App\Utils\Traits\MakesHash;
use Illuminate\Support\Facades\Cache;
use Illuminate\Validation\Rule;
class StoreClientGatewayTokenRequest extends Request
{
use MakesHash;
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize() : bool
{
return auth()->user()->isAdmin();
}
public function rules()
{
$rules = [
'client_id' => 'required',
'company_gateway_id' => 'required',
'gateway_type_id' => 'required|integer',
'meta' => 'required',
];
return $this->globalRules($rules);
}
protected function prepareForValidation()
{
$input = $this->all();
$input = $this->decodePrimaryKeys($input);
$this->replace($input);
}
public function messages()
{
return [
];
}
}

View File

@ -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\Http\Requests\ClientGatewayToken;
use App\DataMapper\CompanySettings;
use App\Http\Requests\Request;
use App\Http\ValidationRules\ValidClientGroupSettingsRule;
use App\Utils\Traits\ChecksEntityStatus;
use App\Utils\Traits\MakesHash;
use Illuminate\Validation\Rule;
class UpdateClientGatewayTokenRequest extends Request
{
use MakesHash;
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize() : bool
{
return auth()->user()->isAdmin();
}
public function rules()
{
/* Ensure we have a client name, and that all emails are unique*/
$rules = [];
return $rules;
}
public function messages()
{
return [
];
}
protected function prepareForValidation()
{
$input = $this->all();
$this->replace($input);
}
}

View File

@ -51,7 +51,7 @@ class StoreInvoiceRequest extends Request
$rules['invitations.*.client_contact_id'] = 'distinct';
$rules['number'] = ['nullable',Rule::unique('invoices')->where('company_id', auth()->user()->company()->id)];
$rules['number'] = ['nullable', Rule::unique('invoices')->where('company_id', auth()->user()->company()->id)];
$rules['project_id'] = ['bail', 'sometimes', new ValidProjectForClient($this->all())];

View File

@ -106,6 +106,10 @@ class Request extends FormRequest
$input['project_id'] = $this->decodePrimaryKey($input['project_id']);
}
if (array_key_exists('company_gateway_id', $input) && is_string($input['company_gateway_id'])) {
$input['company_gateway_id'] = $this->decodePrimaryKey($input['company_gateway_id']);
}
if (isset($input['client_contacts'])) {
foreach ($input['client_contacts'] as $key => $contact) {
if (! array_key_exists('send_email', $contact) || ! array_key_exists('id', $contact)) {

View File

@ -35,10 +35,11 @@ class StoreSubscriptionRequest extends Request
public function rules()
{
$rules = [
'product_id' => ['sometimes'],
'product_ids' => ['sometimes'],
'recurring_product_ids' => ['sometimes'],
'assigned_user_id' => ['sometimes'],
'is_recurring' => ['sometimes'],
'frequency_id' => ['sometimes'],
'frequency_id' => ['required_with:recurring_product_ids'],
'auto_bill' => ['sometimes'],
'promo_code' => ['sometimes'],
'promo_discount' => ['sometimes'],

View File

@ -13,6 +13,7 @@ namespace App\Http\Requests\Subscription;
use App\Http\Requests\Request;
use App\Utils\Traits\ChecksEntityStatus;
use Illuminate\Validation\Rule;
class UpdateSubscriptionRequest extends Request
{
@ -35,12 +36,32 @@ class UpdateSubscriptionRequest extends Request
*/
public function rules()
{
$rules = [
//
$rules = [
'product_ids' => ['sometimes'],
'recurring_product_ids' => ['sometimes'],
'assigned_user_id' => ['sometimes'],
'is_recurring' => ['sometimes'],
'frequency_id' => ['required_with:recurring_product_ids'],
'auto_bill' => ['sometimes'],
'promo_code' => ['sometimes'],
'promo_discount' => ['sometimes'],
'is_amount_discount' => ['sometimes'],
'allow_cancellation' => ['sometimes'],
'per_set_enabled' => ['sometimes'],
'min_seats_limit' => ['sometimes'],
'max_seats_limit' => ['sometimes'],
'trial_enabled' => ['sometimes'],
'trial_duration' => ['sometimes'],
'allow_query_overrides' => ['sometimes'],
'allow_plan_changes' => ['sometimes'],
'refund_period' => ['sometimes'],
'webhook_configuration' => ['array'],
'name' => ['sometimes', Rule::unique('subscriptions')->where('company_id', auth()->user()->company()->id)->ignore($this->subscription->id)]
];
return $this->globalRules($rules);
}
protected function prepareForValidation()

View File

@ -0,0 +1,37 @@
<?php
/**
* Quote Ninja (https://paymentninja.com).
*
* @link https://github.com/paymentninja/paymentninja source repository
*
* @copyright Copyright (c) 2021. Quote Ninja LLC (https://paymentninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace App\Http\Requests\Task;
use App\Http\Requests\Request;
class SortTaskRequest extends Request
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize() : bool
{
return true;
// return auth()->user()->can('edit', $this->task);
}
public function rules()
{
return [];
}
}

View File

@ -45,10 +45,10 @@ class CreateCompanyTaskStatuses
public function handle()
{
$task_statuses = [
['name' => ctrans('texts.backlog'), 'company_id' => $this->company->id, 'user_id' => $this->user->id, 'created_at' => now(), 'updated_at' => now()],
['name' => ctrans('texts.ready_to_do'), 'company_id' => $this->company->id, 'user_id' => $this->user->id, 'created_at' => now(), 'updated_at' => now()],
['name' => ctrans('texts.in_progress'), 'company_id' => $this->company->id, 'user_id' => $this->user->id, 'created_at' => now(), 'updated_at' => now()],
['name' => ctrans('texts.done'), 'company_id' => $this->company->id, 'user_id' => $this->user->id, 'created_at' => now(), 'updated_at' => now()],
['name' => ctrans('texts.backlog'), 'company_id' => $this->company->id, 'user_id' => $this->user->id, 'created_at' => now(), 'updated_at' => now(), 'status_order' => 1],
['name' => ctrans('texts.ready_to_do'), 'company_id' => $this->company->id, 'user_id' => $this->user->id, 'created_at' => now(), 'updated_at' => now(), 'status_order' => 2],
['name' => ctrans('texts.in_progress'), 'company_id' => $this->company->id, 'user_id' => $this->user->id, 'created_at' => now(), 'updated_at' => now(), 'status_order' => 3],
['name' => ctrans('texts.done'), 'company_id' => $this->company->id, 'user_id' => $this->user->id, 'created_at' => now(), 'updated_at' => now(), 'status_order' => 4],
];

View File

@ -105,10 +105,10 @@ class NinjaMailerJob implements ShouldQueue
switch ($class) {
case Invoice::class:
event(new InvoiceWasEmailedAndFailed($this->nmo->invitation, $this->nmo->company, $message, $this->nmo->reminder_template, Ninja::eventVars(auth()->user()->id)));
event(new InvoiceWasEmailedAndFailed($this->nmo->invitation, $this->nmo->company, $message, $this->nmo->reminder_template, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));
break;
case Payment::class:
event(new PaymentWasEmailedAndFailed($this->nmo->entity, $this->nmo->company, $message, Ninja::eventVars(auth()->user()->id)));
event(new PaymentWasEmailedAndFailed($this->nmo->entity, $this->nmo->company, $message, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));
break;
default:
# code...

View File

@ -68,15 +68,6 @@ class SendRecurring implements ShouldQueue
->fillDefaults()
->save();
nlog("Invoice {$invoice->number} created");
$invoice->invitations->each(function ($invitation) use ($invoice) {
if ($invitation->contact && strlen($invitation->contact->email) >=1) {
EmailEntity::dispatch($invitation, $invoice->company);
nlog("Firing email for invoice {$invoice->number}");
}
});
nlog("updating recurring invoice dates");
/* Set next date here to prevent a recurring loop forming */
$this->recurring_invoice->next_send_date = $this->recurring_invoice->nextSendDate()->format('Y-m-d');
@ -99,6 +90,15 @@ class SendRecurring implements ShouldQueue
$invoice->entityEmailEvent($invoice->invitations->first(), 'invoice', 'email_template_invoice');
}
nlog("Invoice {$invoice->number} created");
$invoice->invitations->each(function ($invitation) use ($invoice) {
if ($invitation->contact && strlen($invitation->contact->email) >=1) {
EmailEntity::dispatch($invitation, $invoice->company);
nlog("Firing email for invoice {$invoice->number}");
}
});
if ($invoice->client->getSetting('auto_bill_date') == 'on_send_date' && $this->recurring_invoice->auto_bill_enabled) {
nlog("attempting to autobill {$invoice->number}");
$invoice->service()->autoBill()->save();

View File

@ -674,6 +674,8 @@ class Import implements ShouldQueue
$resource['invitations'][$key]['user_id'] = $modified['user_id'];
$resource['invitations'][$key]['company_id'] = $this->company->id;
unset($resource['invitations'][$key]['recurring_invoice_id']);
unset($resource['invitations'][$key]['id']);
}
$modified['invitations'] = $this->deDuplicateInvitations($resource['invitations']);
@ -736,6 +738,7 @@ class Import implements ShouldQueue
$resource['invitations'][$key]['user_id'] = $modified['user_id'];
$resource['invitations'][$key]['company_id'] = $this->company->id;
unset($resource['invitations'][$key]['invoice_id']);
unset($resource['invitations'][$key]['id']);
}
$modified['invitations'] = $this->deDuplicateInvitations($resource['invitations']);
@ -864,6 +867,7 @@ class Import implements ShouldQueue
$resource['invitations'][$key]['user_id'] = $modified['user_id'];
$resource['invitations'][$key]['company_id'] = $this->company->id;
unset($resource['invitations'][$key]['invoice_id']);
unset($resource['invitations'][$key]['id']);
}
$modified['invitations'] = $this->deDuplicateInvitations($resource['invitations']);

View File

@ -12,6 +12,7 @@
namespace App\Jobs\Util;
use App\Models\Account;
use App\Utils\Ninja;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
@ -40,5 +41,16 @@ class VersionCheck implements ShouldQueue
if ($version_file) {
Account::whereNotNull('id')->update(['latest_version' => $version_file]);
}
if(Ninja::isSelfHost())
{
$account = Account::first();
if($account->plan == 'white_label' && $account->plan_expires->lt(now())){
$account->plan = null;
$account->plan_expires = null;
$account->save();
}
}
}
}

View File

@ -29,7 +29,7 @@ class DeleteCompanyDocuments
{
MultiDB::setDb($event->company->db);
$path = sprintf('%s/%s', storage_path('app/public'), $event->company->company_key);
$path = sprintf('%s/%s', public_path('storage'), $event->company->company_key);
// Remove all files & folders, under company's path.
// This will delete directory itself, as well.

View File

@ -12,7 +12,10 @@
namespace App\Mail\Engine;
use App\Utils\HtmlEngine;
use App\Utils\Ninja;
use App\Utils\Number;
use Illuminate\Support\Facades\App;
use Illuminate\Support\Facades\Lang;
class CreditEmailEngine extends BaseEmailEngine
{
@ -40,6 +43,9 @@ class CreditEmailEngine extends BaseEmailEngine
public function build()
{
App::forgetInstance('translator');
Lang::replace(Ninja::transformTranslations($this->client->getMergedSettings()));
if (is_array($this->template_data) && array_key_exists('body', $this->template_data) && strlen($this->template_data['body']) > 0) {
$body_template = $this->template_data['body'];
} else {

View File

@ -14,7 +14,10 @@ namespace App\Mail\Engine;
use App\DataMapper\EmailTemplateDefaults;
use App\Models\Account;
use App\Utils\HtmlEngine;
use App\Utils\Ninja;
use App\Utils\Number;
use Illuminate\Support\Facades\App;
use Illuminate\Support\Facades\Lang;
class InvoiceEmailEngine extends BaseEmailEngine
{
@ -42,6 +45,10 @@ class InvoiceEmailEngine extends BaseEmailEngine
public function build()
{
App::forgetInstance('translator');
Lang::replace(Ninja::transformTranslations($this->client->getMergedSettings()));
if (is_array($this->template_data) && array_key_exists('body', $this->template_data) && strlen($this->template_data['body']) > 0) {
$body_template = $this->template_data['body'];
} elseif (strlen($this->client->getSetting('email_template_'.$this->reminder_template)) > 0) {

View File

@ -33,7 +33,7 @@ class PaymentEmailEngine extends BaseEmailEngine
public $contact;
private $helpers;
public function __construct($payment, $contact, $template_data = null)
{
$this->payment = $payment;
@ -169,7 +169,7 @@ class PaymentEmailEngine extends BaseEmailEngine
$data['$company3'] = ['value' => $this->helpers->formatCustomFieldValue($this->company->custom_fields, 'company3', $this->settings->custom_value3, $this->client) ?: '&nbsp;', 'label' => $this->helpers->makeCustomField($this->company->custom_fields, 'company3')];
$data['$company4'] = ['value' => $this->helpers->formatCustomFieldValue($this->company->custom_fields, 'company4', $this->settings->custom_value4, $this->client) ?: '&nbsp;', 'label' => $this->helpers->makeCustomField($this->company->custom_fields, 'company4')];
$data['$view_link'] = ['value' => '<a href="'.$this->payment->getLink().'">'.ctrans('texts.view_payment').'</a>', 'label' => ctrans('texts.view_payment')];
$data['$view_link'] = ['value' => '<a class="button" href="'.$this->payment->getLink().'">'.ctrans('texts.view_payment').'</a>', 'label' => ctrans('texts.view_payment')];
$data['$view_url'] = ['value' => $this->payment->getLink(), 'label' => ctrans('texts.view_payment')];
$data['$invoices'] = ['value' => $this->formatInvoices(), 'label' => ctrans('texts.invoices')];

View File

@ -13,7 +13,10 @@ namespace App\Mail\Engine;
use App\Models\Account;
use App\Utils\HtmlEngine;
use App\Utils\Ninja;
use App\Utils\Number;
use Illuminate\Support\Facades\App;
use Illuminate\Support\Facades\Lang;
class QuoteEmailEngine extends BaseEmailEngine
{
@ -41,6 +44,9 @@ class QuoteEmailEngine extends BaseEmailEngine
public function build()
{
App::forgetInstance('translator');
Lang::replace(Ninja::transformTranslations($this->client->getMergedSettings()));
if (is_array($this->template_data) && array_key_exists('body', $this->template_data) && strlen($this->template_data['body']) > 0) {
$body_template = $this->template_data['body'];
} else {

View File

@ -14,7 +14,9 @@ namespace App\Mail;
use App\Models\Client;
use App\Models\ClientContact;
use App\Models\User;
use App\Services\PdfMaker\Designs\Utilities\DesignHelpers;
use App\Utils\HtmlEngine;
use App\Utils\TemplateEngine;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
@ -53,8 +55,16 @@ class TemplateEmail extends Mailable
$this->build_email->setBody(str_replace('$body', $this->build_email->getBody(), $this->client->getSetting('email_style_custom')));
}
$this->build_email->setBody(
DesignHelpers::parseMarkdownToHtml($this->build_email->getBody())
);
$settings = $this->client->getMergedSettings();
$this->build_email->setBody(
TemplateEngine::wrapElementsIntoTables('<div id="content-wrapper"></div>', $this->build_email->getBody(), $settings)
);
$company = $this->client->company;
if($this->invitation)
@ -64,10 +74,10 @@ class TemplateEmail extends Mailable
}
else
$signature = $settings->email_signature;
$this->from(config('mail.from.address'), $this->company->present()->name());
if (strlen($settings->bcc_email) > 1)
if (strlen($settings->bcc_email) > 1)
$this->bcc($settings->bcc_email, $settings->bcc_email);
$this->subject($this->build_email->getSubject())

View File

@ -29,6 +29,14 @@ class ClientGatewayToken extends BaseModel
'hashed_id',
];
protected $fillable = [
'token',
'routing_number',
'gateway_customer_reference',
'gateway_type_id',
'meta',
];
public function getEntityType()
{
return self::class;

View File

@ -397,7 +397,7 @@ class Invoice extends BaseModel
$storage_path = Storage::$type($this->client->invoice_filepath().$this->numberFormatter().'.pdf');
if (! Storage::exists($this->client->invoice_filepath().$this->numberFormatter().'.pdf')) {
event(new InvoiceWasUpdated($this, $this->company, Ninja::eventVars(auth()->user()->id)));
event(new InvoiceWasUpdated($this, $this->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));
CreateEntityPdf::dispatchNow($invitation);
}

View File

@ -143,7 +143,7 @@ class InvoiceInvitation extends BaseModel
$storage_path = Storage::url($this->invoice->client->invoice_filepath().$this->invoice->numberFormatter().'.pdf');
if (! Storage::exists($this->invoice->client->invoice_filepath().$this->invoice->numberFormatter().'.pdf')) {
event(new InvoiceWasUpdated($this->invoice, $this->company, Ninja::eventVars(auth()->user()->id)));
event(new InvoiceWasUpdated($this->invoice, $this->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));
CreateEntityPdf::dispatchNow($this);
}

View File

@ -45,12 +45,29 @@ class Webhook extends BaseModel
public static $valid_events = [
self::EVENT_CREATE_CLIENT,
self::EVENT_CREATE_PAYMENT,
self::EVENT_CREATE_QUOTE,
self::EVENT_CREATE_INVOICE,
self::EVENT_CREATE_QUOTE,
self::EVENT_CREATE_PAYMENT,
self::EVENT_CREATE_VENDOR,
self::EVENT_UPDATE_QUOTE,
self::EVENT_DELETE_QUOTE,
self::EVENT_UPDATE_INVOICE,
self::EVENT_DELETE_INVOICE,
self::EVENT_UPDATE_CLIENT,
self::EVENT_DELETE_CLIENT,
self::EVENT_DELETE_PAYMENT,
self::EVENT_UPDATE_VENDOR,
self::EVENT_DELETE_VENDOR,
self::EVENT_CREATE_EXPENSE,
self::EVENT_UPDATE_EXPENSE,
self::EVENT_DELETE_EXPENSE,
self::EVENT_CREATE_TASK,
self::EVENT_UPDATE_TASK,
self::EVENT_DELETE_TASK,
self::EVENT_APPROVE_QUOTE,
self::EVENT_LATE_INVOICE,
self::EVENT_EXPIRED_QUOTE,
self::EVENT_REMIND_INVOICE,
];
protected $fillable = [

View File

@ -16,15 +16,20 @@ class MailServiceProvider extends MailProvider
$this->registerIlluminateMailer();
}
public function boot()
{
}
protected function registerIlluminateMailer()
{
// $this->app->singleton('mail.manager', function($app) {
// return new GmailTransportManager($app);
// });
$this->app->bind('mail.manager', function($app) {
$this->app->singleton('mail.manager', function($app) {
return new GmailTransportManager($app);
});
// $this->app->bind('mail.manager', function($app) {
// return new GmailTransportManager($app);
// });
$this->app->bind('mailer', function ($app) {
return $app->make('mail.manager')->mailer();
@ -33,14 +38,22 @@ class MailServiceProvider extends MailProvider
$this->app['mail.manager']->extend('postmark', function () {
return new PostmarkTransport(
$this->guzzle(config('postmark.guzzle', [])),
config('postmark.secret', config('services.postmark.secret'))
config('postmark.secret')
);
});
}
protected function guzzle(array $config): HttpClient
{
return new HttpClient($config);
}
public function provides()
{
return [
'mail.manager',
'mailer' ];
}
}

View File

@ -33,7 +33,21 @@ class NinjaTranslationServiceProvider extends TranslationServiceProvider
*
*/
// $this->app->bind('translator', function($app) {
// $loader = $app['translation.loader'];
// $locale = $app['config']['app.locale'];
// $trans = new NinjaTranslator($loader, $locale);
// $trans->setFallback($app['config']['app.fallback_locale']);
// return $trans;
// });
$this->app->singleton('translator', function ($app) {
$loader = $app['translation.loader'];
$locale = $app['config']['app.locale'];
@ -42,6 +56,8 @@ class NinjaTranslationServiceProvider extends TranslationServiceProvider
$trans->setFallback($app['config']['app.fallback_locale']);
return $trans;
});
}
}

View File

@ -291,6 +291,10 @@ class BaseRepository
/* Apply entity number */
$model = $model->service()->applyNumber()->save();
/* Handle attempts where the deposit is greater than the amount/balance of the invoice */
if((int)$model->balance != 0 && $model->partial > $model->amount)
$model->partial = min($model->amount, $model->balance);
/* Update product details if necessary */
if ($model->company->update_products)
UpdateOrCreateProduct::dispatch($model->line_items, $model, $model->company);

View File

@ -0,0 +1,31 @@
<?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\Repositories;
use App\Models\ClientGatewayToken;
/**
* Class for ClientGatewayTokenRepository .
*/
class ClientGatewayTokenRepository extends BaseRepository
{
public function save(array $data, ClientGatewayToken $client_gateway_token) :ClientGatewayToken
{
$client_gateway_token->fill($data);
$client_gateway_token->save();
return $client_gateway_token->fresh();
}
}

View File

@ -155,7 +155,11 @@ class PaymentRepository extends BaseRepository {
}
if ( ! $is_existing_payment && ! $this->import_mode ) {
event( new PaymentWasCreated( $payment, $payment->company, Ninja::eventVars(auth()->user()->id) ) );
if ($payment->client->getSetting('client_manual_payment_notification'))
$payment->service()->sendEmail();
event( new PaymentWasCreated( $payment, $payment->company, Ninja::eventVars(auth()->user()->id) ) );
}
nlog("payment amount = {$payment->amount}");

View File

@ -11,9 +11,49 @@
namespace App\Repositories;
use App\Models\Task;
use App\Models\TaskStatus;
/**
* Class for task status repository.
*/
class TaskStatusRepository extends BaseRepository
{
public function delete($task_status)
{
$ts = TaskStatus::where('company_id', $task_status->company_id)
->first();
$new_status = $ts ? $ts->id : null;
Task::where('status_id', $task_status->id)
->where('company_id', $task_status->company_id)
->update(['status_id' => $new_status]);
parent::delete($task_status);
return $task_status;
}
public function archive($task_status)
{
$task_status = TaskStatus::where('company_id', $task_status->company_id)
->first();
$new_status = $task_status ? $task_status->id : null;
Task::where('status_id', $task_status->id)
->where('company_id', $task_status->company_id)
->update(['status_id' => $new_status]);
parent::archive($task_status);
return $task_status;
}
}

View File

@ -144,11 +144,11 @@ class ApplyPayment
->ledger()
->updateCreditBalance(($this->amount_applied * -1), "Credit payment applied to Invoice {$this->invoice->number}");
event(new InvoiceWasUpdated($this->invoice, $this->invoice->company, Ninja::eventVars(auth()->user()->id)));
event(new InvoiceWasUpdated($this->invoice, $this->invoice->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));
if ((int)$this->invoice->balance == 0) {
$this->invoice->service()->deletePdf();
event(new InvoiceWasPaid($this->invoice, $payment, $this->payment->company, Ninja::eventVars(auth()->user()->id)));
event(new InvoiceWasPaid($this->invoice, $this->payment, $this->payment->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));
}
}
}

View File

@ -87,7 +87,7 @@ class UpdateInvoicePayment
InvoiceWorkflowSettings::dispatchNow($invoice);
event(new InvoiceWasUpdated($invoice, $invoice->company, Ninja::eventVars()));
event(new InvoiceWasUpdated($invoice, $invoice->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));
});
$this->payment->save();

View File

@ -440,7 +440,6 @@ class Design extends BaseDesign
$elements = [
['element' => 'div', 'properties' => ['style' => 'display: flex; flex-direction: column;'], 'elements' => [
['element' => 'p', 'content' => strtr($_variables['values']['$entity.public_notes'], $_variables), 'properties' => ['data-ref' => 'total_table-public_notes', 'style' => 'text-align: left;']],
['element' => 'p', 'content' => '', 'properties' => ['style' => 'text-align: left; display: flex; flex-direction: column;'], 'elements' => [
['element' => 'span', 'content' => '$entity.terms_label: ', 'properties' => ['hidden' => $this->entityVariableCheck('$entity.terms'), 'data-ref' => 'total_table-terms-label', 'style' => 'font-weight: bold; text-align: left; margin-top: 1rem;']],
['element' => 'span', 'content' => strtr($_variables['values']['$entity.terms'], $_variables), 'properties' => ['data-ref' => 'total_table-terms', 'style' => 'text-align: left;']],

View File

@ -16,6 +16,7 @@ use App\Utils\Traits\MakesHash;
use DOMDocument;
use DOMXPath;
use Exception;
use League\CommonMark\CommonMarkConverter;
trait DesignHelpers
{
@ -308,4 +309,13 @@ trait DesignHelpers
$this->client
);
}
public static function parseMarkdownToHtml(string $markdown): ?string
{
$converter = new CommonMarkConverter([
'allow_unsafe_links' => false,
]);
return $converter->convertToHtml($markdown);
}
}

View File

@ -34,9 +34,9 @@ class ConvertQuote
public function run($quote)
{
$invoice = CloneQuoteToInvoiceFactory::create($quote, $quote->user_id);
$invoice->design_id = $this->client->getSetting('invoice_design_id');
$invoice = $this->invoice_repo->save([], $invoice);
$invoice->fresh();
$invoice->service()

View File

@ -12,6 +12,7 @@
namespace App\Services\Subscription;
use App\DataMapper\InvoiceItem;
use App\Factory\CreditFactory;
use App\Factory\InvoiceFactory;
use App\Factory\InvoiceToRecurringInvoiceFactory;
use App\Factory\RecurringInvoiceFactory;
@ -26,9 +27,11 @@ use App\Models\Product;
use App\Models\RecurringInvoice;
use App\Models\Subscription;
use App\Models\SystemLog;
use App\Repositories\CreditRepository;
use App\Repositories\InvoiceRepository;
use App\Repositories\RecurringInvoiceRepository;
use App\Repositories\SubscriptionRepository;
use App\Services\Subscription\ZeroCostProduct;
use App\Utils\Ninja;
use App\Utils\Traits\CleanLineItems;
use App\Utils\Traits\MakesHash;
@ -61,6 +64,10 @@ class SubscriptionService
throw new \Exception("Illegal entrypoint into method, payload must contain billing context");
}
if($payment_hash->data->billing_context->context == 'change_plan') {
return $this->handlePlanChange($payment_hash);
}
// if we have a recurring product - then generate a recurring invoice
if(strlen($this->subscription->recurring_product_ids) >=1){
@ -84,16 +91,15 @@ class SubscriptionService
'invoice' => $this->encodePrimaryKey($payment_hash->fee_invoice_id),
'client' => $recurring_invoice->client->hashed_id,
'subscription' => $this->subscription->hashed_id,
'contact' => auth('contact')->user()->hashed_id,
];
$response = $this->triggerWebhook($context);
nlog($response);
// nlog($response);
if(array_key_exists('post_purchase_url', $this->subscription->webhook_configuration) && strlen($this->subscription->webhook_configuration['post_purchase_url']) >=1)
return redirect($this->subscription->webhook_configuration['post_purchase_url']);
$this->handleRedirect('/client/recurring_invoices/'.$recurring_invoice->hashed_id);
return redirect('/client/recurring_invoices/'.$recurring_invoice->hashed_id);
}
else
{
@ -109,10 +115,7 @@ class SubscriptionService
//execute any webhooks
$this->triggerWebhook($context);
if(array_key_exists('post_purchase_url', $this->subscription->webhook_configuration) && strlen($this->subscription->webhook_configuration['post_purchase_url']) >=1)
return redirect($this->subscription->webhook_configuration['post_purchase_url']);
return redirect('/client/invoices/'.$this->encodePrimaryKey($payment_hash->fee_invoice_id));
$this->handleRedirect('/client/invoices/'.$this->encodePrimaryKey($payment_hash->fee_invoice_id));
}
}
@ -129,7 +132,7 @@ class SubscriptionService
];
$response = $this->triggerWebhook($context);
nlog($response);
return $response;
}
@ -176,13 +179,20 @@ class SubscriptionService
//execute any webhooks
$response = $this->triggerWebhook($context);
if(array_key_exists('return_url', $this->subscription->webhook_configuration) && strlen($this->subscription->webhook_configuration['return_url']) >=1){
return redirect($this->subscription->webhook_configuration['return_url']);
}
return redirect('/client/recurring_invoices/'.$recurring_invoice->hashed_id);
return $this->handleRedirect('/client/recurring_invoices/'.$recurring_invoice->hashed_id);
}
/**
* Returns an upgrade price when moving between plans
*
* However we only allow people to move between plans
* if their account is in good standing.
*
* @param RecurringInvoice $recurring_invoice
* @param Subscription $target
*
* @return float
*/
public function calculateUpgradePrice(RecurringInvoice $recurring_invoice, Subscription $target) :?float
{
//calculate based on daily prices
@ -196,16 +206,20 @@ class SubscriptionService
->where('balance', '>', 0);
$outstanding_amounts = $outstanding->sum('balance');
// $outstanding_invoices = $outstanding->get();
$outstanding_invoices = $outstanding;
$outstanding_invoice = Invoice::where('subscription_id', $this->subscription->id)
->where('client_id', $recurring_invoice->client_id)
->where('is_deleted', 0)
->orderBy('id', 'desc')
->first();
if ($outstanding->count() == 0){
//nothing outstanding
return $target->price;
return $target->price - $this->calculateProRataRefund($outstanding_invoice);
}
elseif ($outstanding->count() == 1){
//user has multiple amounts outstanding
return $target->price - $this->calculateProRataRefund($outstanding->first());
return $target->price - $this->calculateProRataRefund($outstanding_invoice);
}
elseif ($outstanding->count() > 1) {
//user is changing plan mid frequency cycle
@ -217,67 +231,353 @@ class SubscriptionService
}
/**
* We refund unused days left.
*
* @param Invoice $invoice
* @return float
*/
private function calculateProRataRefund($invoice) :float
{
//determine the start date
$start_date = Carbon::parse($invoice->date);
$current_date = now();
$days_to_refund = $start_date->diffInDays($current_date);
$days_of_subscription_used = $start_date->diffInDays($current_date);
$days_in_frequency = $this->getDaysInFrequency();
$pro_rata_refund = round(($days_to_refund/$days_in_frequency) * $invoice->amount ,2);
$pro_rata_refund = round((($days_in_frequency - $days_of_subscription_used)/$days_in_frequency) * $invoice->amount ,2);
return $pro_rata_refund;
}
public function createChangePlanInvoice($data)
/**
* Returns refundable set of line items
* transformed for direct injection into
* the invoice
*
* @param Invoice $invoice
* @return array
*/
private function calculateProRataRefundItems($invoice, $is_credit = false) :array
{
//Data array structure
/**
* [
* 'recurring_invoice' => RecurringInvoice::class,
* 'subscription' => Subscription::class,
* 'target' => Subscription::class
* ]
*/
$outstanding_invoice = $recurring_invoice->invoices()
->where('is_deleted', 0)
->whereIn('status_id', [Invoice::STATUS_SENT, Invoice::STATUS_PARTIAL])
->where('balance', '>', 0)
->first();
/* depending on whether we are creating an invoice or a credit*/
$multiplier = $is_credit ? 1 : -1;
$pro_rata_refund = null;
$start_date = Carbon::parse($invoice->date);
// we calculate the pro rata refund for this invoice.
if($outstanding_invoice)
$current_date = now();
$days_of_subscription_used = $start_date->diffInDays($current_date);
$days_in_frequency = $this->getDaysInFrequency();
$ratio = ($days_in_frequency - $days_of_subscription_used)/$days_in_frequency;
$line_items = [];
foreach($invoice->line_items as $item)
{
// $pro_rata_refund = $this->calculateProRataRefund($out
if($item->product_key != ctrans('texts.refund'))
{
$item->cost = ($item->cost*$ratio*$multiplier);
$item->product_key = ctrans('texts.refund');
$item->notes = ctrans('texts.refund') . ": ". $item->notes;
$line_items[] = $item;
}
}
//logic
// Is the user paid up to date? ie are there any outstanding invoices for this subscription
return $line_items;
// User in arrears.
// User paid up to date (in credit!)
//generate credit amount.
//
//generate new billable amount
//
//if billable amount is LESS than 0 -> generate a credit and pass through.
//
//if billable amoun is GREATER than 0 -> gener
return Invoice::where('status_id', Invoice::STATUS_SENT)->first();
}
/**
* We only charge for the used days
*
* @param Invoice $invoice
* @return float
*/
private function calculateProRataCharge($invoice) :float
{
$start_date = Carbon::parse($invoice->date);
$current_date = now();
$days_to_charge = $start_date->diffInDays($current_date);
$days_in_frequency = $this->getDaysInFrequency();
nlog("days to charge = {$days_to_charge} fays in frequency = {$days_in_frequency}");
$pro_rata_charge = round(($days_to_charge/$days_in_frequency) * $invoice->amount ,2);
nlog("pro rata charge = {$pro_rata_charge}");
return $pro_rata_charge;
}
/**
* When downgrading, we may need to create
* a credit
*
* @param array $data
*/
public function createChangePlanCredit($data)
{
$recurring_invoice = $data['recurring_invoice'];
$old_subscription = $data['subscription'];
$target_subscription = $data['target'];
$pro_rata_charge_amount = 0;
$pro_rata_refund_amount = 0;
$last_invoice = Invoice::where('subscription_id', $recurring_invoice->subscription_id)
->where('client_id', $recurring_invoice->client_id)
->where('is_deleted', 0)
->withTrashed()
->orderBy('id', 'desc')
->first();
if($last_invoice->balance > 0)
{
$pro_rata_charge_amount = $this->calculateProRataCharge($last_invoice, $old_subscription);
nlog("pro rata charge = {$pro_rata_charge_amount}");
}
else
{
$pro_rata_refund_amount = $this->calculateProRataRefund($last_invoice, $old_subscription) * -1;
nlog("pro rata refund = {$pro_rata_refund_amount}");
}
$total_payable = $pro_rata_refund_amount + $pro_rata_charge_amount + $this->subscription->price;
nlog("total payable = {$total_payable}");
$credit = $this->createCredit($last_invoice, $target_subscription);
$new_recurring_invoice = $this->createNewRecurringInvoice($recurring_invoice);
$context = [
'context' => 'change_plan',
'recurring_invoice' => $new_recurring_invoice->hashed_id,
'credit' => $credit->hashed_id,
'client' => $new_recurring_invoice->client->hashed_id,
'subscription' => $target_subscription->hashed_id,
'contact' => auth('contact')->user()->hashed_id,
];
$response = $this->triggerWebhook($context);
nlog($response);
return $this->handleRedirect('/client/credits/'.$credit->hashed_id);
}
/**
* When changing plans, we need to generate a pro rata invoice
*
* @param array $data
* @return Invoice
*/
public function createChangePlanInvoice($data)
{
$recurring_invoice = $data['recurring_invoice'];
$old_subscription = $data['subscription'];
$target_subscription = $data['target'];
$pro_rata_charge_amount = 0;
$pro_rata_refund_amount = 0;
$last_invoice = Invoice::where('subscription_id', $recurring_invoice->subscription_id)
->where('client_id', $recurring_invoice->client_id)
->where('is_deleted', 0)
->withTrashed()
->orderBy('id', 'desc')
->first();
if($last_invoice->balance > 0)
{
$pro_rata_charge_amount = $this->calculateProRataCharge($last_invoice, $old_subscription);
nlog("pro rata charge = {$pro_rata_charge_amount}");
}
else
{
$pro_rata_refund_amount = $this->calculateProRataRefund($last_invoice, $old_subscription) * -1;
nlog("pro rata refund = {$pro_rata_refund_amount}");
}
$total_payable = $pro_rata_refund_amount + $pro_rata_charge_amount + $this->subscription->price;
return $this->proRataInvoice($last_invoice, $target_subscription);
}
/**
* Response from payment service on
* return from a plan change
*
* @param PaymentHash $payment_hash
*/
private function handlePlanChange($payment_hash)
{
$old_recurring_invoice = RecurringInvoice::find($payment_hash->data->billing_context->recurring_invoice);
$recurring_invoice = $this->createNewRecurringInvoice($old_recurring_invoice);
$context = [
'context' => 'change_plan',
'recurring_invoice' => $recurring_invoice->hashed_id,
'invoice' => $this->encodePrimaryKey($payment_hash->fee_invoice_id),
'client' => $recurring_invoice->client->hashed_id,
'subscription' => $this->subscription->hashed_id,
'contact' => auth('contact')->user()->hashed_id,
];
$response = $this->triggerWebhook($context);
nlog($response);
return $this->handleRedirect('/client/recurring_invoices/'.$recurring_invoice->hashed_id);
}
/**
* Creates a new recurring invoice when changing
* plans
*
* @param RecurringInvoice $old_recurring_invoice
* @return RecurringInvoice
*/
private function createNewRecurringInvoice($old_recurring_invoice) :RecurringInvoice
{
$old_recurring_invoice->service()->stop()->save();
$recurring_invoice_repo = new RecurringInvoiceRepository();
$recurring_invoice_repo->archive($old_recurring_invoice);
$recurring_invoice = $this->convertInvoiceToRecurring($old_recurring_invoice->client_id);
$recurring_invoice = $recurring_invoice_repo->save([], $recurring_invoice);
$recurring_invoice->next_send_date = now();
$recurring_invoice->next_send_date = $recurring_invoice->nextSendDate();
/* Start the recurring service */
$recurring_invoice->service()
->start()
->save();
return $recurring_invoice;
}
/**
* Handle a plan change where no payment is required
*
* @param array $data
*/
public function handlePlanChangeNoPayment($data)
{
$recurring_invoice = $this->createNewRecurringInvoice($data['recurring_invoice']);
$context = [
'context' => 'change_plan',
'recurring_invoice' => $recurring_invoice->hashed_id,
'invoice' => $this->encodePrimaryKey($payment_hash->fee_invoice_id),
'client' => $recurring_invoice->client->hashed_id,
'subscription' => $this->subscription->hashed_id,
'contact' => auth('contact')->user()->hashed_id,
];
$response = $this->triggerWebhook($context);
// nlog($response);
return $this->handleRedirect('/client/recurring_invoices/'.$recurring_invoice->hashed_id);
}
/**
* Creates a credit note if the plan change requires
*
* @param Invoice $last_invoice
* @param Subscription $target
* @return Credit
*/
private function createCredit($last_invoice, $target)
{
$subscription_repo = new SubscriptionRepository();
$credit_repo = new CreditRepository();
$credit = CreditFactory::create($this->subscription->company_id, $this->subscription->user_id);
$credit->date = now()->format('Y-m-d');
$credit->subscription_id = $this->subscription->id;
$line_items = $subscription_repo->generateLineItems($target);
$credit->line_items = array_merge($line_items, $this->calculateProRataRefundItems($last_invoice, true));
$data = [
'client_id' => $last_invoice->client_id,
'quantity' => 1,
'date' => now()->format('Y-m-d'),
];
return $credit_repo->save($data, $credit)->service()->markSent()->fillDefaults()->save();
}
/**
* When changing plans we need to generate a pro rata
* invoice which takes into account any credits.
*
* @param Invoice $last_invoice
* @param Subscription $target
* @return Invoice
*/
private function proRataInvoice($last_invoice, $target)
{
$subscription_repo = new SubscriptionRepository();
$invoice_repo = new InvoiceRepository();
$invoice = InvoiceFactory::create($this->subscription->company_id, $this->subscription->user_id);
$invoice->date = now()->format('Y-m-d');
$invoice->subscription_id = $this->subscription->id;
$invoice->line_items = array_merge($subscription_repo->generateLineItems($target), $this->calculateProRataRefundItems($last_invoice));
$data = [
'client_id' => $last_invoice->client_id,
'quantity' => 1,
'date' => now()->format('Y-m-d'),
];
return $invoice_repo->save($data, $invoice)
->service()
->markSent()
->fillDefaults()
->save();
}
/**
* Generates the first invoice when a subscription is purchased
*
* @param array $data
* @return Invoice
*/
public function createInvoice($data): ?\App\Models\Invoice
{
@ -298,8 +598,14 @@ class SubscriptionService
}
private function convertInvoiceToRecurring($client_id) :RecurringInvoice
/**
* Generates a recurring invoice based on
* the specifications of the subscription
*
* @param int $client_id The Client Id
* @return RecurringInvoice
*/
public function convertInvoiceToRecurring($client_id) :RecurringInvoice
{
$subscription_repo = new SubscriptionRepository();
@ -315,6 +621,11 @@ class SubscriptionService
return $recurring_invoice;
}
/**
* Hit a 3rd party API if defined in the subscription
*
* @param array $context
*/
public function triggerWebhook($context)
{
/* If no webhooks have been set, then just return gracefully */
@ -341,7 +652,8 @@ class SubscriptionService
else {
$status = $response->getStatusCode();
$response_body = $response->getBody();
//$response_body = $response->getReasonPhrase();
$body = array_merge($body, ['status' => $status, 'response_body' => $response_body]);
}
@ -401,62 +713,129 @@ class SubscriptionService
->get();
}
public function completePlanChange(PaymentHash $paymentHash)
{
// .. handle redirect, after upgrade redirects, etc..
}
public function handleCancellation()
{
dd('Cancelling using SubscriptionService');
// ..
}
/**
* Get pro rata calculation between subscriptions.
*
* @param Subscription $current
* @param Subscription $target
* Handle the cancellation of a subscription
*
* @param RecurringInvoice $recurring_invoice
*
*/
public function getPriceBetweenSubscriptions(Subscription $current, Subscription $target): int
public function handleCancellation(RecurringInvoice $recurring_invoice)
{
// Calculate the pro rata. Return negative value if credits needed.
return 1;
//only refund if they are in the refund window.
$outstanding_invoice = Invoice::where('subscription_id', $this->subscription->id)
->where('client_id', $recurring_invoice->client_id)
->where('is_deleted', 0)
->orderBy('id', 'desc')
->first();
$invoice_start_date = Carbon::parse($outstanding_invoice->date);
$refund_end_date = $invoice_start_date->addSeconds($this->subscription->refund_period);
/* Stop the recurring invoice and archive */
$recurring_invoice->service()->stop()->save();
$recurring_invoice_repo = new RecurringInvoiceRepository();
$recurring_invoice_repo->archive($recurring_invoice);
/* Refund only if we are in the window - and there is nothing outstanding on the invoice */
if($refund_end_date->greaterThan(now()) && (int)$outstanding_invoice->balance == 0)
{
if($outstanding_invoice->payments()->exists())
{
$payment = $outstanding_invoice->payments()->first();
$data = [
'id' => $payment->id,
'gateway_refund' => true,
'send_email' => true,
'invoices' => [
['invoice_id' => $outstanding_invoice->id, 'amount' => $outstanding_invoice->amount],
],
];
$payment->refund($data);
}
}
$context = [
'context' => 'cancellation',
'subscription' => $this->subscription->hashed_id,
'recurring_invoice' => $recurring_invoice->hashed_id,
'client' => $recurring_invoice->client->hashed_id,
'contact' => auth('contact')->user()->hashed_id,
];
$this->triggerWebhook($context);
return $this->handleRedirect('client/subscriptions');
}
private function getDaysInFrequency()
{
switch ($this->subscription->frequency_id) {
case self::FREQUENCY_DAILY:
case RecurringInvoice::FREQUENCY_DAILY:
return 1;
case self::FREQUENCY_WEEKLY:
case RecurringInvoice::FREQUENCY_WEEKLY:
return 7;
case self::FREQUENCY_TWO_WEEKS:
case RecurringInvoice::FREQUENCY_TWO_WEEKS:
return 14;
case self::FREQUENCY_FOUR_WEEKS:
case RecurringInvoice::FREQUENCY_FOUR_WEEKS:
return now()->diffInDays(now()->addWeeks(4));
case self::FREQUENCY_MONTHLY:
case RecurringInvoice::FREQUENCY_MONTHLY:
return now()->diffInDays(now()->addMonthNoOverflow());
case self::FREQUENCY_TWO_MONTHS:
case RecurringInvoice::FREQUENCY_TWO_MONTHS:
return now()->diffInDays(now()->addMonthNoOverflow(2));
case self::FREQUENCY_THREE_MONTHS:
case RecurringInvoice::FREQUENCY_THREE_MONTHS:
return now()->diffInDays(now()->addMonthNoOverflow(3));
case self::FREQUENCY_FOUR_MONTHS:
case RecurringInvoice::FREQUENCY_FOUR_MONTHS:
return now()->diffInDays(now()->addMonthNoOverflow(4));
case self::FREQUENCY_SIX_MONTHS:
case RecurringInvoice::FREQUENCY_SIX_MONTHS:
return now()->diffInDays(now()->addMonthNoOverflow(6));
case self::FREQUENCY_ANNUALLY:
case RecurringInvoice::FREQUENCY_ANNUALLY:
return now()->diffInDays(now()->addYear());
case self::FREQUENCY_TWO_YEARS:
case RecurringInvoice::FREQUENCY_TWO_YEARS:
return now()->diffInDays(now()->addYears(2));
case self::FREQUENCY_THREE_YEARS:
case RecurringInvoice::FREQUENCY_THREE_YEARS:
return now()->diffInDays(now()->addYears(3));
default:
return 0;
}
}
/**
* 'email' => $this->email ?? $this->contact->email,
* 'quantity' => $this->quantity,
* 'contact_id' => $this->contact->id,
*/
public function handleNoPaymentRequired(array $data)
{
$context = (new ZeroCostProduct($this->subscription, $data))->run();
// Forward payload to webhook
if(array_key_exists('context', $context))
$response = $this->triggerWebhook($context);
// Hit the redirect
return $this->handleRedirect($context['redirect_url']);
}
/**
* Handles redirecting the user
*/
private function handleRedirect($default_redirect)
{
if(array_key_exists('return_url', $this->subscription->webhook_configuration) && strlen($this->subscription->webhook_configuration['return_url']) >=1)
return redirect($this->subscription->webhook_configuration['return_url']);
return redirect($default_redirect);
}
}

View File

@ -0,0 +1,84 @@
<?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\Services\Subscription;
use App\Models\Subscription;
use App\Repositories\RecurringInvoiceRepository;
use App\Services\AbstractService;
class ZeroCostProduct extends AbstractService
{
private $subscription;
private $data;
/**
$data = [
'email' => $this->email ?? $this->contact->email,
'quantity' => $this->quantity,
'contact_id' => $this->contact->id,
'client_id' => $this->contact->client->id,
];
*/
public function __construct(Subscription $subscription, array $data)
{
$this->subscription = $subscription;
$this->data = $data;
}
public function run()
{
//create a zero dollar invoice.
$invoice = $this->subscription->service()->createInvoice($this->data);
$invoice->service()
->markPaid()
->save();
$redirect_url = "/client/invoices/{$invoice->hashed_id}";
//create a recurring zero dollar invoice attached to this subscription.
if(strlen($this->subscription->recurring_product_ids) >=1){
$recurring_invoice = $this->subscription->service()->convertInvoiceToRecurring($this->data['client_id']);
$recurring_invoice_repo = new RecurringInvoiceRepository();
$recurring_invoice->next_send_date = now();
$recurring_invoice = $recurring_invoice_repo->save([], $recurring_invoice);
$recurring_invoice->next_send_date = $recurring_invoice->nextSendDate();
/* Start the recurring service */
$recurring_invoice->service()
->start()
->save();
$context = [
'context' => 'recurring_purchase',
'recurring_invoice' => $recurring_invoice->hashed_id,
'invoice' => $invoice->hashed_id,
'client' => $recurring_invoice->client->hashed_id,
'subscription' => $this->subscription->hashed_id,
'contact' => auth('contact')->user()->hashed_id,
'redirect_url' => "/client/recurring_invoices/{$recurring_invoice->hashed_id}",
];
return $context;
}
return ['redirect_url' => $redirect_url];
}
}

View File

@ -153,6 +153,8 @@ class HtmlEngine
$data['$date'] = ['value' => $this->translateDate($this->entity->date, $this->entity->client->date_format(), $this->entity->client->locale()) ?: '&nbsp;', 'label' => ctrans('texts.credit_date')];
}
$data['$portal_url'] = ['value' => $this->invitation->getPortalLink(), 'label' =>''];
$data['$entity_number'] = &$data['$number'];
$data['$invoice.discount'] = ['value' => Number::formatMoney($this->entity_calc->getTotalDiscount(), $this->client) ?: '&nbsp;', 'label' => ctrans('texts.discount')];
$data['$discount'] = &$data['$invoice.discount'];
@ -375,7 +377,7 @@ class HtmlEngine
$data['$entity_footer'] = ['value' => $this->entity->footer, 'label' => ''];
$data['$page_size'] = ['value' => $this->settings->page_size, 'label' => ''];
$data['$page_layout'] = ['value' => $this->settings->page_layout, 'label' => ''];
$data['$page_layout'] = ['value' => property_exists($this->settings, 'page_layout') ? $this->settings->page_layout : 'Portrait', 'label' => ''];
$arrKeysLength = array_map('strlen', array_keys($data));
array_multisort($arrKeysLength, SORT_DESC, $data);

View File

@ -16,11 +16,16 @@ use App\Models\Client;
use App\Models\ClientContact;
use App\Models\Invoice;
use App\Models\InvoiceInvitation;
use App\Services\PdfMaker\Designs\Utilities\DesignHelpers;
use App\Utils\Ninja;
use App\Utils\Traits\MakesHash;
use App\Utils\Traits\MakesInvoiceHtml;
use App\Utils\Traits\MakesTemplateData;
use DB;
use Illuminate\Support\Facades\App;
use Illuminate\Support\Facades\Lang;
use League\CommonMark\CommonMarkConverter;
use TijsVerkoyen\CssToInlineStyles\CssToInlineStyles;
class TemplateEngine
{
@ -96,6 +101,9 @@ class TemplateEngine
$this->settings = $this->settings_entity->settings;
}
App::forgetInstance('translator');
Lang::replace(Ninja::transformTranslations($this->settings));
return $this;
}
@ -119,7 +127,7 @@ class TemplateEngine
$this->body = EmailTemplateDefaults::getDefaultTemplate($this->template, $this->settings_entity->locale());
}
}
return $this;
}
@ -162,17 +170,12 @@ class TemplateEngine
$this->body = strtr($this->body, $data['labels']);
$this->body = strtr($this->body, $data['values']);
$this->body = str_replace("\n", "<br>", $this->body);
// $this->body = str_replace("\n", "<br>", $this->body);
$this->subject = strtr($this->subject, $data['labels']);
$this->subject = strtr($this->subject, $data['values']);
$converter = new CommonMarkConverter([
'allow_unsafe_links' => false,
]);
$this->body = $converter->convertToHtml($this->body);
$this->body = DesignHelpers::parseMarkdownToHtml($this->body);
}
private function renderTemplate()
@ -203,7 +206,7 @@ class TemplateEngine
$data = [
'subject' => $this->subject,
'body' => $this->body,
'body' => self::wrapElementsIntoTables(strtr($wrapper, ['$body' => '']), $this->body, $this->entity_obj->client->getMergedSettings()),
'wrapper' => $wrapper,
'raw_body' => $this->raw_body,
'raw_subject' => $this->raw_subject
@ -256,4 +259,50 @@ class TemplateEngine
{
DB::rollBack();
}
public static function wrapElementsIntoTables(string $wrapper, string $body, $settings): ?string
{
$documents['wrapper'] = new \DOMDocument();
$documents['wrapper']->loadHTML($wrapper);
$documents['master'] = new \DOMDocument();
$documents['master']->loadHTML(
view('email.template.master', ['header' => '', 'slot' => '', 'settings' => $settings])->render()
);
$styles = $documents['master']->getElementsByTagName('style')->item(0)->nodeValue;
$documents['wrapper']->saveHTML();
$documents['body'] = new \DOMDocument();
$documents['body']->loadHTML(empty($body) ? '<div></div>' : mb_convert_encoding((new CssToInlineStyles())->convert($body, $styles), 'HTML-ENTITIES', 'UTF-8'));
$table_html ='
<table style="font-family:arial,helvetica,sans-serif;" role="presentation" cellpadding="0" cellspacing="0" width="100%" border="0">
<tbody>
<tr>
<td style="overflow-wrap:break-word;word-break:break-word;padding:5px;font-family:arial,helvetica,sans-serif;" align="left">
<div style="color: #000000; line-height: 140%; text-align: left; word-wrap: break-word;" id="table-content" class="content-contrast-color"></div>
</td>
</tr>
</tbody>
</table>';
foreach ($documents['body']->getElementsByTagName('body')->item(0)->childNodes as $element) {
$table = new \DOMDocument();
$table->loadHTML($table_html, LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD);
$element = $table->importNode($element, true);
$table->getElementById('table-content')->appendChild($element);
$node = $documents['wrapper']->importNode($table->documentElement, true);
$documents['wrapper']->getElementById('content-wrapper')->appendChild($node);
}
return $documents['wrapper']->getElementById('content-wrapper')->ownerDocument->saveHTML($documents['wrapper']->getElementById('content-wrapper'));
}
}

View File

@ -422,6 +422,11 @@ trait GeneratesCounter
*/
private function resetCounters(Client $client)
{
$reset_counter_frequency = (int)$client->getSetting('reset_counter_frequency_id');
if($reset_counter_frequency == 0)
return;
$timezone = Timezone::find($client->getSetting('timezone_id'));
$reset_date = Carbon::parse($client->getSetting('reset_counter_date'), $timezone->name);
@ -430,7 +435,7 @@ trait GeneratesCounter
return false;
}
switch ($client->company->reset_counter_frequency_id) {
switch ($reset_counter_frequency) {
case RecurringInvoice::FREQUENCY_DAILY:
$reset_date->addDay();
break;

View File

@ -66,6 +66,30 @@ trait Inviteable
}
}
public function getPortalLink() :string
{
$domain = isset($this->company->portal_domain) ?: $this->company->domain();
switch ($this->company->portal_mode) {
case 'subdomain':
return $domain.'/client/';
break;
case 'iframe':
return $domain.'/client/';
//return $domain . $entity_type .'/'. $this->contact->client->client_hash .'/'. $this->key;
break;
case 'domain':
return $domain.'/client/';
break;
default:
return '';
break;
}
}
public function getAdminLink() :string
{
return $this->getLink().'?silent=true';

View File

@ -40,11 +40,13 @@ trait SubscriptionHooker
RequestOptions::JSON => ['body' => $body], RequestOptions::ALLOW_REDIRECTS => false
]);
return $response;
return array_merge($body, ['exception' => json_decode($response->getBody(),true), 'status_code' => $response->getStatusCode()]);
}
catch(\Exception $e)
{
$body = array_merge($body, ['exception' => $e->getMessage()]);
//;
// dd($e);
$body = array_merge($body, ['exception' => ['message' => $e->getMessage(), 'status_code' => 500]]);
return $body;
}

View File

@ -65,6 +65,7 @@
"sentry/sentry-laravel": "^2",
"stripe/stripe-php": "^7.50",
"symfony/http-client": "^5.2",
"tijsverkoyen/css-to-inline-styles": "^2.2",
"turbo124/beacon": "^1.0",
"turbo124/laravel-gmail": "^5",
"webpatser/laravel-countries": "dev-master#75992ad",

482
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "7ccb8d2434343dfb0ba62866f0ee919a",
"content-hash": "f01381d3d00f0bd84acbda078ad1b99e",
"packages": [
{
"name": "authorizenet/authorizenet",
@ -51,16 +51,16 @@
},
{
"name": "aws/aws-sdk-php",
"version": "3.178.0",
"version": "3.178.6",
"source": {
"type": "git",
"url": "https://github.com/aws/aws-sdk-php.git",
"reference": "214e3d98c54277cd8965f1cf307dce39631407bf"
"reference": "0aa83b522d5ffa794c02e7411af87a0e241a3082"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/214e3d98c54277cd8965f1cf307dce39631407bf",
"reference": "214e3d98c54277cd8965f1cf307dce39631407bf",
"url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/0aa83b522d5ffa794c02e7411af87a0e241a3082",
"reference": "0aa83b522d5ffa794c02e7411af87a0e241a3082",
"shasum": ""
},
"require": {
@ -135,9 +135,9 @@
"support": {
"forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80",
"issues": "https://github.com/aws/aws-sdk-php/issues",
"source": "https://github.com/aws/aws-sdk-php/tree/3.178.0"
"source": "https://github.com/aws/aws-sdk-php/tree/3.178.6"
},
"time": "2021-04-08T18:13:16+00:00"
"time": "2021-04-19T18:13:17+00:00"
},
{
"name": "bacon/bacon-qr-code",
@ -1089,43 +1089,6 @@
},
"time": "2020-10-02T16:03:48+00:00"
},
{
"name": "dnoegel/php-xdg-base-dir",
"version": "v0.1.1",
"source": {
"type": "git",
"url": "https://github.com/dnoegel/php-xdg-base-dir.git",
"reference": "8f8a6e48c5ecb0f991c2fdcf5f154a47d85f9ffd"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/dnoegel/php-xdg-base-dir/zipball/8f8a6e48c5ecb0f991c2fdcf5f154a47d85f9ffd",
"reference": "8f8a6e48c5ecb0f991c2fdcf5f154a47d85f9ffd",
"shasum": ""
},
"require": {
"php": ">=5.3.2"
},
"require-dev": {
"phpunit/phpunit": "~7.0|~6.0|~5.0|~4.8.35"
},
"type": "library",
"autoload": {
"psr-4": {
"XdgBaseDir\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"description": "implementation of xdg base directory specification for php",
"support": {
"issues": "https://github.com/dnoegel/php-xdg-base-dir/issues",
"source": "https://github.com/dnoegel/php-xdg-base-dir/tree/v0.1.1"
},
"time": "2019-12-04T15:06:13+00:00"
},
{
"name": "doctrine/cache",
"version": "1.10.2",
@ -1228,16 +1191,16 @@
},
{
"name": "doctrine/dbal",
"version": "2.13.0",
"version": "2.13.1",
"source": {
"type": "git",
"url": "https://github.com/doctrine/dbal.git",
"reference": "67d56d3203b33db29834e6b2fcdbfdc50535d796"
"reference": "c800380457948e65bbd30ba92cc17cda108bf8c9"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/dbal/zipball/67d56d3203b33db29834e6b2fcdbfdc50535d796",
"reference": "67d56d3203b33db29834e6b2fcdbfdc50535d796",
"url": "https://api.github.com/repos/doctrine/dbal/zipball/c800380457948e65bbd30ba92cc17cda108bf8c9",
"reference": "c800380457948e65bbd30ba92cc17cda108bf8c9",
"shasum": ""
},
"require": {
@ -1252,6 +1215,7 @@
"jetbrains/phpstorm-stubs": "2020.2",
"phpstan/phpstan": "0.12.81",
"phpunit/phpunit": "^7.5.20|^8.5|9.5.0",
"squizlabs/php_codesniffer": "3.6.0",
"symfony/console": "^2.0.5|^3.0|^4.0|^5.0",
"vimeo/psalm": "4.6.4"
},
@ -1314,7 +1278,7 @@
],
"support": {
"issues": "https://github.com/doctrine/dbal/issues",
"source": "https://github.com/doctrine/dbal/tree/2.13.0"
"source": "https://github.com/doctrine/dbal/tree/2.13.1"
},
"funding": [
{
@ -1330,7 +1294,7 @@
"type": "tidelift"
}
],
"time": "2021-03-28T18:10:53+00:00"
"time": "2021-04-17T17:30:19+00:00"
},
{
"name": "doctrine/deprecations",
@ -2021,16 +1985,16 @@
},
{
"name": "google/apiclient-services",
"version": "v0.167.0",
"version": "v0.170.0",
"source": {
"type": "git",
"url": "https://github.com/googleapis/google-api-php-client-services.git",
"reference": "46b71684a100f3d976e0321cf24f487b314add68"
"reference": "b45ddc3d82b2c8f328d869d55db88c1885d898ee"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/googleapis/google-api-php-client-services/zipball/46b71684a100f3d976e0321cf24f487b314add68",
"reference": "46b71684a100f3d976e0321cf24f487b314add68",
"url": "https://api.github.com/repos/googleapis/google-api-php-client-services/zipball/b45ddc3d82b2c8f328d869d55db88c1885d898ee",
"reference": "b45ddc3d82b2c8f328d869d55db88c1885d898ee",
"shasum": ""
},
"require": {
@ -2056,9 +2020,9 @@
],
"support": {
"issues": "https://github.com/googleapis/google-api-php-client-services/issues",
"source": "https://github.com/googleapis/google-api-php-client-services/tree/v0.167.0"
"source": "https://github.com/googleapis/google-api-php-client-services/tree/v0.170.0"
},
"time": "2021-03-22T11:26:04+00:00"
"time": "2021-04-20T20:34:12+00:00"
},
{
"name": "google/auth",
@ -2795,16 +2759,16 @@
},
{
"name": "laravel/framework",
"version": "v8.36.2",
"version": "v8.38.0",
"source": {
"type": "git",
"url": "https://github.com/laravel/framework.git",
"reference": "0debd8ad6b5aa1f61ccc73910adf049af4ca0444"
"reference": "26a73532c54d2c090692bf2e3e64e449669053ba"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/laravel/framework/zipball/0debd8ad6b5aa1f61ccc73910adf049af4ca0444",
"reference": "0debd8ad6b5aa1f61ccc73910adf049af4ca0444",
"url": "https://api.github.com/repos/laravel/framework/zipball/26a73532c54d2c090692bf2e3e64e449669053ba",
"reference": "26a73532c54d2c090692bf2e3e64e449669053ba",
"shasum": ""
},
"require": {
@ -2959,7 +2923,7 @@
"issues": "https://github.com/laravel/framework/issues",
"source": "https://github.com/laravel/framework"
},
"time": "2021-04-07T12:37:22+00:00"
"time": "2021-04-20T13:50:21+00:00"
},
{
"name": "laravel/slack-notification-channel",
@ -3320,16 +3284,16 @@
},
{
"name": "league/csv",
"version": "9.7.0",
"version": "9.7.1",
"source": {
"type": "git",
"url": "https://github.com/thephpleague/csv.git",
"reference": "4cacd9c72c4aa8bdbef43315b2ca25c46a0f833f"
"reference": "0ec57e8264ec92565974ead0d1724cf1026e10c1"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/thephpleague/csv/zipball/4cacd9c72c4aa8bdbef43315b2ca25c46a0f833f",
"reference": "4cacd9c72c4aa8bdbef43315b2ca25c46a0f833f",
"url": "https://api.github.com/repos/thephpleague/csv/zipball/0ec57e8264ec92565974ead0d1724cf1026e10c1",
"reference": "0ec57e8264ec92565974ead0d1724cf1026e10c1",
"shasum": ""
},
"require": {
@ -3400,7 +3364,7 @@
"type": "github"
}
],
"time": "2021-03-26T22:08:10+00:00"
"time": "2021-04-17T16:32:08+00:00"
},
{
"name": "league/flysystem",
@ -3858,16 +3822,16 @@
},
{
"name": "livewire/livewire",
"version": "v2.4.2",
"version": "v2.4.3",
"source": {
"type": "git",
"url": "https://github.com/livewire/livewire.git",
"reference": "2495387841a3eb03ac62b2c984ccd2574303285b"
"reference": "69575f50bb7f8a49a41f9bd6bd16c73a6ef4fda3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/livewire/livewire/zipball/2495387841a3eb03ac62b2c984ccd2574303285b",
"reference": "2495387841a3eb03ac62b2c984ccd2574303285b",
"url": "https://api.github.com/repos/livewire/livewire/zipball/69575f50bb7f8a49a41f9bd6bd16c73a6ef4fda3",
"reference": "69575f50bb7f8a49a41f9bd6bd16c73a6ef4fda3",
"shasum": ""
},
"require": {
@ -3918,7 +3882,7 @@
"description": "A front-end framework for Laravel.",
"support": {
"issues": "https://github.com/livewire/livewire/issues",
"source": "https://github.com/livewire/livewire/tree/v2.4.2"
"source": "https://github.com/livewire/livewire/tree/v2.4.3"
},
"funding": [
{
@ -3926,7 +3890,7 @@
"type": "github"
}
],
"time": "2021-04-04T15:46:50+00:00"
"time": "2021-04-16T14:27:45+00:00"
},
{
"name": "maennchen/zipstream-php",
@ -4756,16 +4720,16 @@
},
{
"name": "opis/closure",
"version": "3.6.1",
"version": "3.6.2",
"source": {
"type": "git",
"url": "https://github.com/opis/closure.git",
"reference": "943b5d70cc5ae7483f6aff6ff43d7e34592ca0f5"
"reference": "06e2ebd25f2869e54a306dda991f7db58066f7f6"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/opis/closure/zipball/943b5d70cc5ae7483f6aff6ff43d7e34592ca0f5",
"reference": "943b5d70cc5ae7483f6aff6ff43d7e34592ca0f5",
"url": "https://api.github.com/repos/opis/closure/zipball/06e2ebd25f2869e54a306dda991f7db58066f7f6",
"reference": "06e2ebd25f2869e54a306dda991f7db58066f7f6",
"shasum": ""
},
"require": {
@ -4815,9 +4779,9 @@
],
"support": {
"issues": "https://github.com/opis/closure/issues",
"source": "https://github.com/opis/closure/tree/3.6.1"
"source": "https://github.com/opis/closure/tree/3.6.2"
},
"time": "2020-11-07T02:01:34+00:00"
"time": "2021-04-09T13:42:10+00:00"
},
{
"name": "paragonie/constant_time_encoding",
@ -5460,16 +5424,16 @@
},
{
"name": "phpseclib/phpseclib",
"version": "3.0.7",
"version": "3.0.8",
"source": {
"type": "git",
"url": "https://github.com/phpseclib/phpseclib.git",
"reference": "d369510df0ebd5e1a5d0fe3d4d23c55fa87a403d"
"reference": "d9615a6fb970d9933866ca8b4036ec3407b020b6"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/d369510df0ebd5e1a5d0fe3d4d23c55fa87a403d",
"reference": "d369510df0ebd5e1a5d0fe3d4d23c55fa87a403d",
"url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/d9615a6fb970d9933866ca8b4036ec3407b020b6",
"reference": "d9615a6fb970d9933866ca8b4036ec3407b020b6",
"shasum": ""
},
"require": {
@ -5551,7 +5515,7 @@
],
"support": {
"issues": "https://github.com/phpseclib/phpseclib/issues",
"source": "https://github.com/phpseclib/phpseclib/tree/3.0.7"
"source": "https://github.com/phpseclib/phpseclib/tree/3.0.8"
},
"funding": [
{
@ -5567,7 +5531,7 @@
"type": "tidelift"
}
],
"time": "2021-04-06T14:00:11+00:00"
"time": "2021-04-19T03:20:48+00:00"
},
{
"name": "pragmarx/google2fa",
@ -6097,20 +6061,19 @@
},
{
"name": "psy/psysh",
"version": "v0.10.7",
"version": "v0.10.8",
"source": {
"type": "git",
"url": "https://github.com/bobthecow/psysh.git",
"reference": "a395af46999a12006213c0c8346c9445eb31640c"
"reference": "e4573f47750dd6c92dca5aee543fa77513cbd8d3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/bobthecow/psysh/zipball/a395af46999a12006213c0c8346c9445eb31640c",
"reference": "a395af46999a12006213c0c8346c9445eb31640c",
"url": "https://api.github.com/repos/bobthecow/psysh/zipball/e4573f47750dd6c92dca5aee543fa77513cbd8d3",
"reference": "e4573f47750dd6c92dca5aee543fa77513cbd8d3",
"shasum": ""
},
"require": {
"dnoegel/php-xdg-base-dir": "0.1.*",
"ext-json": "*",
"ext-tokenizer": "*",
"nikic/php-parser": "~4.0|~3.0|~2.0|~1.3",
@ -6167,9 +6130,9 @@
],
"support": {
"issues": "https://github.com/bobthecow/psysh/issues",
"source": "https://github.com/bobthecow/psysh/tree/v0.10.7"
"source": "https://github.com/bobthecow/psysh/tree/v0.10.8"
},
"time": "2021-03-14T02:14:56+00:00"
"time": "2021-04-10T16:23:39+00:00"
},
{
"name": "ralouphie/getallheaders",
@ -6920,16 +6883,16 @@
},
{
"name": "stripe/stripe-php",
"version": "v7.76.0",
"version": "v7.77.0",
"source": {
"type": "git",
"url": "https://github.com/stripe/stripe-php.git",
"reference": "47e66d4186712be33c593fe820dccf270a04d5d6"
"reference": "f6724447481f6fb8c2e714165e092adad9ca470a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/stripe/stripe-php/zipball/47e66d4186712be33c593fe820dccf270a04d5d6",
"reference": "47e66d4186712be33c593fe820dccf270a04d5d6",
"url": "https://api.github.com/repos/stripe/stripe-php/zipball/f6724447481f6fb8c2e714165e092adad9ca470a",
"reference": "f6724447481f6fb8c2e714165e092adad9ca470a",
"shasum": ""
},
"require": {
@ -6975,9 +6938,9 @@
],
"support": {
"issues": "https://github.com/stripe/stripe-php/issues",
"source": "https://github.com/stripe/stripe-php/tree/v7.76.0"
"source": "https://github.com/stripe/stripe-php/tree/v7.77.0"
},
"time": "2021-03-22T16:50:21+00:00"
"time": "2021-04-12T17:19:16+00:00"
},
{
"name": "swiftmailer/swiftmailer",
@ -7218,16 +7181,16 @@
},
{
"name": "symfony/deprecation-contracts",
"version": "v2.2.0",
"version": "v2.4.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/deprecation-contracts.git",
"reference": "5fa56b4074d1ae755beb55617ddafe6f5d78f665"
"reference": "5f38c8804a9e97d23e0c8d63341088cd8a22d627"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/5fa56b4074d1ae755beb55617ddafe6f5d78f665",
"reference": "5fa56b4074d1ae755beb55617ddafe6f5d78f665",
"url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/5f38c8804a9e97d23e0c8d63341088cd8a22d627",
"reference": "5f38c8804a9e97d23e0c8d63341088cd8a22d627",
"shasum": ""
},
"require": {
@ -7236,7 +7199,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.2-dev"
"dev-main": "2.4-dev"
},
"thanks": {
"name": "symfony/contracts",
@ -7265,7 +7228,7 @@
"description": "A generic function and convention to trigger deprecation notices",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/deprecation-contracts/tree/master"
"source": "https://github.com/symfony/deprecation-contracts/tree/v2.4.0"
},
"funding": [
{
@ -7281,7 +7244,7 @@
"type": "tidelift"
}
],
"time": "2020-09-07T11:33:47+00:00"
"time": "2021-03-23T23:28:01+00:00"
},
{
"name": "symfony/error-handler",
@ -7439,16 +7402,16 @@
},
{
"name": "symfony/event-dispatcher-contracts",
"version": "v2.2.0",
"version": "v2.4.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/event-dispatcher-contracts.git",
"reference": "0ba7d54483095a198fa51781bc608d17e84dffa2"
"reference": "69fee1ad2332a7cbab3aca13591953da9cdb7a11"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/0ba7d54483095a198fa51781bc608d17e84dffa2",
"reference": "0ba7d54483095a198fa51781bc608d17e84dffa2",
"url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/69fee1ad2332a7cbab3aca13591953da9cdb7a11",
"reference": "69fee1ad2332a7cbab3aca13591953da9cdb7a11",
"shasum": ""
},
"require": {
@ -7461,7 +7424,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.2-dev"
"dev-main": "2.4-dev"
},
"thanks": {
"name": "symfony/contracts",
@ -7498,7 +7461,7 @@
"standards"
],
"support": {
"source": "https://github.com/symfony/event-dispatcher-contracts/tree/v2.2.0"
"source": "https://github.com/symfony/event-dispatcher-contracts/tree/v2.4.0"
},
"funding": [
{
@ -7514,7 +7477,7 @@
"type": "tidelift"
}
],
"time": "2020-09-07T11:33:47+00:00"
"time": "2021-03-23T23:28:01+00:00"
},
{
"name": "symfony/filesystem",
@ -7727,16 +7690,16 @@
},
{
"name": "symfony/http-client-contracts",
"version": "v2.3.1",
"version": "v2.4.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/http-client-contracts.git",
"reference": "41db680a15018f9c1d4b23516059633ce280ca33"
"reference": "7e82f6084d7cae521a75ef2cb5c9457bbda785f4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/http-client-contracts/zipball/41db680a15018f9c1d4b23516059633ce280ca33",
"reference": "41db680a15018f9c1d4b23516059633ce280ca33",
"url": "https://api.github.com/repos/symfony/http-client-contracts/zipball/7e82f6084d7cae521a75ef2cb5c9457bbda785f4",
"reference": "7e82f6084d7cae521a75ef2cb5c9457bbda785f4",
"shasum": ""
},
"require": {
@ -7747,9 +7710,8 @@
},
"type": "library",
"extra": {
"branch-version": "2.3",
"branch-alias": {
"dev-main": "2.3-dev"
"dev-main": "2.4-dev"
},
"thanks": {
"name": "symfony/contracts",
@ -7786,7 +7748,7 @@
"standards"
],
"support": {
"source": "https://github.com/symfony/http-client-contracts/tree/v2.3.1"
"source": "https://github.com/symfony/http-client-contracts/tree/v2.4.0"
},
"funding": [
{
@ -7802,7 +7764,7 @@
"type": "tidelift"
}
],
"time": "2020-10-14T17:08:19+00:00"
"time": "2021-04-11T23:07:08+00:00"
},
{
"name": "symfony/http-foundation",
@ -9191,21 +9153,21 @@
},
{
"name": "symfony/service-contracts",
"version": "v2.2.0",
"version": "v2.4.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/service-contracts.git",
"reference": "d15da7ba4957ffb8f1747218be9e1a121fd298a1"
"reference": "f040a30e04b57fbcc9c6cbcf4dbaa96bd318b9bb"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/service-contracts/zipball/d15da7ba4957ffb8f1747218be9e1a121fd298a1",
"reference": "d15da7ba4957ffb8f1747218be9e1a121fd298a1",
"url": "https://api.github.com/repos/symfony/service-contracts/zipball/f040a30e04b57fbcc9c6cbcf4dbaa96bd318b9bb",
"reference": "f040a30e04b57fbcc9c6cbcf4dbaa96bd318b9bb",
"shasum": ""
},
"require": {
"php": ">=7.2.5",
"psr/container": "^1.0"
"psr/container": "^1.1"
},
"suggest": {
"symfony/service-implementation": ""
@ -9213,7 +9175,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.2-dev"
"dev-main": "2.4-dev"
},
"thanks": {
"name": "symfony/contracts",
@ -9250,7 +9212,7 @@
"standards"
],
"support": {
"source": "https://github.com/symfony/service-contracts/tree/master"
"source": "https://github.com/symfony/service-contracts/tree/v2.4.0"
},
"funding": [
{
@ -9266,7 +9228,7 @@
"type": "tidelift"
}
],
"time": "2020-09-07T11:33:47+00:00"
"time": "2021-04-01T10:43:52+00:00"
},
{
"name": "symfony/string",
@ -9446,16 +9408,16 @@
},
{
"name": "symfony/translation-contracts",
"version": "v2.3.0",
"version": "v2.4.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/translation-contracts.git",
"reference": "e2eaa60b558f26a4b0354e1bbb25636efaaad105"
"reference": "95c812666f3e91db75385749fe219c5e494c7f95"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/translation-contracts/zipball/e2eaa60b558f26a4b0354e1bbb25636efaaad105",
"reference": "e2eaa60b558f26a4b0354e1bbb25636efaaad105",
"url": "https://api.github.com/repos/symfony/translation-contracts/zipball/95c812666f3e91db75385749fe219c5e494c7f95",
"reference": "95c812666f3e91db75385749fe219c5e494c7f95",
"shasum": ""
},
"require": {
@ -9467,7 +9429,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.3-dev"
"dev-main": "2.4-dev"
},
"thanks": {
"name": "symfony/contracts",
@ -9504,7 +9466,7 @@
"standards"
],
"support": {
"source": "https://github.com/symfony/translation-contracts/tree/v2.3.0"
"source": "https://github.com/symfony/translation-contracts/tree/v2.4.0"
},
"funding": [
{
@ -9520,7 +9482,7 @@
"type": "tidelift"
}
],
"time": "2020-09-28T13:05:58+00:00"
"time": "2021-03-23T23:28:01+00:00"
},
{
"name": "symfony/var-dumper",
@ -10723,6 +10685,43 @@
],
"time": "2020-12-08T13:29:20+00:00"
},
{
"name": "dnoegel/php-xdg-base-dir",
"version": "v0.1.1",
"source": {
"type": "git",
"url": "https://github.com/dnoegel/php-xdg-base-dir.git",
"reference": "8f8a6e48c5ecb0f991c2fdcf5f154a47d85f9ffd"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/dnoegel/php-xdg-base-dir/zipball/8f8a6e48c5ecb0f991c2fdcf5f154a47d85f9ffd",
"reference": "8f8a6e48c5ecb0f991c2fdcf5f154a47d85f9ffd",
"shasum": ""
},
"require": {
"php": ">=5.3.2"
},
"require-dev": {
"phpunit/phpunit": "~7.0|~6.0|~5.0|~4.8.35"
},
"type": "library",
"autoload": {
"psr-4": {
"XdgBaseDir\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"description": "implementation of xdg base directory specification for php",
"support": {
"issues": "https://github.com/dnoegel/php-xdg-base-dir/issues",
"source": "https://github.com/dnoegel/php-xdg-base-dir/tree/v0.1.1"
},
"time": "2019-12-04T15:06:13+00:00"
},
{
"name": "doctrine/annotations",
"version": "1.12.1",
@ -10864,16 +10863,16 @@
},
{
"name": "facade/flare-client-php",
"version": "1.6.1",
"version": "1.7.0",
"source": {
"type": "git",
"url": "https://github.com/facade/flare-client-php.git",
"reference": "f2b0969f2d9594704be74dbeb25b201570a98098"
"reference": "6bf380035890cb0a09b9628c491ae3866b858522"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/facade/flare-client-php/zipball/f2b0969f2d9594704be74dbeb25b201570a98098",
"reference": "f2b0969f2d9594704be74dbeb25b201570a98098",
"url": "https://api.github.com/repos/facade/flare-client-php/zipball/6bf380035890cb0a09b9628c491ae3866b858522",
"reference": "6bf380035890cb0a09b9628c491ae3866b858522",
"shasum": ""
},
"require": {
@ -10917,7 +10916,7 @@
],
"support": {
"issues": "https://github.com/facade/flare-client-php/issues",
"source": "https://github.com/facade/flare-client-php/tree/1.6.1"
"source": "https://github.com/facade/flare-client-php/tree/1.7.0"
},
"funding": [
{
@ -10925,20 +10924,20 @@
"type": "github"
}
],
"time": "2021-04-08T08:50:01+00:00"
"time": "2021-04-12T09:30:36+00:00"
},
{
"name": "facade/ignition",
"version": "2.8.2",
"version": "2.8.3",
"source": {
"type": "git",
"url": "https://github.com/facade/ignition.git",
"reference": "cb7f790e6306caeb4a9ffe21e59942b7128cc630"
"reference": "a8201d51aae83addceaef9344592a3b068b5d64d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/facade/ignition/zipball/cb7f790e6306caeb4a9ffe21e59942b7128cc630",
"reference": "cb7f790e6306caeb4a9ffe21e59942b7128cc630",
"url": "https://api.github.com/repos/facade/ignition/zipball/a8201d51aae83addceaef9344592a3b068b5d64d",
"reference": "a8201d51aae83addceaef9344592a3b068b5d64d",
"shasum": ""
},
"require": {
@ -11002,7 +11001,7 @@
"issues": "https://github.com/facade/ignition/issues",
"source": "https://github.com/facade/ignition"
},
"time": "2021-04-08T10:42:53+00:00"
"time": "2021-04-09T20:45:59+00:00"
},
{
"name": "facade/ignition-contracts",
@ -11231,21 +11230,21 @@
},
{
"name": "friendsofphp/php-cs-fixer",
"version": "v2.18.5",
"version": "v2.18.6",
"source": {
"type": "git",
"url": "https://github.com/FriendsOfPHP/PHP-CS-Fixer.git",
"reference": "e0f6d05c8b157f50029ca6c65c19ed2694f475bf"
"reference": "5fed214993e7863cef88a08f214344891299b9e4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/e0f6d05c8b157f50029ca6c65c19ed2694f475bf",
"reference": "e0f6d05c8b157f50029ca6c65c19ed2694f475bf",
"url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/5fed214993e7863cef88a08f214344891299b9e4",
"reference": "5fed214993e7863cef88a08f214344891299b9e4",
"shasum": ""
},
"require": {
"composer/semver": "^1.4 || ^2.0 || ^3.0",
"composer/xdebug-handler": "^1.2",
"composer/xdebug-handler": "^1.2 || ^2.0",
"doctrine/annotations": "^1.2",
"ext-json": "*",
"ext-tokenizer": "*",
@ -11323,7 +11322,7 @@
"description": "A tool to automatically fix PHP code style",
"support": {
"issues": "https://github.com/FriendsOfPHP/PHP-CS-Fixer/issues",
"source": "https://github.com/FriendsOfPHP/PHP-CS-Fixer/tree/v2.18.5"
"source": "https://github.com/FriendsOfPHP/PHP-CS-Fixer/tree/v2.18.6"
},
"funding": [
{
@ -11331,7 +11330,7 @@
"type": "github"
}
],
"time": "2021-04-06T18:37:33+00:00"
"time": "2021-04-19T19:45:11+00:00"
},
{
"name": "hamcrest/hamcrest-php",
@ -11632,16 +11631,16 @@
},
{
"name": "nunomaduro/collision",
"version": "v5.3.0",
"version": "v5.4.0",
"source": {
"type": "git",
"url": "https://github.com/nunomaduro/collision.git",
"reference": "aca63581f380f63a492b1e3114604e411e39133a"
"reference": "41b7e9999133d5082700d31a1d0977161df8322a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/nunomaduro/collision/zipball/aca63581f380f63a492b1e3114604e411e39133a",
"reference": "aca63581f380f63a492b1e3114604e411e39133a",
"url": "https://api.github.com/repos/nunomaduro/collision/zipball/41b7e9999133d5082700d31a1d0977161df8322a",
"reference": "41b7e9999133d5082700d31a1d0977161df8322a",
"shasum": ""
},
"require": {
@ -11716,104 +11715,7 @@
"type": "patreon"
}
],
"time": "2021-01-25T15:34:13+00:00"
},
{
"name": "nunomaduro/larastan",
"version": "v0.7.3",
"source": {
"type": "git",
"url": "https://github.com/nunomaduro/larastan.git",
"reference": "9c515d46851dca5a99fc82c0a69392c362b7affd"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/nunomaduro/larastan/zipball/9c515d46851dca5a99fc82c0a69392c362b7affd",
"reference": "9c515d46851dca5a99fc82c0a69392c362b7affd",
"shasum": ""
},
"require": {
"composer/composer": "^1.0 || ^2.0",
"ext-json": "*",
"illuminate/console": "^6.0 || ^7.0 || ^8.0 || ^9.0",
"illuminate/container": "^6.0 || ^7.0 || ^8.0 || ^9.0",
"illuminate/contracts": "^6.0 || ^7.0 || ^8.0 || ^9.0",
"illuminate/database": "^6.0 || ^7.0 || ^8.0 || ^9.0",
"illuminate/http": "^6.0 || ^7.0 || ^8.0 || ^9.0",
"illuminate/pipeline": "^6.0 || ^7.0 || ^8.0 || ^9.0",
"illuminate/support": "^6.0 || ^7.0 || ^8.0 || ^9.0",
"mockery/mockery": "^0.9 || ^1.0",
"php": "^7.2 || ^8.0",
"phpstan/phpstan": "^0.12.83",
"symfony/process": "^4.3 || ^5.0"
},
"require-dev": {
"orchestra/testbench": "^4.0 || ^5.0 || ^6.0 || ^7.0",
"phpunit/phpunit": "^7.3 || ^8.2 || ^9.3"
},
"suggest": {
"orchestra/testbench": "^4.0 || ^5.0"
},
"type": "phpstan-extension",
"extra": {
"branch-alias": {
"dev-master": "0.6-dev"
},
"phpstan": {
"includes": [
"extension.neon"
]
}
},
"autoload": {
"psr-4": {
"NunoMaduro\\Larastan\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Nuno Maduro",
"email": "enunomaduro@gmail.com"
}
],
"description": "Larastan - Discover bugs in your code without running it. A phpstan/phpstan wrapper for Laravel",
"keywords": [
"PHPStan",
"code analyse",
"code analysis",
"larastan",
"laravel",
"package",
"php",
"static analysis"
],
"support": {
"issues": "https://github.com/nunomaduro/larastan/issues",
"source": "https://github.com/nunomaduro/larastan/tree/v0.7.3"
},
"funding": [
{
"url": "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=66BYDWAT92N6L",
"type": "custom"
},
{
"url": "https://github.com/canvural",
"type": "github"
},
{
"url": "https://github.com/nunomaduro",
"type": "github"
},
{
"url": "https://www.patreon.com/nunomaduro",
"type": "patreon"
}
],
"time": "2021-04-12T11:01:46+00:00"
"time": "2021-04-09T13:38:32+00:00"
},
{
"name": "openlss/lib-array2xml",
@ -12259,66 +12161,6 @@
},
"time": "2021-03-17T13:42:18+00:00"
},
{
"name": "phpstan/phpstan",
"version": "0.12.83",
"source": {
"type": "git",
"url": "https://github.com/phpstan/phpstan.git",
"reference": "4a967cec6efb46b500dd6d768657336a3ffe699f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/4a967cec6efb46b500dd6d768657336a3ffe699f",
"reference": "4a967cec6efb46b500dd6d768657336a3ffe699f",
"shasum": ""
},
"require": {
"php": "^7.1|^8.0"
},
"conflict": {
"phpstan/phpstan-shim": "*"
},
"bin": [
"phpstan",
"phpstan.phar"
],
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "0.12-dev"
}
},
"autoload": {
"files": [
"bootstrap.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"description": "PHPStan - PHP Static Analysis Tool",
"support": {
"issues": "https://github.com/phpstan/phpstan/issues",
"source": "https://github.com/phpstan/phpstan/tree/0.12.83"
},
"funding": [
{
"url": "https://github.com/ondrejmirtes",
"type": "github"
},
{
"url": "https://www.patreon.com/phpstan",
"type": "patreon"
},
{
"url": "https://tidelift.com/funding/github/packagist/phpstan/phpstan",
"type": "tidelift"
}
],
"time": "2021-04-03T15:35:45+00:00"
},
{
"name": "phpunit/php-code-coverage",
"version": "9.2.6",
@ -13706,16 +13548,16 @@
},
{
"name": "swagger-api/swagger-ui",
"version": "v3.46.0",
"version": "v3.47.1",
"source": {
"type": "git",
"url": "https://github.com/swagger-api/swagger-ui.git",
"reference": "cc408812fc927e265da158bf68239530740ab4cc"
"reference": "0f8548c0d443fa37f10a45948d5f2babf685c657"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/swagger-api/swagger-ui/zipball/cc408812fc927e265da158bf68239530740ab4cc",
"reference": "cc408812fc927e265da158bf68239530740ab4cc",
"url": "https://api.github.com/repos/swagger-api/swagger-ui/zipball/0f8548c0d443fa37f10a45948d5f2babf685c657",
"reference": "0f8548c0d443fa37f10a45948d5f2babf685c657",
"shasum": ""
},
"type": "library",
@ -13761,9 +13603,9 @@
],
"support": {
"issues": "https://github.com/swagger-api/swagger-ui/issues",
"source": "https://github.com/swagger-api/swagger-ui/tree/v3.46.0"
"source": "https://github.com/swagger-api/swagger-ui/tree/v3.47.1"
},
"time": "2021-03-31T18:50:40+00:00"
"time": "2021-04-15T21:56:21+00:00"
},
{
"name": "symfony/debug",

View File

@ -101,4 +101,4 @@ return [
'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_cache'),
];
];

View File

@ -14,8 +14,8 @@ return [
'require_https' => env('REQUIRE_HTTPS', true),
'app_url' => rtrim(env('APP_URL', ''), '/'),
'app_domain' => env('APP_DOMAIN', ''),
'app_version' => '5.1.44',
'app_tag' => '5.1.44-release',
'app_version' => '5.1.50',
'app_tag' => '5.1.50-release',
'minimum_client_version' => '5.0.16',
'terms_version' => '1.0.1',
'api_secret' => env('API_SECRET', false),

View File

@ -86,4 +86,4 @@ return [
'table' => 'failed_jobs',
],
];
];

View File

@ -36,7 +36,7 @@ class IdNumberFieldsForMissingEntities extends Migration
Schema::table('vendors', function (Blueprint $table) {
$table->text('vendor_hash')->nullable();
$table->text('public_notes')->nullable();
$table->unique(['company_id', 'number']);
// $table->unique(['company_id', 'number']);
});
Schema::table('vendor_contacts', function (Blueprint $table) {

View File

@ -41,17 +41,17 @@ class ConstantsSeeder extends Seeder
$timezones[] = ['name'=>'US/Samoa', 'location' => '(GMT-11:00) Samoa', 'utc_offset' => -39600];
$timezones[] = ['name'=>'US/Hawaii', 'location' => '(GMT-10:00) Hawaii', 'utc_offset' => -36000];
$timezones[] = ['name'=>'US/Alaska', 'location' => '(GMT-09:00) Alaska', 'utc_offset' => -32400];
$timezones[] = ['name'=>'US/Pacific', 'location' => '(GMT-08:00) Pacific Time (US &amp; Canada)', 'utc_offset' => -28800];
$timezones[] = ['name'=>'US/Pacific', 'location' => '(GMT-08:00) Pacific Time (US & Canada)', 'utc_offset' => -28800];
$timezones[] = ['name'=>'America/Tijuana', 'location' => '(GMT-08:00) Tijuana', 'utc_offset' => -28800];
$timezones[] = ['name'=>'US/Arizona', 'location' => '(GMT-07:00) Arizona', 'utc_offset' => -25200];
$timezones[] = ['name'=>'US/Mountain', 'location' => '(GMT-07:00) Mountain Time (US &amp; Canada)', 'utc_offset' => -25200];
$timezones[] = ['name'=>'US/Mountain', 'location' => '(GMT-07:00) Mountain Time (US & Canada)', 'utc_offset' => -25200];
$timezones[] = ['name'=>'America/Chihuahua', 'location' => '(GMT-07:00) Chihuahua', 'utc_offset' => -25200];
$timezones[] = ['name'=>'America/Mazatlan', 'location' => '(GMT-07:00) Mazatlan', 'utc_offset' => -25200];
$timezones[] = ['name'=>'America/Mexico_City', 'location' => '(GMT-06:00) Mexico City', 'utc_offset' => -21600];
$timezones[] = ['name'=>'America/Monterrey', 'location' => '(GMT-06:00) Monterrey', 'utc_offset' => -21600];
$timezones[] = ['name'=>'Canada/Saskatchewan', 'location' => '(GMT-06:00) Saskatchewan', 'utc_offset' => -21600];
$timezones[] = ['name'=>'US/Central', 'location' => '(GMT-06:00) Central Time (US &amp; Canada)', 'utc_offset' => -21600];
$timezones[] = ['name'=>'US/Eastern', 'location' => '(GMT-05:00) Eastern Time (US &amp; Canada)', 'utc_offset' => -18000];
$timezones[] = ['name'=>'US/Central', 'location' => '(GMT-06:00) Central Time (US & Canada)', 'utc_offset' => -21600];
$timezones[] = ['name'=>'US/Eastern', 'location' => '(GMT-05:00) Eastern Time (US & Canada)', 'utc_offset' => -18000];
$timezones[] = ['name'=>'US/East-Indiana', 'location' => '(GMT-05:00) Indiana (East)', 'utc_offset' => -18000];
$timezones[] = ['name'=>'America/Bogota', 'location' => '(GMT-05:00) Bogota', 'utc_offset' => -18000];
$timezones[] = ['name'=>'America/Lima', 'location' => '(GMT-05:00) Lima', 'utc_offset' => -18000];

View File

@ -19,3 +19,8 @@
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
<IfModule mod_headers.c>
# Blocks Search Engine Indexing
Header set X-Robots-Tag "noindex, nofollow"
</IfModule>

View File

@ -31,8 +31,8 @@ const RESOURCES = {
"assets/assets/images/payment_types/paypal.png": "8e06c094c1871376dfea1da8088c29d1",
"assets/assets/images/payment_types/maestro.png": "e533b92bfb50339fdbfa79e3dfe81f08",
"assets/FontManifest.json": "cf3c681641169319e61b61bd0277378f",
"main.dart.js": "7387bc998747d4eda2e0fec919800d62",
"version.json": "e021a7a1750aa3e7d1d89b51ac9837e9"
"main.dart.js": "2606c752bb7b06928a46ef443e9909e5",
"version.json": "b66865cd7c928a62b1b7809cad4d5f8c"
};
// The application shell files that are downloaded before a service worker can

Binary file not shown.

After

Width:  |  Height:  |  Size: 101 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 164 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

255828
public/main.dart.js vendored

File diff suppressed because one or more lines are too long

253591
public/main.foss.dart.js vendored

File diff suppressed because one or more lines are too long

257800
public/main.wasm.dart.js vendored

File diff suppressed because one or more lines are too long

View File

@ -1,2 +1,2 @@
User-agent: *
Disallow:
Disallow: /

View File

@ -1 +1 @@
{"app_name":"invoiceninja_flutter","version":"5.0.45","build_number":"45"}
{"app_name":"invoiceninja_flutter","version":"5.0.46","build_number":"46"}

View File

@ -4210,7 +4210,7 @@ $LANG = array(
'activity_83' => ':user deleted subscription :subscription',
'activity_84' => ':user restored subscription :subscription',
'amount_greater_than_balance_v5' => 'The amount is greater than the invoice balance. You cannot overpay an invoice.',
'click_to_continue' => 'Click to continue',
);
return $LANG;

File diff suppressed because it is too large Load Diff

View File

@ -2,113 +2,303 @@
if(!isset($design)) {
$design = 'light';
}
$primary_color = isset($settings) ? $settings->primary_color : '#4caf50';
@endphp
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional //EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<!--[if gte mso 9]>
<xml>
<o:OfficeDocumentSettings>
<o:AllowPNG/>
<o:PixelsPerInch>96</o:PixelsPerInch>
</o:OfficeDocumentSettings>
</xml>
<![endif]-->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="x-apple-disable-message-reformatting">
<!--[if !mso]><!--><meta http-equiv="X-UA-Compatible" content="IE=edge"><!--<![endif]-->
<title></title>
<style type="text/css">
a {
color: #0000ee;
text-decoration: underline;
}
@media only screen and (min-width: 520px) {
.u-row {
width: 500px !important;
}
.u-row .u-col {
vertical-align: top;
}
.u-row .u-col-100 {
width: 500px !important;
}
}
@media (max-width: 520px) {
.u-row-container {
max-width: 100% !important;
padding-left: 0px !important;
padding-right: 0px !important;
}
.u-row .u-col {
min-width: 320px !important;
max-width: 100% !important;
display: block !important;
}
.u-row {
width: calc(100% - 40px) !important;
}
.u-col {
width: 100% !important;
}
.u-col>div {
margin: 0 auto;
}
}
body {
margin: 0;
padding: 0;
}
table,
tr,
td {
vertical-align: top;
border-collapse: collapse;
}
p {
margin: 0;
}
.ie-container table,
.mso-container table {
table-layout: fixed;
}
* {
line-height: inherit;
}
a[x-apple-data-detectors='true'] {
color: inherit !important;
text-decoration: none !important;
}
.header-logo {
outline: none;
text-decoration: none;
-ms-interpolation-mode: bicubic;
clear: both;
display: inline-block !important;
border: none;
height: auto;
float: none;
width: 60%;
max-width: 288px;
}
h1 {
margin: 0px; color: #000000; line-height: 140%; text-align: left; word-wrap: break-word; font-weight: normal; font-family: arial,helvetica,sans-serif; font-size: 22px;
}
p {
font-size: 14px; line-height: 140%
}
.button {
padding: 12px;
box-sizing: border-box;
display: inline-block;
font-family: arial, helvetica, sans-serif;
text-decoration: none;
-webkit-text-size-adjust: none;
text-align: center;
color: #FFFFFF;
background-color: {{ $primary_color }} !important;
border-radius: 4px;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
width: auto;
max-width: 100%;
overflow-wrap: break-word;
word-break: break-word;
word-wrap: break-word;
mso-border-alt: none;
}
.center {
text-align: center;
}
.content-contrast-color {
color: {{ $design == 'dark' ? '#ffffff' : '#000000' }} !important;
opacity: {{ $design == 'dark' ? '87%': '100%' }} !important;
}
</style>
</head>
<style type="text/css">
:root {
--primary-color: {{ $primary_color }};
}
<body class="clean-body" style="margin: 0;padding: 0;-webkit-text-size-adjust: 100%;background-color: {{ $design == 'light' ? '#ffffff': '#1D1D1D' }}">
<!--[if IE]><div class="ie-container"><![endif]-->
<!--[if mso]><div class="mso-container"><![endif]-->
<table style="border-collapse: collapse;table-layout: fixed;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;vertical-align: top;min-width: 320px;Margin: 0 auto;background-color: {{ $design == 'light' ? '#ffffff': '#1D1D1D' }};width:100%" cellpadding="0" cellspacing="0">
<tbody>
<tr style="vertical-align: top">
<td style="word-break: break-word;border-collapse: collapse !important;vertical-align: top">
<!--[if (mso)|(IE)]><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td align="center" style="background-color: #ffffff;"><![endif]-->
.primary-color-bg {
background-color: {{ $primary_color }};
}
#email-content h1, h2, h3, h4 {
display: block;
color: {{ $design == 'light' ? 'black' : 'white' }};
padding-bottom: 20px;
padding-top: 20px;
}
<div class="u-row-container" style="padding: 0px;background-color: transparent">
<div class="u-row" style="Margin: 0 auto;min-width: 320px;max-width: 500px;overflow-wrap: break-word;word-wrap: break-word;word-break: break-word;background-color: transparent;">
<div style="border-collapse: collapse;display: table;width: 100%;background-color: transparent;">
<!--[if (mso)|(IE)]><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td style="padding: 0px;background-color: transparent;" align="center"><table cellpadding="0" cellspacing="0" border="0" style="width:500px;"><tr style="background-color: transparent;"><![endif]-->
#email-content p {
display: block;
color: {{ $design == 'light' ? 'black' : 'white' }};
padding-bottom: 20px;
/*padding-top: 20px;*/
}
<!--[if (mso)|(IE)]><td align="center" width="500" style="width: 500px;padding: 0px;border-top: 0px solid transparent;border-left: 0px solid transparent;border-right: 0px solid transparent;border-bottom: 0px solid transparent;" valign="top"><![endif]-->
<div class="u-col u-col-100" style="max-width: 320px;min-width: 500px;display: table-cell;vertical-align: top;">
<div style="width: 100% !important;">
<!--[if (!mso)&(!IE)]><!--><div style="padding: 0px;border-top: 0px solid transparent;border-left: 0px solid transparent;border-right: 0px solid transparent;border-bottom: 0px solid transparent;"><!--<![endif]-->
.button {
background-color: {{ $primary_color }};
color: white;
padding: 10px 16px;
text-decoration: none;
}
<table style="font-family:arial,helvetica,sans-serif;" role="presentation" cellpadding="0" cellspacing="0" width="100%" border="0">
<tbody>
<tr>
<td style="overflow-wrap:break-word;word-break:break-word;padding:0px 0px 20px;font-family:arial,helvetica,sans-serif;" align="left">
#email-content a, .link {
word-break: break-all;
}
<table height="0px" align="center" border="0" cellpadding="0" cellspacing="0" width="100%" style="border-collapse: collapse;table-layout: fixed;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;vertical-align: top;border-top: 6px solid {{ $primary_color }};-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%">
<tbody>
<tr style="vertical-align: top">
<td style="word-break: break-word;border-collapse: collapse !important;vertical-align: top;font-size: 0px;line-height: 0px;mso-line-height-rule: exactly;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%">
<span>&#160;</span>
</td>
</tr>
</tbody>
</table>
#email-content .button {
position: center;
}
</td>
</tr>
</tbody>
</table>
.center {
text-align: center;
}
<table style="font-family:arial,helvetica,sans-serif;" role="presentation" cellpadding="0" cellspacing="0" width="100%" border="0">
<tbody>
<tr>
<td style="overflow-wrap:break-word;word-break:break-word;padding:10px 10px 15px;font-family:arial,helvetica,sans-serif;" align="left">
p {
padding-bottom: 5px;
}
</style>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td style="padding-right: 0px;padding-left: 0px;" align="center">
{{ $header }}
</td>
</tr>
</table>
<body style="margin: 0; padding: 0; background-color: {{ $design == 'light' ? '#F9FAFB' : '#111827' }};">
<table role="presentation" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td style="padding: 20px; font-family: Arial, sans-serif, 'Open Sans'">
<table align="center" cellpadding="0" cellspacing="0" width="600"
style="box-shadow: 0 1px 3px 0 rgba(0,0,0,.1), 0 1px 2px 0 rgba(0,0,0,.06)">
<tr>
<td align="center" bgcolor="{{ $primary_color }}" class="primary-color-bg" style="padding: 40px 0 30px 0;">
{{ $header }}
</td>
</tr>
<tr>
<td bgcolor="{{ $design == 'light' ? '#ffffff' : '#1F2937'}}" style="padding: 40px 30px 40px 30px;">
<table cellpadding="0" cellspacing="0" width="100%" style="border-collapse: collapse;">
<tr>
<td id="email-content">
@yield('greeting')
</td>
</tr>
</tbody>
</table>
{{ $slot }}
<!--[if (!mso)&(!IE)]><!--></div><!--<![endif]-->
</div>
</div>
<!--[if (mso)|(IE)]></td><![endif]-->
<!--[if (mso)|(IE)]></tr></table></td></tr></table><![endif]-->
</div>
</div>
</div>
@yield('signature')
@yield('footer')
</td>
</tr>
</table>
</td>
</tr>
<tr>
@isset($whitelabel)
@if(!$whitelabel)
<td bgcolor="{{ $design == 'light' ? '#ffffff' : '#1F2937'}}" style="padding-top: 20px; padding-bottom: 20px;" align="center">
<p style="margin: 0; border-top: 1px solid {{ $design == 'light' ? '#F3F4F6' : '#374151' }}; padding-top: 20px;">
<a href="https://invoiceninja.com" target="_blank">
<img
style="height: 4rem; {{ $design == 'dark' ? 'filter: invert(100%);' : '' }}"
src="{{ asset('images/created-by-invoiceninja-new.png') }}"
alt="Invoice Ninja">
</a>
</p>
</td>
@endif
@endif
</tr>
</table>
<div class="u-row-container" style="padding: 0px;background-color: transparent">
<div class="u-row" style="Margin: 0 auto;min-width: 320px;max-width: 500px;overflow-wrap: break-word;word-wrap: break-word;word-break: break-word;background-color: transparent;">
<div style="border-collapse: collapse;display: table;width: 100%;background-color: transparent;">
<!--[if (mso)|(IE)]><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td style="padding: 0px;background-color: transparent;" align="center"><table cellpadding="0" cellspacing="0" border="0" style="width:500px;"><tr style="background-color: transparent;"><![endif]-->
<!--[if (mso)|(IE)]><td align="center" width="500" style="width: 500px;padding: 11px;border-top: 0px solid transparent;border-left: 0px solid transparent;border-right: 0px solid transparent;border-bottom: 0px solid transparent;" valign="top"><![endif]-->
<div class="u-col u-col-100" style="max-width: 320px;min-width: 500px;display: table-cell;vertical-align: top;">
<div style="width: 100% !important;">
<!--[if (!mso)&(!IE)]><!--><div style="padding: 11px;border-top: 0px solid transparent;border-left: 0px solid transparent;border-right: 0px solid transparent;border-bottom: 0px solid transparent;"><!--<![endif]-->
<div id="content-wrapper">
@yield('greeting')
{{ $slot }}
@yield('signature')
@yield('footer')
</div>
<!-- Before border -->
<span id="before-border"></span>
<!-- Bottom border (gray) -->
<table style="font-family:arial,helvetica,sans-serif;" role="presentation" cellpadding="0" cellspacing="0" width="100%" border="0">
<tbody>
<tr>
<td style="overflow-wrap:break-word;word-break:break-word;padding:10px 0px;font-family:arial,helvetica,sans-serif;" align="left">
<table height="0px" align="center" border="0" cellpadding="0" cellspacing="0" width="100%" style="border-collapse: collapse;table-layout: fixed;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;vertical-align: top;border-top: 2px solid {{ $design == 'light' ? '#f3f4f6' : '#2c2c2c' }};-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%">
<tbody>
<tr style="vertical-align: top">
<td style="word-break: break-word;border-collapse: collapse !important;vertical-align: top;font-size: 0px;line-height: 0px;mso-line-height-rule: exactly;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%">
<span>&#160;</span>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<!-- Whitelabel logo -->
@isset($whitelabel)
@if(!$whitelabel)
<table style="font-family:arial,helvetica,sans-serif;" role="presentation" cellpadding="0" cellspacing="0" width="100%" border="0">
<tbody>
<tr>
<td style="overflow-wrap:break-word;word-break:break-word;padding:10px;font-family:arial,helvetica,sans-serif;" align="left">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td style="padding-right: 0px;padding-left: 0px;" align="center">
<img align="center" border="0" src="{{ asset('images/created-by-invoiceninja-new.png') }}" alt="Image" title="Image" style="outline: none;text-decoration: none;-ms-interpolation-mode: bicubic;clear: both;display: inline-block !important;border: none;height: auto;float: none;width: 34%;max-width: 163.2px; {{ $design == 'dark' ? 'filter: invert(100%);' : '' }}" width="163.2"/>
</td>
</tr>
</table>
</td>
</tr>
</tbody>
</table>
@endif
@endisset
<!--[if (!mso)&(!IE)]><!--></div><!--<![endif]-->
</div>
</div>
<!--[if (mso)|(IE)]></td><![endif]-->
<!--[if (mso)|(IE)]></tr></table></td></tr></table><![endif]-->
</div>
</div>
</div>
<!--[if (mso)|(IE)]></td></tr></table><![endif]-->
</td>
</tr>
</tbody>
</table>
<!--[if mso]></div><![endif]-->
<!--[if IE]></div><![endif]-->
</body>
</html>

View File

@ -213,6 +213,11 @@
display: grid;
grid-template-columns: 1fr 1fr 1fr;
gap: 15px;
color: white;
}
[data-ref="total_table-public_notes"] {
padding-top: 0.5rem
}
</style>
@ -233,7 +238,9 @@
<tr>
<td class="page-footer-cell">
<div class="footer-wrapper" id="footer">
<div> <!-- #1 column --> </div>
<div>
<p data-ref="total_table-public_notes">$entity.public_notes</p>
</div>
<div> <!-- #2 column --> </div>
<div> <!-- #3 column --> </div>
</div>

View File

@ -218,6 +218,10 @@
text-align: right;
padding-right: 1rem;
}
[data-ref="total_table-public_notes"] {
padding-left: 1rem
}
</style>
<div id="header"></div>
@ -252,4 +256,6 @@
<table id="delivery-note-table" cellspacing="0"></table>
</div>
<div id="footer"></div>
<div id="footer">
<p data-ref="total_table-public_notes">$entity.public_notes</p>
</div>

View File

@ -186,6 +186,10 @@
text-align: right;
padding-right: 1rem;
}
[data-ref="total_table-public_notes"] {
padding-left: 1rem
}
</style>
<div id="header"></div>
@ -218,4 +222,6 @@
<table id="delivery-note-table" cellspacing="0"></table>
</div>
<div id="footer"></div>
<div id="footer">
<p data-ref="total_table-public_notes">$entity.public_notes</p>
</div>

Some files were not shown because too many files have changed in this diff Show More