Merge pull request #7863 from turbo124/preview

Preview sync
This commit is contained in:
David Bomba 2022-10-09 16:09:14 +11:00 committed by GitHub
commit 6696898219
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
50 changed files with 215641 additions and 211586 deletions

View File

@ -1 +1 @@
5.5.25
5.5.30

View File

@ -90,7 +90,7 @@ class SwissQrGenerator
$this->client->address1 ? substr($this->client->address1, 0 , 70) : '',
$this->client->address2 ? substr($this->client->address2, 0 , 16) : '',
$this->client->postal_code ? substr($this->client->postal_code, 0, 16) : '',
$this->client->city ? substr($this->client->postal_code, 0, 35) : '',
$this->client->city ? substr($this->client->city, 0, 35) : '',
'CH'
));
@ -173,4 +173,4 @@ class SwissQrGenerator
}
}
}

View File

@ -773,8 +773,16 @@ class BaseController extends Controller
// 10-01-2022 need to ensure we snake case properly here to ensure permissions work as expected
// 28-03-2022 this is definitely correct here, do not append _ to the view, it resolved correctly when snake cased
if (auth()->user() && ! auth()->user()->hasPermission('view'.lcfirst(class_basename(Str::snake($this->entity_type))))) {
//03-09-2022
$query->where('user_id', '=', auth()->user()->id)->orWhere('assigned_user_id', auth()->user()->id);
//06-10-2022 - some entities do not have assigned_user_id - this becomes an issue when we have a large company and low permission users
if(lcfirst(class_basename(Str::snake($this->entity_type))) == 'user')
$query->where('id', auth()->user()->id);
elseif(in_array(lcfirst(class_basename(Str::snake($this->entity_type))),['design','group_setting','payment_term'])){
//need to pass these back regardless
}
else
$query->where('user_id', '=', auth()->user()->id)->orWhere('assigned_user_id', auth()->user()->id);
}
if (request()->has('updated_at') && request()->input('updated_at') > 0) {

View File

@ -40,7 +40,10 @@ class WePayController extends BaseController
$company = Company::where('company_key', $hash['company_key'])->firstOrFail();
$data['user_id'] = $user->id;
$data['company'] = $company;
$data['user_company'] = $company;
// $data['company_key'] = $company->company_key;
// $data['db'] = $company->db;
$wepay_driver = new WePayPaymentDriver(new CompanyGateway, null, null);

View File

@ -158,6 +158,10 @@ class StoreClientRequest extends Request
unset($input['number']);
}
if (array_key_exists('name', $input)) {
$input['name'] = strip_tags($input['name']);
}
$this->replace($input);
}

View File

@ -112,6 +112,10 @@ class UpdateClientRequest extends Request
$input['settings'] = $this->filterSaveableSettings($input['settings']);
}
if (array_key_exists('name', $input)) {
$input['name'] = strip_tags($input['name']);
}
$this->replace($input);
}

View File

@ -65,15 +65,15 @@ class StoreCompanyRequest extends Request
$input['google_analytics_key'] = $input['google_analytics_url'];
}
$company_settings = CompanySettings::defaults();
// $company_settings = CompanySettings::defaults();
//@todo this code doesn't make sense as we never return $company_settings anywhere
//@deprecated???
if (array_key_exists('settings', $input) && ! empty($input['settings'])) {
foreach ($input['settings'] as $key => $value) {
$company_settings->{$key} = $value;
}
}
// if (array_key_exists('settings', $input) && ! empty($input['settings'])) {
// foreach ($input['settings'] as $key => $value) {
// $company_settings->{$key} = $value;
// }
// }
if (array_key_exists('portal_domain', $input)) {
$input['portal_domain'] = strtolower($input['portal_domain']);

View File

@ -85,6 +85,14 @@ class StoreUserRequest extends Request
];
}
if (array_key_exists('first_name', $input)) {
$input['first_name'] = strip_tags($input['first_name']);
}
if (array_key_exists('last_name', $input)) {
$input['last_name'] = strip_tags($input['last_name']);
}
$this->replace($input);
}

View File

@ -49,6 +49,14 @@ class UpdateUserRequest extends Request
$input['email'] = trim($input['email']);
}
if (array_key_exists('first_name', $input)) {
$input['first_name'] = strip_tags($input['first_name']);
}
if (array_key_exists('last_name', $input)) {
$input['last_name'] = strip_tags($input['last_name']);
}
$this->replace($input);
}
}

View File

@ -28,6 +28,15 @@ class ExpenseMap
9 => 'expense.transaction_reference',
10 => 'expense.public_notes',
11 => 'expense.private_notes',
12 => 'expense.tax_name1',
13 => 'expense.tax_rate1',
14 => 'expense.tax_name2',
15 => 'expense.tax_rate2',
16 => 'expense.tax_name3',
17 => 'expense.tax_rate3',
18 => 'expense.uses_inclusive_taxes',
19 => 'expense.payment_date',
];
}
@ -46,6 +55,15 @@ class ExpenseMap
9 => 'texts.transaction_reference',
10 => 'texts.public_notes',
11 => 'texts.private_notes',
12 => 'texts.tax_name1',
13 => 'texts.tax_rate1',
14 => 'texts.tax_name2',
15 => 'texts.tax_rate2',
16 => 'texts.tax_name3',
17 => 'texts.tax_rate3',
18 => 'texts.uses_inclusive_taxes',
19 => 'texts.payment_date',
];
}
}

View File

@ -42,7 +42,7 @@ class ExpenseTransformer extends BaseTransformer
'client_id' => isset($data['expense.client'])
? $this->getClientId($data['expense.client'])
: null,
'date' => strlen($this->getString($data, 'expense.date') > 1) ? date('Y-m-d', strtotime($this->getString($data, 'expense.date'))) : now()->format('Y-m-d'),
'date' => strlen($this->getString($data, 'expense.date') > 1) ? date('Y-m-d', strtotime(str_replace("/","-",$data['expense.date']))) : now()->format('Y-m-d'),
'public_notes' => $this->getString($data, 'expense.public_notes'),
'private_notes' => $this->getString($data, 'expense.private_notes'),
'category_id' => isset($data['expense.category'])
@ -55,7 +55,7 @@ class ExpenseTransformer extends BaseTransformer
? $this->getPaymentTypeId($data['expense.payment_type'])
: null,
'payment_date' => isset($data['expense.payment_date'])
? date('Y-m-d', strtotime($data['expense.payment_date']))
? date('Y-m-d', strtotime(str_replace("/","-",$data['expense.payment_date'])))
: null,
'custom_value1' => $this->getString($data, 'expense.custom_value1'),
'custom_value2' => $this->getString($data, 'expense.custom_value2'),
@ -66,6 +66,14 @@ class ExpenseTransformer extends BaseTransformer
'expense.transaction_reference'
),
'should_be_invoiced' => $clientId ? true : false,
'uses_inclusive_taxes' => (bool) $this->getString($data, 'expense.uses_inclusive_taxes'),
'tax_name1' => $this->getString($data, 'expense.tax_name1'),
'tax_rate1' => $this->getFloat($data, 'expense.tax_rate1'),
'tax_name2' => $this->getString($data, 'expense.tax_name2'),
'tax_rate2' => $this->getFloat($data, 'expense.tax_rate2'),
'tax_name3' => $this->getString($data, 'expense.tax_name3'),
'tax_rate3' => $this->getFloat($data, 'expense.tax_rate3'),
];
}
}

View File

@ -57,10 +57,10 @@ class InvoiceTransformer extends BaseTransformer
'discount' => $this->getFloat($invoice_data, 'invoice.discount'),
'po_number' => $this->getString($invoice_data, 'invoice.po_number'),
'date' => isset($invoice_data['invoice.date'])
? date('Y-m-d', strtotime($invoice_data['invoice.date']))
? date('Y-m-d', strtotime(str_replace("/","-",$invoice_data['invoice.date'])))
: now()->format('Y-m-d'),
'due_date' => isset($invoice_data['invoice.due_date'])
? date('Y-m-d', strtotime($invoice_data['invoice.due_date']))
? date('Y-m-d', strtotime(str_replace("/","-",$invoice_data['invoice.due_date'])))
: null,
'terms' => $this->getString($invoice_data, 'invoice.terms'),
'public_notes' => $this->getString(

View File

@ -57,10 +57,10 @@ class QuoteTransformer extends BaseTransformer
'discount' => $this->getFloat($quote_data, 'quote.discount'),
'po_number' => $this->getString($quote_data, 'quote.po_number'),
'date' => isset($quote_data['quote.date'])
? date('Y-m-d', strtotime($quote_data['quote.date']))
? date('Y-m-d', strtotime(str_replace("/","-",$quote_data['quote.date'])))
: now()->format('Y-m-d'),
'due_date' => isset($quote_data['quote.due_date'])
? date('Y-m-d', strtotime($quote_data['quote.due_date']))
? date('Y-m-d', strtotime(str_replace("/","-",$quote_data['quote.due_date'])))
: null,
'terms' => $this->getString($quote_data, 'quote.terms'),
'public_notes' => $this->getString(

View File

@ -37,7 +37,7 @@ class AdjustProductInventory implements ShouldQueue
public array $old_invoice;
public function __construct(Company $company, Invoice $invoice, ?array $old_invoice = [])
public function __construct(Company $company, Invoice $invoice, $old_invoice = [])
{
$this->company = $company;
$this->invoice = $invoice;

View File

@ -91,7 +91,8 @@ class TemplateEmail extends Mailable
if (strlen($settings->bcc_email) > 1) {
if (Ninja::isHosted()) {
$bccs = explode(',', str_replace(' ', '', $settings->bcc_email));
$this->bcc(reset($bccs)); //remove whitespace if any has been inserted.
$this->bcc(array_slice($bccs, 0, 2));
//$this->bcc(reset($bccs)); //remove whitespace if any has been inserted.
} else {
$this->bcc(explode(',', str_replace(' ', '', $settings->bcc_email)));
}//remove whitespace if any has been inserted.
@ -116,11 +117,6 @@ class TemplateEmail extends Mailable
'whitelabel' => $this->client->user->account->isPaid() ? true : false,
'logo' => $this->company->present()->logo($settings),
]);
// ->withSymfonyMessage(function ($message) use ($company) {
// $message->getHeaders()->addTextHeader('Tag', $company->company_key);
// $message->invitation = $this->invitation;
//});
// ->tag($company->company_key);
/*In the hosted platform we need to slow things down a little for Storage to catch up.*/

View File

@ -59,6 +59,8 @@ class Account extends BaseModel
'user_agent',
'platform',
'set_react_as_default_ap',
'inapp_transaction_id',
'num_users',
];
/**

View File

@ -0,0 +1,86 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2022. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://www.elastic.co/licensing/elastic-license
*/
namespace App\Notifications\Ninja;
use App\Models\Account;
use App\Models\Client;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Messages\SlackMessage;
use Illuminate\Notifications\Notification;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
class DomainFailureNotification extends Notification
{
/**
* Create a new notification instance.
*
* @return void
*/
protected string $domain;
public function __construct(string $domain)
{
$this->domain = $domain;
}
/**
* Get the notification's delivery channels.
*
* @param mixed $notifiable
* @return array
*/
public function via($notifiable)
{
return ['slack'];
}
/**
* Get the mail representation of the notification.
*
* @param mixed $notifiable
* @return MailMessage
*/
public function toMail($notifiable)
{
}
/**
* Get the array representation of the notification.
*
* @param mixed $notifiable
* @return array
*/
public function toArray($notifiable)
{
return [
//
];
}
public function toSlack($notifiable)
{
$content = "Domain Certificate failure:\n";
$content .= "{$this->domain}\n";
return (new SlackMessage)
->success()
->from(ctrans('texts.notification_bot'))
->image('https://app.invoiceninja.com/favicon.png')
->content($content);
}
}

View File

@ -0,0 +1,86 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2022. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://www.elastic.co/licensing/elastic-license
*/
namespace App\Notifications\Ninja;
use App\Models\Account;
use App\Models\Client;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Messages\SlackMessage;
use Illuminate\Notifications\Notification;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
class DomainRenewalFailureNotification extends Notification
{
/**
* Create a new notification instance.
*
* @return void
*/
protected string $domain;
public function __construct(string $domain)
{
$this->domain = $domain;
}
/**
* Get the notification's delivery channels.
*
* @param mixed $notifiable
* @return array
*/
public function via($notifiable)
{
return ['slack'];
}
/**
* Get the mail representation of the notification.
*
* @param mixed $notifiable
* @return MailMessage
*/
public function toMail($notifiable)
{
}
/**
* Get the array representation of the notification.
*
* @param mixed $notifiable
* @return array
*/
public function toArray($notifiable)
{
return [
//
];
}
public function toSlack($notifiable)
{
$content = "Domain Certificate _renewal_ failure:\n";
$content .= "{$this->domain}\n";
return (new SlackMessage)
->success()
->from(ctrans('texts.notification_bot'))
->image('https://app.invoiceninja.com/favicon.png')
->content($content);
}
}

View File

@ -79,8 +79,6 @@ class NewAccountNotification extends Notification
{
$content = "New Trial Started\n";
$content .= "{$this->client->name}\n";
$content .= "Account key: {$this->account->key}\n";
$content .= "Users: {$this->account->users()->pluck('email')}\n";
$content .= "Contacts: {$this->client->contacts()->pluck('email')}\n";

View File

@ -53,6 +53,8 @@ class ACH
public function authorizeView(array $data)
{
$data['gateway'] = $this->forte;
return render('gateways.forte.ach.authorize', $data);
}
@ -81,13 +83,13 @@ class ACH
$this->forte->payment_hash->data = array_merge((array) $this->forte->payment_hash->data, $data);
$this->forte->payment_hash->save();
$data['gateway'] = $this;
$data['gateway'] = $this->forte;
return render('gateways.forte.ach.pay', $data);
}
public function paymentResponse($request)
{
$payment_hash = PaymentHash::whereRaw('BINARY `hash`= ?', [$request->input('payment_hash')])->firstOrFail();
$payment_hash = PaymentHash::where('hash', $request->input('payment_hash'))->firstOrFail();
try {
$curl = curl_init();

View File

@ -54,6 +54,7 @@ class CreditCard
public function authorizeView(array $data)
{
$data['gateway'] = $this->forte;
return render('gateways.forte.credit_card.authorize', $data);
}
@ -82,7 +83,7 @@ class CreditCard
$this->forte->payment_hash->data = array_merge((array) $this->forte->payment_hash->data, $data);
$this->forte->payment_hash->save();
$data['gateway'] = $this;
$data['gateway'] = $this->forte;
return render('gateways.forte.credit_card.pay', $data);
}

View File

@ -165,6 +165,18 @@ class ACH
$data['payment_method_id'] = GatewayType::BANK_TRANSFER;
$data['customer'] = $this->stripe->findOrCreateCustomer();
$data['amount'] = $this->stripe->convertToStripeAmount($data['total']['amount_with_fee'], $this->stripe->client->currency()->precision, $this->stripe->client->currency());
$amount = $data['total']['amount_with_fee'];
$invoice = Invoice::whereIn('id', $this->transformKeys(array_column($this->stripe->payment_hash->invoices(), 'invoice_id')))
->withTrashed()
->first();
if ($invoice) {
$description = "Invoice {$invoice->number} for {$amount} for client {$this->stripe->client->present()->name()}";
} else {
$description = "Payment with no invoice for amount {$amount} for client {$this->stripe->client->present()->name()}";
}
$intent = false;
@ -176,6 +188,11 @@ class ACH
'setup_future_usage' => 'off_session',
'customer' => $data['customer']->id,
'payment_method_types' => ['us_bank_account'],
'description' => $description,
'metadata' => [
'payment_hash' => $this->stripe->payment_hash->hash,
'gateway_type_id' => GatewayType::BANK_TRANSFER,
],
]
);
}

View File

@ -13,6 +13,7 @@ namespace App\PaymentDrivers\Stripe\Jobs;
use App\Jobs\Util\SystemLogger;
use App\Libraries\MultiDB;
use App\Models\ClientGatewayToken;
use App\Models\Company;
use App\Models\CompanyGateway;
use App\Models\GatewayType;
@ -21,6 +22,7 @@ use App\Models\Payment;
use App\Models\PaymentHash;
use App\Models\PaymentType;
use App\Models\SystemLog;
use App\PaymentDrivers\Stripe\UpdatePaymentMethods;
use App\PaymentDrivers\Stripe\Utilities;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
@ -53,7 +55,7 @@ class PaymentIntentWebhook implements ShouldQueue
public function handle()
{
MultiDB::findAndSetDbByCompanyKey($this->company_key);
$company = Company::where('company_key', $this->company_key)->first();
@ -145,7 +147,18 @@ class PaymentIntentWebhook implements ShouldQueue
$this->updateCreditCardPayment($payment_hash, $client);
}
elseif(array_key_exists('payment_method_types', $this->stripe_request['object']) && optional($this->stripe_request['object']['charges']['data'][0]['metadata']['payment_hash']) && in_array('us_bank_account', $this->stripe_request['object']['payment_method_types']))
{
nlog("hash found");
$hash = $this->stripe_request['object']['charges']['data'][0]['metadata']['payment_hash'];
$payment_hash = PaymentHash::where('hash', $hash)->first();
$invoice = Invoice::with('client')->find($payment_hash->fee_invoice_id);
$client = $invoice->client;
$this->updateAchPayment($payment_hash, $client);
}
}
@ -161,6 +174,81 @@ class PaymentIntentWebhook implements ShouldQueue
}
private function updateAchPayment($payment_hash, $client)
{
$company_gateway = CompanyGateway::find($this->company_gateway_id);
$payment_method_type = optional($this->stripe_request['object']['charges']['data'][0]['metadata'])['gateway_type_id'];
$driver = $company_gateway->driver($client)->init()->setPaymentMethod($payment_method_type);
$payment_hash->data = array_merge((array) $payment_hash->data, $this->stripe_request);
$payment_hash->save();
$driver->setPaymentHash($payment_hash);
$data = [
'payment_method' => $payment_hash->data->object->payment_method,
'payment_type' => PaymentType::ACH,
'amount' => $payment_hash->data->amount_with_fee,
'transaction_reference' => $this->stripe_request['object']['charges']['data'][0]['id'],
'gateway_type_id' => GatewayType::BANK_TRANSFER,
];
$payment = $driver->createPayment($data, Payment::STATUS_COMPLETED);
SystemLogger::dispatch(
['response' => $this->stripe_request, 'data' => $data],
SystemLog::CATEGORY_GATEWAY_RESPONSE,
SystemLog::EVENT_GATEWAY_SUCCESS,
SystemLog::TYPE_STRIPE,
$client,
$client->company,
);
try {
$customer = $driver->getCustomer($this->stripe_request['object']['charges']['data'][0]['customer']);
$method = $driver->getStripePaymentMethod($this->stripe_request['object']['charges']['data'][0]['payment_method']);
$payment_method = $this->stripe_request['object']['charges']['data'][0]['payment_method'];
$token_exists = ClientGatewayToken::where([
'gateway_customer_reference' => $customer->id,
'token' => $payment_method,
'client_id' => $client->id,
'company_id' => $client->company_id,
])->exists();
/* Already exists return */
if ($token_exists) {
return;
}
$payment_meta = new \stdClass;
$payment_meta->brand = (string) \sprintf('%s (%s)', $method->us_bank_account['bank_name'], ctrans('texts.ach'));
$payment_meta->last4 = (string) $method->us_bank_account['last4'];
$payment_meta->type = GatewayType::BANK_TRANSFER;
$payment_meta->state = 'verified';
$data = [
'payment_meta' => $payment_meta,
'token' => $payment_method,
'payment_method_id' => GatewayType::BANK_TRANSFER,
];
$additional_data = ['gateway_customer_reference' => $customer->id];
if ($customer->default_source === $method->id) {
$additional_data = ['gateway_customer_reference' => $customer->id, 'is_default' => 1];
}
$driver->storeGatewayToken($data, $additional_data);
}
catch(\Exception $e){
nlog("failed to import payment methods");
nlog($e->getMessage());
}
}
private function updateCreditCardPayment($payment_hash, $client)
{
$company_gateway = CompanyGateway::find($this->company_gateway_id);

View File

@ -70,7 +70,7 @@ class UpdatePaymentMethods
$this->importBankAccounts($customer, $client);
}
private function importBankAccounts($customer, $client)
public function importBankAccounts($customer, $client)
{
$sources = $customer->sources;

View File

@ -41,6 +41,7 @@ class ACH
public function authorizeView($data)
{
$data['gateway'] = $this->wepay_payment_driver;
$data['country_code'] = $this->wepay_payment_driver->client ? $this->wepay_payment_driver->client->country->iso_3166_2 : $this->wepay_payment_driver->company_gateway->company()->iso_3166_2;
return render('gateways.wepay.authorize.bank_transfer', $data);
}

View File

@ -27,7 +27,7 @@ class Setup
{
/*
'user_id',
'company',
'user_company',
*/
return render('gateways.wepay.signup.index', $data);

View File

@ -33,17 +33,29 @@ class DeletePayment
public function run()
{
if ($this->payment->is_deleted) {
return $this->payment;
}
return $this->setStatus(Payment::STATUS_CANCELLED) //sets status of payment
->updateCreditables() //return the credits first
->adjustInvoices()
->updateClient()
->deletePaymentables()
->cleanupPayment()
->save();
\DB::connection(config('database.default'))->transaction(function () {
if ($this->payment->is_deleted) {
return $this->payment;
}
$this->payment = Payment::withTrashed()->where('id', $this->payment->id)->lockForUpdate()->first();
$this->setStatus(Payment::STATUS_CANCELLED) //sets status of payment
->updateCreditables() //return the credits first
->adjustInvoices()
->updateClient()
->deletePaymentables()
->cleanupPayment()
->save();
}, 2);
return $this->payment;
}
private function cleanupPayment()

View File

@ -53,6 +53,7 @@ class AccountTransformer extends EntityTransformer
{
return [
'id' => (string) $this->encodePrimaryKey($account->id),
'key' => (string) $account->key,
'default_url' => config('ninja.app_url'),
'plan' => $account->getPlan(),
'plan_term' => (string) $account->plan_terms,

View File

@ -114,6 +114,22 @@ class Helpers
return '';
}
// 04-10-2022 Return Early if no reserved keywords are present, this is a very expenseive process
$string_hit = false;
foreach ( [':MONTH',':YEAR',':QUARTER',':WEEK'] as $string )
{
if(stripos($value, $string) !== FALSE) {
$string_hit = true;
}
}
if(!$string_hit)
return $value;
// 04-10-2022 Return Early if no reserved keywords are present, this is a very expenseive process
Carbon::setLocale($entity->locale());
$replacements = [

View File

@ -148,6 +148,7 @@ class HtmlEngine
if ($this->entity_string == 'invoice' || $this->entity_string == 'recurring_invoice') {
$data['$entity'] = ['value' => '', 'label' => ctrans('texts.invoice')];
$data['$number'] = ['value' => $this->entity->number ?: '&nbsp;', 'label' => ctrans('texts.invoice_number')];
$data['$invoice'] = ['value' => $this->entity->number ?: '&nbsp;', 'label' => ctrans('texts.invoice_number')];
$data['$number_short'] = ['value' => $this->entity->number ?: '&nbsp;', 'label' => ctrans('texts.invoice_number_short')];
$data['$entity.terms'] = ['value' => Helpers::processReservedKeywords(\nl2br($this->entity->terms), $this->client) ?: '', 'label' => ctrans('texts.invoice_terms')];
$data['$terms'] = &$data['$entity.terms'];

View File

@ -421,7 +421,6 @@ trait GeneratesCounter
$check_counter = 1;
do {
nlog($counter);
$number = $this->padCounter($counter, $padding);

View File

@ -264,7 +264,8 @@ trait MakesInvoiceValues
* @return array
*/
public function transformLineItems($items, $table_type = '$product') :array
{
{ //$start = microtime(true);
$entity = $this->client ? $this->client : $this->company;
$data = [];
@ -274,6 +275,8 @@ trait MakesInvoiceValues
$locale_info = localeconv();
$entity_currency = $entity->currency();
foreach ($items as $key => $item) {
if ($table_type == '$product' && $item->type_id != 1) {
if ($item->type_id != 4 && $item->type_id != 6 && $item->type_id != 5) {
@ -297,13 +300,13 @@ trait MakesInvoiceValues
$data[$key][$table_type.'.notes'] = Helpers::processReservedKeywords($item->notes, $entity);
$data[$key][$table_type.'.description'] = Helpers::processReservedKeywords($item->notes, $entity);
$data[$key][$table_type.".{$_table_type}1"] = $helpers->formatCustomFieldValue($this->company->custom_fields, "{$_table_type}1", $item->custom_value1, $entity);
$data[$key][$table_type.".{$_table_type}2"] = $helpers->formatCustomFieldValue($this->company->custom_fields, "{$_table_type}2", $item->custom_value2, $entity);
$data[$key][$table_type.".{$_table_type}3"] = $helpers->formatCustomFieldValue($this->company->custom_fields, "{$_table_type}3", $item->custom_value3, $entity);
$data[$key][$table_type.".{$_table_type}4"] = $helpers->formatCustomFieldValue($this->company->custom_fields, "{$_table_type}4", $item->custom_value4, $entity);
$data[$key][$table_type.".{$_table_type}1"] = strlen($item->custom_value1) > 1 ? $helpers->formatCustomFieldValue($this->company->custom_fields, "{$_table_type}1", $item->custom_value1, $entity) : '';
$data[$key][$table_type.".{$_table_type}2"] = strlen($item->custom_value2) > 2 ? $helpers->formatCustomFieldValue($this->company->custom_fields, "{$_table_type}2", $item->custom_value2, $entity) : '';
$data[$key][$table_type.".{$_table_type}3"] = strlen($item->custom_value3) > 3 ? $helpers->formatCustomFieldValue($this->company->custom_fields, "{$_table_type}3", $item->custom_value3, $entity) : '';
$data[$key][$table_type.".{$_table_type}4"] = strlen($item->custom_value4) > 4 ? $helpers->formatCustomFieldValue($this->company->custom_fields, "{$_table_type}4", $item->custom_value4, $entity) : '';
if ($item->quantity > 0 || $item->cost > 0) {
$data[$key][$table_type.'.quantity'] = Number::formatValueNoTrailingZeroes($item->quantity, $entity->currency());
$data[$key][$table_type.'.quantity'] = Number::formatValueNoTrailingZeroes($item->quantity, $entity_currency);
$data[$key][$table_type.'.unit_cost'] = Number::formatMoneyNoRounding($item->cost, $entity);
@ -357,6 +360,8 @@ trait MakesInvoiceValues
$data[$key]['task_id'] = property_exists($item, 'task_id') ? $item->task_id : '';
}
//nlog(microtime(true) - $start);
return $data;
}

View File

@ -14,8 +14,8 @@ return [
'require_https' => env('REQUIRE_HTTPS', true),
'app_url' => rtrim(env('APP_URL', ''), '/'),
'app_domain' => env('APP_DOMAIN', 'invoicing.co'),
'app_version' => '5.5.25',
'app_tag' => '5.5.25',
'app_version' => '5.5.30',
'app_tag' => '5.5.30',
'minimum_client_version' => '5.0.16',
'terms_version' => '1.0.1',
'api_secret' => env('API_SECRET', ''),

View File

@ -26,8 +26,8 @@ return new class extends Migration {
$table->boolean('paused')->default(false);
$table->boolean('is_deleted')->default(false);
$table->string('repeat_every');
$table->timestamp('start_from');
$table->timestamp('scheduled_run');
$table->timestamp('start_from')->nullable();
$table->timestamp('scheduled_run')->nullable();
$table->foreignIdFor(\App\Models\Company::class);
$table->timestamps();
$table->softDeletes();
@ -41,6 +41,6 @@ return new class extends Migration {
*/
public function down()
{
Schema::dropIfExists('schedulers');
}
};

View File

@ -0,0 +1,41 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('clients', function (Blueprint $table) {
$table->index([\DB::raw('client_hash(20)')]);
});
Schema::table('client_contacts', function (Blueprint $table) {
$table->index([\DB::raw('contact_key(20)')]);
$table->index('email');
});
Schema::table('vendor_contacts', function (Blueprint $table) {
$table->index([\DB::raw('contact_key(20)')]);
$table->index('email');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
}
};

View File

@ -0,0 +1,41 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('products', function (Blueprint $table) {
$table->index(['product_key', 'company_id']);
});
Schema::table('companies', function (Blueprint $table) {
$table->index(['subdomain', 'portal_mode']);
$table->index(['portal_domain', 'portal_mode']);
$table->index('company_key');
});
Schema::table('accounts', function (Blueprint $table) {
$table->index('key');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
}
};

View File

@ -0,0 +1,30 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('company_tokens', function (Blueprint $table) {
$table->index('token');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
}
};

View File

@ -44,11 +44,12 @@ CREATE TABLE `accounts` (
`set_react_as_default_ap` tinyint(1) NOT NULL DEFAULT '0',
`is_flagged` tinyint(1) NOT NULL DEFAULT '0',
`is_verified_account` tinyint(1) NOT NULL DEFAULT '0',
`account_sms_verification_code` text COLLATE utf8mb4_unicode_ci,
`account_sms_verification_number` text COLLATE utf8mb4_unicode_ci,
`account_sms_verification_code` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
`account_sms_verification_number` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
`account_sms_verified` tinyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
KEY `accounts_payment_id_index` (`payment_id`)
KEY `accounts_payment_id_index` (`payment_id`),
KEY `accounts_key_index` (`key`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `activities`;
@ -222,6 +223,8 @@ CREATE TABLE `client_contacts` (
KEY `client_contacts_company_id_index` (`company_id`),
KEY `client_contacts_client_id_index` (`client_id`),
KEY `client_contacts_user_id_index` (`user_id`),
KEY `client_contacts_contact_key(20)_index` (`contact_key`(20)),
KEY `client_contacts_email_index` (`email`),
CONSTRAINT `client_contacts_client_id_foreign` FOREIGN KEY (`client_id`) REFERENCES `clients` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8;
/*!40101 SET character_set_client = @saved_cs_client */;
@ -333,6 +336,7 @@ CREATE TABLE `clients` (
KEY `clients_size_id_foreign` (`size_id`),
KEY `clients_company_id_index` (`company_id`),
KEY `clients_user_id_index` (`user_id`),
KEY `clients_client_hash(20)_index` (`client_hash`(20)),
CONSTRAINT `clients_company_id_foreign` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `clients_industry_id_foreign` FOREIGN KEY (`industry_id`) REFERENCES `industries` (`id`),
CONSTRAINT `clients_size_id_foreign` FOREIGN KEY (`size_id`) REFERENCES `sizes` (`id`)
@ -410,11 +414,16 @@ CREATE TABLE `companies` (
`inventory_notification_threshold` int NOT NULL DEFAULT '0',
`stock_notification` tinyint(1) NOT NULL DEFAULT '1',
`enabled_expense_tax_rates` int unsigned NOT NULL DEFAULT '0',
`invoice_task_project` tinyint(1) NOT NULL DEFAULT '0',
`report_include_deleted` tinyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
UNIQUE KEY `companies_company_key_unique` (`company_key`),
KEY `companies_industry_id_foreign` (`industry_id`),
KEY `companies_size_id_foreign` (`size_id`),
KEY `companies_account_id_index` (`account_id`),
KEY `companies_subdomain_portal_mode_index` (`subdomain`,`portal_mode`),
KEY `companies_portal_domain_portal_mode_index` (`portal_domain`,`portal_mode`),
KEY `companies_company_key_index` (`company_key`),
CONSTRAINT `companies_account_id_foreign` FOREIGN KEY (`account_id`) REFERENCES `accounts` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `companies_industry_id_foreign` FOREIGN KEY (`industry_id`) REFERENCES `industries` (`id`),
CONSTRAINT `companies_size_id_foreign` FOREIGN KEY (`size_id`) REFERENCES `sizes` (`id`)
@ -848,7 +857,7 @@ DROP TABLE IF EXISTS `failed_jobs`;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `failed_jobs` (
`id` bigint unsigned NOT NULL AUTO_INCREMENT,
`uuid` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`uuid` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`connection` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
`queue` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
`payload` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
@ -1025,6 +1034,8 @@ CREATE TABLE `invoices` (
KEY `invoices_company_id_deleted_at_index` (`company_id`,`deleted_at`),
KEY `invoices_client_id_index` (`client_id`),
KEY `invoices_company_id_index` (`company_id`),
KEY `invoices_recurring_id_index` (`recurring_id`),
KEY `invoices_status_id_balance_index` (`status_id`,`balance`),
CONSTRAINT `invoices_client_id_foreign` FOREIGN KEY (`client_id`) REFERENCES `clients` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `invoices_company_id_foreign` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `invoices_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
@ -1070,6 +1081,7 @@ CREATE TABLE `licenses` (
`is_claimed` tinyint(1) DEFAULT NULL,
`transaction_reference` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`product_id` int unsigned DEFAULT NULL,
`recurring_invoice_id` bigint unsigned DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `licenses_license_key_unique` (`license_key`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8;
@ -1169,6 +1181,7 @@ CREATE TABLE `paymentables` (
`deleted_at` timestamp(6) NULL DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `paymentables_payment_id_foreign` (`payment_id`),
KEY `paymentables_paymentable_id_index` (`paymentable_id`),
CONSTRAINT `paymentables_payment_id_foreign` FOREIGN KEY (`payment_id`) REFERENCES `payments` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8;
/*!40101 SET character_set_client = @saved_cs_client */;
@ -1210,7 +1223,9 @@ CREATE TABLE `payments` (
`custom_value2` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
`custom_value3` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
`custom_value4` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
`idempotency_key` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `payments_company_id_idempotency_key_unique` (`company_id`,`idempotency_key`),
KEY `payments_company_id_deleted_at_index` (`company_id`,`deleted_at`),
KEY `payments_client_contact_id_foreign` (`client_contact_id`),
KEY `payments_company_gateway_id_foreign` (`company_gateway_id`),
@ -1218,6 +1233,8 @@ CREATE TABLE `payments` (
KEY `payments_company_id_index` (`company_id`),
KEY `payments_client_id_index` (`client_id`),
KEY `payments_status_id_index` (`status_id`),
KEY `payments_transaction_reference_index` (`transaction_reference`),
KEY `payments_idempotency_key_index` (`idempotency_key`),
CONSTRAINT `payments_client_contact_id_foreign` FOREIGN KEY (`client_contact_id`) REFERENCES `client_contacts` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `payments_client_id_foreign` FOREIGN KEY (`client_id`) REFERENCES `clients` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `payments_company_gateway_id_foreign` FOREIGN KEY (`company_gateway_id`) REFERENCES `company_gateways` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
@ -1262,6 +1279,7 @@ CREATE TABLE `products` (
KEY `products_user_id_foreign` (`user_id`),
KEY `products_company_id_index` (`company_id`),
KEY `pro_co_us_up_index` (`company_id`,`user_id`,`assigned_user_id`,`updated_at`),
KEY `products_product_key_company_id_index` (`product_key`,`company_id`),
CONSTRAINT `products_company_id_foreign` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `products_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8;
@ -1308,11 +1326,11 @@ CREATE TABLE `purchase_order_invitations` (
`user_id` int unsigned NOT NULL,
`vendor_contact_id` int unsigned NOT NULL,
`purchase_order_id` bigint unsigned NOT NULL,
`key` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`transaction_reference` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`message_id` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`email_error` mediumtext COLLATE utf8mb4_unicode_ci,
`signature_base64` text COLLATE utf8mb4_unicode_ci,
`key` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
`transaction_reference` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`message_id` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`email_error` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
`signature_base64` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
`signature_date` datetime DEFAULT NULL,
`sent_date` datetime DEFAULT NULL,
`viewed_date` datetime DEFAULT NULL,
@ -1320,6 +1338,7 @@ CREATE TABLE `purchase_order_invitations` (
`created_at` timestamp(6) NULL DEFAULT NULL,
`updated_at` timestamp(6) NULL DEFAULT NULL,
`deleted_at` timestamp(6) NULL DEFAULT NULL,
`email_status` enum('delivered','bounced','spam') COLLATE utf8mb4_unicode_ci DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `vendor_purchase_unique` (`vendor_contact_id`,`purchase_order_id`),
KEY `purchase_order_invitations_user_id_foreign` (`user_id`),
@ -1349,25 +1368,25 @@ CREATE TABLE `purchase_orders` (
`recurring_id` int unsigned DEFAULT NULL,
`design_id` int unsigned DEFAULT NULL,
`invoice_id` int unsigned DEFAULT NULL,
`number` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`number` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`discount` double(8,2) NOT NULL DEFAULT '0.00',
`is_amount_discount` tinyint(1) NOT NULL DEFAULT '0',
`po_number` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`po_number` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`date` date DEFAULT NULL,
`last_sent_date` datetime DEFAULT NULL,
`due_date` date DEFAULT NULL,
`is_deleted` tinyint(1) NOT NULL DEFAULT '0',
`line_items` mediumtext COLLATE utf8mb4_unicode_ci,
`backup` mediumtext COLLATE utf8mb4_unicode_ci,
`footer` text COLLATE utf8mb4_unicode_ci,
`public_notes` text COLLATE utf8mb4_unicode_ci,
`private_notes` text COLLATE utf8mb4_unicode_ci,
`terms` text COLLATE utf8mb4_unicode_ci,
`tax_name1` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`line_items` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
`backup` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
`footer` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
`public_notes` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
`private_notes` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
`terms` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
`tax_name1` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`tax_rate1` decimal(20,6) NOT NULL DEFAULT '0.000000',
`tax_name2` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`tax_name2` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`tax_rate2` decimal(20,6) NOT NULL DEFAULT '0.000000',
`tax_name3` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`tax_name3` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`tax_rate3` decimal(20,6) NOT NULL DEFAULT '0.000000',
`total_taxes` decimal(20,6) NOT NULL DEFAULT '0.000000',
`uses_inclusive_taxes` tinyint(1) NOT NULL DEFAULT '0',
@ -1375,10 +1394,10 @@ CREATE TABLE `purchase_orders` (
`reminder2_sent` date DEFAULT NULL,
`reminder3_sent` date DEFAULT NULL,
`reminder_last_sent` date DEFAULT NULL,
`custom_value1` text COLLATE utf8mb4_unicode_ci,
`custom_value2` text COLLATE utf8mb4_unicode_ci,
`custom_value3` text COLLATE utf8mb4_unicode_ci,
`custom_value4` text COLLATE utf8mb4_unicode_ci,
`custom_value1` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
`custom_value2` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
`custom_value3` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
`custom_value4` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
`next_send_date` datetime DEFAULT NULL,
`custom_surcharge1` decimal(20,6) DEFAULT NULL,
`custom_surcharge2` decimal(20,6) DEFAULT NULL,
@ -1517,6 +1536,7 @@ CREATE TABLE `quotes` (
KEY `quotes_company_id_deleted_at_index` (`company_id`,`deleted_at`),
KEY `quotes_client_id_index` (`client_id`),
KEY `quotes_company_id_index` (`company_id`),
KEY `quotes_company_id_updated_at_index` (`company_id`,`updated_at`),
CONSTRAINT `quotes_client_id_foreign` FOREIGN KEY (`client_id`) REFERENCES `clients` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `quotes_company_id_foreign` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `quotes_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
@ -1813,16 +1833,16 @@ CREATE TABLE `schedulers` (
`id` bigint unsigned NOT NULL AUTO_INCREMENT,
`paused` tinyint(1) NOT NULL DEFAULT '0',
`is_deleted` tinyint(1) NOT NULL DEFAULT '0',
`repeat_every` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`repeat_every` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
`start_from` timestamp NOT NULL,
`scheduled_run` timestamp NOT NULL,
`company_id` bigint unsigned NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
`deleted_at` timestamp NULL DEFAULT NULL,
`action_name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`action_class` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`parameters` mediumtext COLLATE utf8mb4_unicode_ci,
`action_name` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
`action_class` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
`parameters` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
PRIMARY KEY (`id`),
KEY `schedulers_action_name_index` (`action_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC;
@ -2123,6 +2143,8 @@ CREATE TABLE `vendor_contacts` (
KEY `vendor_contacts_user_id_foreign` (`user_id`),
KEY `vendor_contacts_vendor_id_index` (`vendor_id`),
KEY `vendor_contacts_company_id_email_deleted_at_index` (`company_id`,`email`,`deleted_at`),
KEY `vendor_contacts_contact_key(20)_index` (`contact_key`(20)),
KEY `vendor_contacts_email_index` (`email`),
CONSTRAINT `vendor_contacts_company_id_foreign` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `vendor_contacts_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `vendor_contacts_vendor_id_foreign` FOREIGN KEY (`vendor_id`) REFERENCES `vendors` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
@ -2359,3 +2381,13 @@ INSERT INTO `migrations` VALUES (154,'2022_07_21_023805_add_hebrew_language',11)
INSERT INTO `migrations` VALUES (155,'2022_07_26_091216_add_sms_verification_to_hosted_account',11);
INSERT INTO `migrations` VALUES (156,'2022_07_28_232340_enabled_expense_tax_rates_to_companies_table',11);
INSERT INTO `migrations` VALUES (157,'2022_07_29_091235_correction_for_companies_table_types',11);
INSERT INTO `migrations` VALUES (158,'2022_08_11_011534_licenses_table_for_self_host',12);
INSERT INTO `migrations` VALUES (159,'2022_08_24_215917_invoice_task_project_companies_table',12);
INSERT INTO `migrations` VALUES (160,'2022_08_26_232500_add_email_status_column_to_purchase_order_invitations_table',12);
INSERT INTO `migrations` VALUES (161,'2022_08_28_210111_add_index_to_payments_table',12);
INSERT INTO `migrations` VALUES (162,'2022_09_05_024719_update_designs_for_tech_template',12);
INSERT INTO `migrations` VALUES (163,'2022_09_07_101731_add_reporting_option_to_companies_table',12);
INSERT INTO `migrations` VALUES (164,'2022_09_21_012417_add_threeds_to_braintree',12);
INSERT INTO `migrations` VALUES (165,'2022_09_30_235337_add_idempotency_key_to_payments',12);
INSERT INTO `migrations` VALUES (166,'2022_10_05_205645_add_indexes_to_client_hash',12);
INSERT INTO `migrations` VALUES (167,'2022_10_06_011344_add_key_to_products',12);

View File

@ -41,6 +41,12 @@ CREATE TABLE `accounts` (
`hosted_client_count` int(10) unsigned DEFAULT NULL,
`hosted_company_count` int(10) unsigned DEFAULT NULL,
`inapp_transaction_id` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`set_react_as_default_ap` tinyint(1) NOT NULL DEFAULT 0,
`is_flagged` tinyint(1) NOT NULL DEFAULT 0,
`is_verified_account` tinyint(1) NOT NULL DEFAULT 0,
`account_sms_verification_code` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`account_sms_verification_number` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`account_sms_verified` tinyint(1) NOT NULL DEFAULT 0,
PRIMARY KEY (`id`),
KEY `accounts_payment_id_index` (`payment_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
@ -75,6 +81,8 @@ CREATE TABLE `activities` (
`recurring_invoice_id` int(10) unsigned DEFAULT NULL,
`recurring_expense_id` int(10) unsigned DEFAULT NULL,
`recurring_quote_id` int(10) unsigned DEFAULT NULL,
`purchase_order_id` int(10) unsigned DEFAULT NULL,
`vendor_contact_id` int(10) unsigned DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `activities_vendor_id_company_id_index` (`vendor_id`,`company_id`),
KEY `activities_project_id_company_id_index` (`project_id`,`company_id`),
@ -88,6 +96,10 @@ CREATE TABLE `activities` (
KEY `activities_expense_id_company_id_index` (`expense_id`,`company_id`),
KEY `activities_client_contact_id_company_id_index` (`client_contact_id`,`company_id`),
KEY `activities_company_id_foreign` (`company_id`),
KEY `activities_quote_id_company_id_index` (`quote_id`,`company_id`),
KEY `activities_recurring_invoice_id_company_id_index` (`recurring_invoice_id`,`company_id`),
KEY `activities_purchase_order_id_company_id_index` (`purchase_order_id`,`company_id`),
KEY `activities_vendor_contact_id_company_id_index` (`vendor_contact_id`,`company_id`),
CONSTRAINT `activities_company_id_foreign` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
@ -210,6 +222,8 @@ CREATE TABLE `client_contacts` (
KEY `client_contacts_company_id_index` (`company_id`),
KEY `client_contacts_client_id_index` (`client_id`),
KEY `client_contacts_user_id_index` (`user_id`),
KEY `client_contacts_contact_key(20)_index` (`contact_key`(20)),
KEY `client_contacts_email_index` (`email`),
CONSTRAINT `client_contacts_client_id_foreign` FOREIGN KEY (`client_id`) REFERENCES `clients` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
@ -321,6 +335,7 @@ CREATE TABLE `clients` (
KEY `clients_size_id_foreign` (`size_id`),
KEY `clients_company_id_index` (`company_id`),
KEY `clients_user_id_index` (`user_id`),
KEY `clients_client_hash(20)_index` (`client_hash`(20)),
CONSTRAINT `clients_company_id_foreign` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `clients_industry_id_foreign` FOREIGN KEY (`industry_id`) REFERENCES `industries` (`id`),
CONSTRAINT `clients_size_id_foreign` FOREIGN KEY (`size_id`) REFERENCES `sizes` (`id`)
@ -393,6 +408,13 @@ CREATE TABLE `companies` (
`markdown_email_enabled` tinyint(1) NOT NULL DEFAULT 0,
`stop_on_unpaid_recurring` tinyint(1) NOT NULL DEFAULT 0,
`use_quote_terms_on_conversion` tinyint(1) NOT NULL DEFAULT 0,
`enable_applying_payments` tinyint(1) NOT NULL DEFAULT 0,
`track_inventory` tinyint(1) NOT NULL DEFAULT 0,
`inventory_notification_threshold` int(11) NOT NULL DEFAULT 0,
`stock_notification` tinyint(1) NOT NULL DEFAULT 1,
`enabled_expense_tax_rates` int(10) unsigned NOT NULL DEFAULT 0,
`invoice_task_project` tinyint(1) NOT NULL DEFAULT 0,
`report_include_deleted` tinyint(1) NOT NULL DEFAULT 0,
PRIMARY KEY (`id`),
UNIQUE KEY `companies_company_key_unique` (`company_key`),
KEY `companies_industry_id_foreign` (`industry_id`),
@ -833,12 +855,14 @@ DROP TABLE IF EXISTS `failed_jobs`;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `failed_jobs` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`uuid` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`connection` text COLLATE utf8mb4_unicode_ci NOT NULL,
`queue` text COLLATE utf8mb4_unicode_ci NOT NULL,
`payload` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
`exception` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
`failed_at` timestamp NOT NULL DEFAULT current_timestamp(),
PRIMARY KEY (`id`)
PRIMARY KEY (`id`),
UNIQUE KEY `failed_jobs_uuid_unique` (`uuid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `gateway_types`;
@ -1009,6 +1033,8 @@ CREATE TABLE `invoices` (
KEY `invoices_company_id_deleted_at_index` (`company_id`,`deleted_at`),
KEY `invoices_client_id_index` (`client_id`),
KEY `invoices_company_id_index` (`company_id`),
KEY `invoices_recurring_id_index` (`recurring_id`),
KEY `invoices_status_id_balance_index` (`status_id`,`balance`),
CONSTRAINT `invoices_client_id_foreign` FOREIGN KEY (`client_id`) REFERENCES `clients` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `invoices_company_id_foreign` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `invoices_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
@ -1054,6 +1080,7 @@ CREATE TABLE `licenses` (
`is_claimed` tinyint(1) DEFAULT NULL,
`transaction_reference` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`product_id` int(10) unsigned DEFAULT NULL,
`recurring_invoice_id` bigint(20) unsigned DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `licenses_license_key_unique` (`license_key`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
@ -1092,6 +1119,7 @@ CREATE TABLE `payment_hashes` (
`updated_at` timestamp(6) NULL DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `payment_hashes_payment_id_foreign` (`payment_id`),
KEY `payment_hashes_hash_index` (`hash`),
CONSTRAINT `payment_hashes_payment_id_foreign` FOREIGN KEY (`payment_id`) REFERENCES `payments` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
@ -1152,6 +1180,7 @@ CREATE TABLE `paymentables` (
`deleted_at` timestamp(6) NULL DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `paymentables_payment_id_foreign` (`payment_id`),
KEY `paymentables_paymentable_id_index` (`paymentable_id`),
CONSTRAINT `paymentables_payment_id_foreign` FOREIGN KEY (`payment_id`) REFERENCES `payments` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
@ -1193,8 +1222,10 @@ CREATE TABLE `payments` (
`custom_value2` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`custom_value3` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`custom_value4` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`idempotency_key` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `payments_company_id_number_unique` (`company_id`,`number`),
UNIQUE KEY `payments_company_id_idempotency_key_unique` (`company_id`,`idempotency_key`),
KEY `payments_company_id_deleted_at_index` (`company_id`,`deleted_at`),
KEY `payments_client_contact_id_foreign` (`client_contact_id`),
KEY `payments_company_gateway_id_foreign` (`company_gateway_id`),
@ -1202,6 +1233,8 @@ CREATE TABLE `payments` (
KEY `payments_company_id_index` (`company_id`),
KEY `payments_client_id_index` (`client_id`),
KEY `payments_status_id_index` (`status_id`),
KEY `payments_transaction_reference_index` (`transaction_reference`),
KEY `payments_idempotency_key_index` (`idempotency_key`),
CONSTRAINT `payments_client_contact_id_foreign` FOREIGN KEY (`client_contact_id`) REFERENCES `client_contacts` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `payments_client_id_foreign` FOREIGN KEY (`client_id`) REFERENCES `clients` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `payments_company_gateway_id_foreign` FOREIGN KEY (`company_gateway_id`) REFERENCES `company_gateways` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
@ -1238,10 +1271,14 @@ CREATE TABLE `products` (
`created_at` timestamp(6) NULL DEFAULT NULL,
`updated_at` timestamp(6) NULL DEFAULT NULL,
`is_deleted` tinyint(1) NOT NULL DEFAULT 0,
`in_stock_quantity` int(11) NOT NULL DEFAULT 0,
`stock_notification` tinyint(1) NOT NULL DEFAULT 1,
`stock_notification_threshold` int(11) NOT NULL DEFAULT 0,
PRIMARY KEY (`id`),
KEY `products_company_id_deleted_at_index` (`company_id`,`deleted_at`),
KEY `products_user_id_foreign` (`user_id`),
KEY `products_company_id_index` (`company_id`),
KEY `pro_co_us_up_index` (`company_id`,`user_id`,`assigned_user_id`,`updated_at`),
CONSTRAINT `products_company_id_foreign` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `products_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
@ -1280,6 +1317,118 @@ CREATE TABLE `projects` (
CONSTRAINT `projects_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `purchase_order_invitations`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `purchase_order_invitations` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`company_id` int(10) unsigned NOT NULL,
`user_id` int(10) unsigned NOT NULL,
`vendor_contact_id` int(10) unsigned NOT NULL,
`purchase_order_id` bigint(20) unsigned NOT NULL,
`key` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`transaction_reference` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`message_id` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`email_error` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`signature_base64` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`signature_date` datetime DEFAULT NULL,
`sent_date` datetime DEFAULT NULL,
`viewed_date` datetime DEFAULT NULL,
`opened_date` datetime DEFAULT NULL,
`created_at` timestamp(6) NULL DEFAULT NULL,
`updated_at` timestamp(6) NULL DEFAULT NULL,
`deleted_at` timestamp(6) NULL DEFAULT NULL,
`email_status` enum('delivered','bounced','spam') COLLATE utf8mb4_unicode_ci DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `vendor_purchase_unique` (`vendor_contact_id`,`purchase_order_id`),
KEY `purchase_order_invitations_user_id_foreign` (`user_id`),
KEY `purchase_order_invitations_company_id_foreign` (`company_id`),
KEY `vendor_purchase_company_index` (`deleted_at`,`purchase_order_id`,`company_id`),
KEY `purchase_order_invitations_purchase_order_id_index` (`purchase_order_id`),
KEY `purchase_order_invitations_key_index` (`key`),
KEY `purchase_order_invitations_message_id_index` (`message_id`),
CONSTRAINT `purchase_order_invitations_company_id_foreign` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `purchase_order_invitations_purchase_order_id_foreign` FOREIGN KEY (`purchase_order_id`) REFERENCES `purchase_orders` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `purchase_order_invitations_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `purchase_order_invitations_vendor_contact_id_foreign` FOREIGN KEY (`vendor_contact_id`) REFERENCES `vendor_contacts` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `purchase_orders`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `purchase_orders` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`client_id` int(10) unsigned DEFAULT NULL,
`user_id` int(10) unsigned NOT NULL,
`assigned_user_id` int(10) unsigned DEFAULT NULL,
`company_id` int(10) unsigned NOT NULL,
`status_id` int(10) unsigned NOT NULL,
`project_id` int(10) unsigned DEFAULT NULL,
`vendor_id` int(10) unsigned DEFAULT NULL,
`recurring_id` int(10) unsigned DEFAULT NULL,
`design_id` int(10) unsigned DEFAULT NULL,
`invoice_id` int(10) unsigned DEFAULT NULL,
`number` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`discount` double(8,2) NOT NULL DEFAULT 0.00,
`is_amount_discount` tinyint(1) NOT NULL DEFAULT 0,
`po_number` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`date` date DEFAULT NULL,
`last_sent_date` datetime DEFAULT NULL,
`due_date` date DEFAULT NULL,
`is_deleted` tinyint(1) NOT NULL DEFAULT 0,
`line_items` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`backup` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`footer` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`public_notes` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`private_notes` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`terms` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`tax_name1` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`tax_rate1` decimal(20,6) NOT NULL DEFAULT 0.000000,
`tax_name2` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`tax_rate2` decimal(20,6) NOT NULL DEFAULT 0.000000,
`tax_name3` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`tax_rate3` decimal(20,6) NOT NULL DEFAULT 0.000000,
`total_taxes` decimal(20,6) NOT NULL DEFAULT 0.000000,
`uses_inclusive_taxes` tinyint(1) NOT NULL DEFAULT 0,
`reminder1_sent` date DEFAULT NULL,
`reminder2_sent` date DEFAULT NULL,
`reminder3_sent` date DEFAULT NULL,
`reminder_last_sent` date DEFAULT NULL,
`custom_value1` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`custom_value2` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`custom_value3` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`custom_value4` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`next_send_date` datetime DEFAULT NULL,
`custom_surcharge1` decimal(20,6) DEFAULT NULL,
`custom_surcharge2` decimal(20,6) DEFAULT NULL,
`custom_surcharge3` decimal(20,6) DEFAULT NULL,
`custom_surcharge4` decimal(20,6) DEFAULT NULL,
`custom_surcharge_tax1` tinyint(1) NOT NULL DEFAULT 0,
`custom_surcharge_tax2` tinyint(1) NOT NULL DEFAULT 0,
`custom_surcharge_tax3` tinyint(1) NOT NULL DEFAULT 0,
`custom_surcharge_tax4` tinyint(1) NOT NULL DEFAULT 0,
`exchange_rate` decimal(20,6) NOT NULL DEFAULT 1.000000,
`balance` decimal(20,6) NOT NULL,
`partial` decimal(20,6) DEFAULT NULL,
`amount` decimal(20,6) NOT NULL,
`paid_to_date` decimal(20,6) NOT NULL DEFAULT 0.000000,
`partial_due_date` datetime DEFAULT NULL,
`last_viewed` datetime DEFAULT NULL,
`deleted_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
`expense_id` int(10) unsigned DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `purchase_orders_user_id_foreign` (`user_id`),
KEY `purchase_orders_company_id_deleted_at_index` (`company_id`,`deleted_at`),
KEY `purchase_orders_client_id_index` (`client_id`),
KEY `purchase_orders_company_id_index` (`company_id`),
KEY `purchase_orders_expense_id_index` (`expense_id`),
CONSTRAINT `purchase_orders_client_id_foreign` FOREIGN KEY (`client_id`) REFERENCES `clients` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `purchase_orders_company_id_foreign` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `purchase_orders_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `quote_invitations`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
@ -1388,6 +1537,7 @@ CREATE TABLE `quotes` (
KEY `quotes_company_id_deleted_at_index` (`company_id`,`deleted_at`),
KEY `quotes_client_id_index` (`client_id`),
KEY `quotes_company_id_index` (`company_id`),
KEY `quotes_company_id_updated_at_index` (`company_id`,`updated_at`),
CONSTRAINT `quotes_client_id_foreign` FOREIGN KEY (`client_id`) REFERENCES `clients` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `quotes_company_id_foreign` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `quotes_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
@ -1447,6 +1597,7 @@ CREATE TABLE `recurring_expenses` (
`last_sent_date` datetime DEFAULT NULL,
`next_send_date` datetime DEFAULT NULL,
`remaining_cycles` int(11) DEFAULT NULL,
`next_send_date_client` datetime DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `recurring_expenses_company_id_number_unique` (`company_id`,`number`),
KEY `recurring_expenses_company_id_deleted_at_index` (`company_id`,`deleted_at`),
@ -1555,6 +1706,7 @@ CREATE TABLE `recurring_invoices` (
`exchange_rate` decimal(13,6) NOT NULL DEFAULT 1.000000,
`paid_to_date` decimal(20,6) NOT NULL DEFAULT 0.000000,
`subscription_id` int(10) unsigned DEFAULT NULL,
`next_send_date_client` datetime DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `recurring_invoices_company_id_number_unique` (`company_id`,`number`),
KEY `recurring_invoices_company_id_deleted_at_index` (`company_id`,`deleted_at`),
@ -1676,6 +1828,27 @@ CREATE TABLE `recurring_quotes` (
CONSTRAINT `recurring_quotes_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `schedulers`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `schedulers` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`paused` tinyint(1) NOT NULL DEFAULT 0,
`is_deleted` tinyint(1) NOT NULL DEFAULT 0,
`repeat_every` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`start_from` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`scheduled_run` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
`company_id` bigint(20) unsigned NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
`deleted_at` timestamp NULL DEFAULT NULL,
`action_name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`action_class` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`parameters` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `schedulers_action_name_index` (`action_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `sizes`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
@ -1917,9 +2090,10 @@ CREATE TABLE `users` (
`created_at` timestamp(6) NULL DEFAULT NULL,
`updated_at` timestamp(6) NULL DEFAULT NULL,
`deleted_at` timestamp(6) NULL DEFAULT NULL,
`oauth_user_refresh_token` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`oauth_user_refresh_token` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`last_confirmed_email_address` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`has_password` tinyint(1) NOT NULL DEFAULT 0,
`oauth_user_token_expiry` datetime DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `users_email_unique` (`email`),
UNIQUE KEY `users_oauth_user_id_oauth_provider_id_unique` (`oauth_user_id`,`oauth_provider_id`),
@ -1972,6 +2146,8 @@ CREATE TABLE `vendor_contacts` (
KEY `vendor_contacts_user_id_foreign` (`user_id`),
KEY `vendor_contacts_vendor_id_index` (`vendor_id`),
KEY `vendor_contacts_company_id_email_deleted_at_index` (`company_id`,`email`,`deleted_at`),
KEY `vendor_contacts_contact_key(20)_index` (`contact_key`(20)),
KEY `vendor_contacts_email_index` (`email`),
CONSTRAINT `vendor_contacts_company_id_foreign` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `vendor_contacts_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `vendor_contacts_vendor_id_foreign` FOREIGN KEY (`vendor_id`) REFERENCES `vendors` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
@ -2182,3 +2358,35 @@ INSERT INTO `migrations` VALUES (128,'2022_05_08_004937_heal_stripe_gateway_conf
INSERT INTO `migrations` VALUES (129,'2022_05_16_224917_add_auto_bill_tries_to_invoices_table',1);
INSERT INTO `migrations` VALUES (130,'2022_05_18_055442_update_custom_value_four_columns',1);
INSERT INTO `migrations` VALUES (131,'2022_05_23_050754_drop_redundant_column_show_production_description_dropdown',1);
INSERT INTO `migrations` VALUES (132,'2022_04_14_121548_forte_payment_gateway',2);
INSERT INTO `migrations` VALUES (133,'2022_05_18_162152_create_scheduled_jobs_table',2);
INSERT INTO `migrations` VALUES (134,'2022_05_18_162443_create_schedulers_table',2);
INSERT INTO `migrations` VALUES (135,'2022_05_28_234651_create_purchase_orders_table',2);
INSERT INTO `migrations` VALUES (136,'2022_05_30_181109_drop_scheduled_jobs_table',2);
INSERT INTO `migrations` VALUES (137,'2022_05_30_184320_add_job_related_fields_to_schedulers_table',2);
INSERT INTO `migrations` VALUES (138,'2022_05_31_101504_inventory_management_schema',2);
INSERT INTO `migrations` VALUES (139,'2022_06_01_215859_set_recurring_client_timestamp',2);
INSERT INTO `migrations` VALUES (140,'2022_06_01_224339_create_purchase_order_invitations_table',2);
INSERT INTO `migrations` VALUES (141,'2022_06_10_030503_set_account_flag_for_react',2);
INSERT INTO `migrations` VALUES (142,'2022_06_16_025156_add_react_switching_flag',2);
INSERT INTO `migrations` VALUES (143,'2022_06_17_082627_change_refresh_token_column_size',2);
INSERT INTO `migrations` VALUES (144,'2022_06_21_104350_fixes_for_description_in_pdf_designs',2);
INSERT INTO `migrations` VALUES (145,'2022_06_22_090547_set_oauth_expiry_column',2);
INSERT INTO `migrations` VALUES (146,'2022_06_24_141018_upgrade_failed_jobs_table',2);
INSERT INTO `migrations` VALUES (147,'2022_06_30_000126_add_flag_to_accounts_table',2);
INSERT INTO `migrations` VALUES (148,'2022_07_06_080127_add_purchase_order_to_expense',2);
INSERT INTO `migrations` VALUES (149,'2022_07_09_235510_add_index_to_payment_hash',2);
INSERT INTO `migrations` VALUES (150,'2022_07_18_033756_fixes_for_date_formats_table_react',2);
INSERT INTO `migrations` VALUES (151,'2022_07_21_023805_add_hebrew_language',2);
INSERT INTO `migrations` VALUES (152,'2022_07_26_091216_add_sms_verification_to_hosted_account',2);
INSERT INTO `migrations` VALUES (153,'2022_07_28_232340_enabled_expense_tax_rates_to_companies_table',2);
INSERT INTO `migrations` VALUES (154,'2022_07_29_091235_correction_for_companies_table_types',2);
INSERT INTO `migrations` VALUES (155,'2022_08_11_011534_licenses_table_for_self_host',2);
INSERT INTO `migrations` VALUES (156,'2022_08_24_215917_invoice_task_project_companies_table',2);
INSERT INTO `migrations` VALUES (157,'2022_08_26_232500_add_email_status_column_to_purchase_order_invitations_table',2);
INSERT INTO `migrations` VALUES (158,'2022_08_28_210111_add_index_to_payments_table',2);
INSERT INTO `migrations` VALUES (159,'2022_09_05_024719_update_designs_for_tech_template',2);
INSERT INTO `migrations` VALUES (160,'2022_09_07_101731_add_reporting_option_to_companies_table',2);
INSERT INTO `migrations` VALUES (161,'2022_09_21_012417_add_threeds_to_braintree',2);
INSERT INTO `migrations` VALUES (162,'2022_09_30_235337_add_idempotency_key_to_payments',2);
INSERT INTO `migrations` VALUES (163,'2022_10_05_205645_add_indexes_to_client_hash',2);

View File

@ -3414,7 +3414,7 @@ $LANG = array(
'credit_number_counter' => 'Credit Number Counter',
'reset_counter_date' => 'Reset Counter Date',
'counter_padding' => 'Counter Padding',
'shared_invoice_quote_counter' => 'Shared Invoice Quote Counter',
'shared_invoice_quote_counter' => 'Share Invoice Quote Counter',
'default_tax_name_1' => 'Default Tax Name 1',
'default_tax_rate_1' => 'Default Tax Rate 1',
'default_tax_name_2' => 'Default Tax Name 2',
@ -4199,7 +4199,7 @@ $LANG = array(
'client_id_number' => 'Client ID Number',
'count_minutes' => ':count Minutes',
'password_timeout' => 'Password Timeout',
'shared_invoice_credit_counter' => 'Shared Invoice/Credit Counter',
'shared_invoice_credit_counter' => 'Share Invoice/Credit Counter',
'activity_80' => ':user created subscription :subscription',
'activity_81' => ':user updated subscription :subscription',
@ -4776,7 +4776,8 @@ $LANG = array(
'client_email' => 'Client Email',
'invoice_task_project' => 'Invoice Task Project',
'invoice_task_project_help' => 'Add the project to the invoice line items',
'bulk_action' => 'Bulk Action',
);
return $LANG;

View File

@ -4,9 +4,9 @@ const TEMP = 'flutter-temp-cache';
const CACHE_NAME = 'flutter-app-cache';
const RESOURCES = {
"favicon.png": "dca91c54388f52eded692718d5a98b8b",
"main.dart.js": "e339f12c38421420b7a8d4c647c41252",
"main.dart.js": "816eb6e0aa8c1f38ca5f0ddcd2e9a73b",
"favicon.ico": "51636d3a390451561744c42188ccd628",
"/": "a521806c672349a6153841b796d093fd",
"/": "0c9743ec646dd75ba43a367a96d6868d",
"flutter.js": "f85e6fb278b0fd20c349186fb46ae36d",
"manifest.json": "ef43d90e57aa7682d7e2cfba2f484a40",
"canvaskit/canvaskit.js": "2bc454a691c631b07a9307ac4ca47797",

199360
public/main.dart.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

203871
public/main.foss.dart.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,14 +1,14 @@
@extends('portal.ninja2020.layout.payments', ['gateway_title' => 'Bank Transfer', 'card_title' => 'Bank Transfer'])
@section('gateway_head')
<meta name="forte-api-login-id" content="{{$gateway->forte->company_gateway->getConfigField("apiLoginId")}}">
<meta name="forte-api-login-id" content="{{$gateway->company_gateway->getConfigField("apiLoginId")}}">
@endsection
@section('gateway_content')
<form action="{{ route('client.payments.response') }}" method="post" id="server_response">
@csrf
<input type="hidden" name="payment_hash" value="{{ $payment_hash }}">
<input type="hidden" name="company_gateway_id" value="{{ $gateway->forte->company_gateway->id }}">
<input type="hidden" name="company_gateway_id" value="{{ $gateway->company_gateway->id }}">
<input type="hidden" name="payment_method_id" value="{{$payment_method_id}}">
<input type="hidden" name="gateway_response" id="gateway_response">
<input type="hidden" name="dataValue" id="dataValue"/>
@ -43,7 +43,7 @@
@endsection
@section('gateway_footer')
@if($gateway->forte->company_gateway->getConfigField('testMode'))
@if($gateway->company_gateway->getConfigField('testMode'))
<script type="text/javascript" src="https://sandbox.forte.net/api/js/v1"></script>
@else
<script type="text/javascript" src="https://api.forte.net/js/v1"></script>

View File

@ -1,7 +1,7 @@
@extends('portal.ninja2020.layout.payments', ['gateway_title' => ctrans('texts.payment_type_credit_card'), 'card_title' => ctrans('texts.payment_type_credit_card')])
@section('gateway_head')
<meta name="forte-api-login-id" content="{{$gateway->forte->company_gateway->getConfigField("apiLoginId")}}">
<meta name="forte-api-login-id" content="{{$gateway->company_gateway->getConfigField("apiLoginId")}}">
<script src="https://code.jquery.com/jquery-1.11.3.min.js"></script>
<script src="{{ asset('js/clients/payments/forte-card-js.min.js') }}"></script>
@ -14,7 +14,7 @@
<input type="hidden" name="card_brand" id="card_brand">
<input type="hidden" name="payment_token" id="payment_token">
<input type="hidden" name="payment_hash" value="{{ $payment_hash }}">
<input type="hidden" name="company_gateway_id" value="{{ $gateway->forte->company_gateway->id }}">
<input type="hidden" name="company_gateway_id" value="{{ $gateway->company_gateway->id }}">
<input type="hidden" name="payment_method_id" value="{{$payment_method_id}}">
<input type="hidden" name="gateway_response" id="gateway_response">
<input type="hidden" name="dataValue" id="dataValue"/>
@ -41,7 +41,7 @@
@endsection
@section('gateway_footer')
@if($gateway->forte->company_gateway->getConfigField('testMode'))
@if($gateway->company_gateway->getConfigField('testMode'))
<script type="text/javascript" src="https://sandbox.forte.net/api/js/v1"></script>
@else
<script type="text/javascript" src="https://api.forte.net/js/v1"></script>

View File

@ -207,8 +207,10 @@
gateway_response.value = JSON.stringify(paymentIntent);
document.getElementById('server-response').submit();
} else if (paymentIntent.next_action?.type === "verify_with_microdeposits") {
} else if (paymentIntent.next_action?.type === "verify_with_microdeposits" || paymentIntent.next_action?.type === "requires_source_action") {
errors.textContent = "You will receive an email with details on how to verify your bank account and process payment.";
errors.hidden = false;
document.getElementById('new-bank').style.visibility = 'hidden'
}
});

View File

@ -7,7 +7,7 @@
<img src="{{ asset('images/wepay.svg') }}" alt="We Pay">
</div>
@livewire('wepay-signup', ['user_id' => $user_id, 'company' => $company])
@livewire('wepay-signup', ['user_id' => $user_id, 'company' => $user_company])
</div>
@endsection