Merge pull request #7955 from turbo124/v5-develop

v5.5.41
This commit is contained in:
David Bomba 2022-11-20 09:22:07 +11:00 committed by GitHub
commit a26c50dca3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 263 additions and 23 deletions

View File

@ -1 +1 @@
5.5.40 5.5.41

View File

@ -55,6 +55,55 @@ class BankTransactionFilters extends QueryFilters
} }
/**
* Filter based on client status.
*
* Statuses we need to handle
* - all
* - unmatched
* - matched
* - converted
* - deposits
* - withdrawals
*
* @return Builder
*/
public function client_status(string $value = '') :Builder
{
if (strlen($value) == 0) {
return $this->builder;
}
$status_parameters = explode(',', $value);
if (in_array('all', $status_parameters)) {
return $this->builder;
}
if (in_array('unmatched', $status_parameters)) {
$this->builder->where('status_id', BankTransaction::STATUS_UNMATCHED);
}
if (in_array('matched', $status_parameters)) {
$this->builder->where('status_id', BankTransaction::STATUS_MATCHED);
}
if (in_array('converted', $status_parameters)) {
$this->builder->where('status_id', BankTransaction::STATUS_CONVERTED);
}
if (in_array('deposits', $status_parameters)) {
$this->builder->where('base_type', 'CREDIT');
}
if (in_array('withdrawals', $status_parameters)) {
$this->builder->where('base_type', 'DEBIT');
}
return $this->builder;
}
/** /**
* Filters the list based on the status * Filters the list based on the status
* archived, active, deleted. * archived, active, deleted.

View File

@ -44,6 +44,55 @@ class ExpenseFilters extends QueryFilters
}); });
} }
/**
* Filter based on client status.
*
* Statuses we need to handle
* - all
* - logged
* - pending
* - invoiced
* - paid
* - unpaid
*
* @return Builder
*/
public function client_status(string $value = '') :Builder
{
if (strlen($value) == 0) {
return $this->builder;
}
$status_parameters = explode(',', $value);
if (in_array('all', $status_parameters)) {
return $this->builder;
}
if (in_array('logged', $status_parameters)) {
$this->builder->where('amount', '>', 0);
}
if (in_array('pending', $status_parameters)) {
$this->builder->whereNull('invoice_id')->whereNotNull('payment_date');
}
if (in_array('invoiced', $status_parameters)) {
$this->builder->whereNotNull('invoice_id');
}
if (in_array('paid', $status_parameters)) {
$this->builder->whereNotNull('payment_date');
}
if (in_array('unpaid', $status_parameters)) {
$this->builder->whereNull('payment_date');
}
return $this->builder;
}
/** /**
* Filters the list based on the status * Filters the list based on the status
* archived, active, deleted. * archived, active, deleted.

View File

@ -17,19 +17,20 @@ use Illuminate\Database\Eloquent\Builder;
class PurchaseOrderFilters extends QueryFilters class PurchaseOrderFilters extends QueryFilters
{ {
/** /**
* Filter based on client status. * Filter based on client status.
* *
* Statuses we need to handle * Statuses we need to handle
* - all * - all
* - paid * - draft
* - unpaid * - sent
* - overdue * - accepted
* - reversed * - cancelled
* *
* @return Builder * @return Builder
*/ */
public function credit_status(string $value = '') :Builder public function client_status(string $value = '') :Builder
{ {
if (strlen($value) == 0) { if (strlen($value) == 0) {
return $this->builder; return $this->builder;
@ -45,16 +46,17 @@ class PurchaseOrderFilters extends QueryFilters
$this->builder->where('status_id', PurchaseOrder::STATUS_DRAFT); $this->builder->where('status_id', PurchaseOrder::STATUS_DRAFT);
} }
if (in_array('partial', $status_parameters)) { if (in_array('sent', $status_parameters)) {
$this->builder->where('status_id', PurchaseOrder::STATUS_PARTIAL); $this->builder->where('status_id', PurchaseOrder::STATUS_SENT);
} }
if (in_array('applied', $status_parameters)) { if (in_array('accepted', $status_parameters)) {
$this->builder->where('status_id', PurchaseOrder::STATUS_APPLIED); $this->builder->where('status_id', PurchaseOrder::STATUS_ACCEPTED);
} }
//->where('due_date', '>', Carbon::now()) if (in_array('cancelled', $status_parameters)) {
//->orWhere('partial_due_date', '>', Carbon::now()); $this->builder->where('status_id', PurchaseOrder::STATUS_CANCELLED);
}
return $this->builder; return $this->builder;
} }

View File

@ -11,6 +11,7 @@
namespace App\Filters; namespace App\Filters;
use App\Models\Quote;
use App\Models\User; use App\Models\User;
use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Builder;
@ -41,6 +42,51 @@ class QuoteFilters extends QueryFilters
}); });
} }
/**
* Filter based on client status.
*
* Statuses we need to handle
* - all
* - active
* - paused
* - completed
*
* @param string client_status The invoice status as seen by the client
* @return Builder
*/
public function client_status(string $value = '') :Builder
{
if (strlen($value) == 0) {
return $this->builder;
}
$status_parameters = explode(',', $value);
if (in_array('all', $status_parameters)) {
return $this->builder;
}
if (in_array('draft', $status_parameters)) {
$this->builder->where('status_id', Quote::STATUS_DRAFT);
}
if (in_array('sent', $status_parameters)) {
$this->builder->where('status_id', Quote::STATUS_SENT);
}
if (in_array('approved', $status_parameters)) {
$this->builder->where('status_id', Quote::STATUS_APPROVED);
}
if (in_array('expired', $status_parameters)) {
$this->builder->where('status_id', Quote::STATUS_SENT)
->where('due_date', '<=', now()->toDateString());
}
return $this->builder;
}
/** /**
* Filters the list based on the status * Filters the list based on the status
* archived, active, deleted. * archived, active, deleted.

View File

@ -11,6 +11,7 @@
namespace App\Filters; namespace App\Filters;
use App\Models\RecurringInvoice;
use App\Models\User; use App\Models\User;
use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Builder;
@ -40,6 +41,46 @@ class RecurringInvoiceFilters extends QueryFilters
}); });
} }
/**
* Filter based on client status.
*
* Statuses we need to handle
* - all
* - active
* - paused
* - completed
*
* @param string client_status The invoice status as seen by the client
* @return Builder
*/
public function client_status(string $value = '') :Builder
{
if (strlen($value) == 0) {
return $this->builder;
}
$status_parameters = explode(',', $value);
if (in_array('all', $status_parameters)) {
return $this->builder;
}
if (in_array('active', $status_parameters)) {
$this->builder->where('status_id', RecurringInvoice::STATUS_ACTIVE);
}
if (in_array('paused', $status_parameters)) {
$this->builder->where('status_id', RecurringInvoice::STATUS_PAUSED);
}
if (in_array('completed', $status_parameters)) {
$this->builder->where('status_id', RecurringInvoice::STATUS_COMPLETED);
}
return $this->builder;
}
/** /**
* Filters the list based on the status * Filters the list based on the status
* archived, active, deleted. * archived, active, deleted.

View File

@ -41,6 +41,37 @@ class TaskFilters extends QueryFilters
}); });
} }
/**
* Filter based on client status.
*
* Statuses we need to handle
* - all
* - invoiced
*
* @param string client_status The invoice status as seen by the client
* @return Builder
*/
public function client_status(string $value = '') :Builder
{
if (strlen($value) == 0) {
return $this->builder;
}
$status_parameters = explode(',', $value);
if (in_array('all', $status_parameters)) {
return $this->builder;
}
if (in_array('invoiced', $status_parameters)) {
$this->builder->whereNotNull('invoice_id');
}
return $this->builder;
}
/** /**
* Filters the list based on the status * Filters the list based on the status
* archived, active, deleted. * archived, active, deleted.

View File

@ -22,6 +22,14 @@ class UpdateCompanyRequest extends Request
{ {
use MakesHash; use MakesHash;
private array $protected_input = [
'client_portal_privacy_policy',
'client_portal_terms',
'portal_custom_footer',
'portal_custom_css',
'portal_custom_head'
];
/** /**
* Determine if the user is authorized to make this request. * Determine if the user is authorized to make this request.
* *
@ -32,6 +40,8 @@ class UpdateCompanyRequest extends Request
return auth()->user()->can('edit', $this->company); return auth()->user()->can('edit', $this->company);
} }
public function rules() public function rules()
{ {
$input = $this->all(); $input = $this->all();
@ -90,6 +100,14 @@ class UpdateCompanyRequest extends Request
{ {
$account = $this->company->account; $account = $this->company->account;
if(Ninja::isHosted())
{
foreach($this->protected_input as $protected_var)
{
$settings[$protected_var] = str_replace("script", "", $settings[$protected_var]);
}
}
if (! $account->isFreeHostedClient()) { if (! $account->isFreeHostedClient()) {
return $settings; return $settings;
} }

View File

@ -21,8 +21,6 @@ class InvoiceEmailFailedActivity implements ShouldQueue
{ {
protected $activity_repo; protected $activity_repo;
public $delay = 5;
/** /**
* Create the event listener. * Create the event listener.
* *

View File

@ -92,12 +92,14 @@ class CreditCard
$payment_hash = PaymentHash::where('hash', $request->input('payment_hash'))->firstOrFail(); $payment_hash = PaymentHash::where('hash', $request->input('payment_hash'))->firstOrFail();
$amount_with_fee = $payment_hash->data->total->amount_with_fee; $amount_with_fee = $payment_hash->data->total->amount_with_fee;
$invoice_totals = $payment_hash->data->total->invoice_totals; $invoice_totals = $payment_hash->data->total->invoice_totals;
$fee_total = 0; $fee_total = null;
$fees_and_limits = $this->forte->company_gateway->getFeesAndLimits(GatewayType::CREDIT_CARD); $fees_and_limits = $this->forte->company_gateway->getFeesAndLimits(GatewayType::CREDIT_CARD);
if(property_exists($fees_and_limits, 'fee_percent') && $fees_and_limits->fee_percent > 0) if(property_exists($fees_and_limits, 'fee_percent') && $fees_and_limits->fee_percent > 0)
{ {
$fee_total = 0;
for ($i = ($invoice_totals * 100) ; $i < ($amount_with_fee * 100); $i++) { for ($i = ($invoice_totals * 100) ; $i < ($amount_with_fee * 100); $i++) {
$calculated_fee = ( 3 * $i) / 100; $calculated_fee = ( 3 * $i) / 100;
$calculated_amount_with_fee = round(($i + $calculated_fee) / 100,2); $calculated_amount_with_fee = round(($i + $calculated_fee) / 100,2);

View File

@ -144,9 +144,9 @@ class Helpers
':QUARTER' => 'Q'.now()->quarter, ':QUARTER' => 'Q'.now()->quarter,
':WEEK_BEFORE' => \sprintf( ':WEEK_BEFORE' => \sprintf(
'%s %s %s', '%s %s %s',
Carbon::now()->subDays(6)->translatedFormat($entity->date_format()), Carbon::now()->subDays(7)->translatedFormat($entity->date_format()),
ctrans('texts.to'), ctrans('texts.to'),
Carbon::now()->translatedFormat($entity->date_format()) Carbon::now()->subDays(1)->translatedFormat($entity->date_format())
), ),
':WEEK_AHEAD' => \sprintf( ':WEEK_AHEAD' => \sprintf(
'%s %s %s', '%s %s %s',
@ -156,9 +156,9 @@ class Helpers
), ),
':WEEK' => \sprintf( ':WEEK' => \sprintf(
'%s %s %s', '%s %s %s',
Carbon::now()->translatedFormat($entity->date_format()), Carbon::now()->subDays(7)->translatedFormat($entity->date_format()),
ctrans('texts.to'), ctrans('texts.to'),
Carbon::now()->addDays(6)->translatedFormat($entity->date_format()) Carbon::now()->addDays(13)->translatedFormat($entity->date_format())
), ),
], ],
'raw' => [ 'raw' => [

View File

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

View File

@ -4839,6 +4839,10 @@ $LANG = array(
'show_tasks_in_client_portal' => 'Show Tasks in Client Portal', 'show_tasks_in_client_portal' => 'Show Tasks in Client Portal',
'notification_quote_expired_subject' => 'Quote :invoice has expired for :client', 'notification_quote_expired_subject' => 'Quote :invoice has expired for :client',
'notification_quote_expired' => 'The following Quote :invoice for client :client and :amount has now expired.', 'notification_quote_expired' => 'The following Quote :invoice for client :client and :amount has now expired.',
'auto_sync' => 'Auto Sync',
'refresh_accounts' => 'Refresh Accounts',
'upgrade_to_connect_bank_account' => 'Upgrade to Enterprise to connect your bank account',
'click_here_to_connect_bank_account' => 'Click here to connect your bank account',
); );
return $LANG; return $LANG;

View File

@ -163,7 +163,7 @@
@yield('footer') @yield('footer')
@stack('footer') @stack('footer')
@if((bool) \App\Utils\Ninja::isSelfHost() && !empty($client->getSetting('portal_custom_footer'))) @if($company && $company->account->isPaid() && !empty($client->getSetting('portal_custom_footer')))
<div class="py-1 text-sm text-center text-white bg-primary"> <div class="py-1 text-sm text-center text-white bg-primary">
{!! $client->getSetting('portal_custom_footer') !!} {!! $client->getSetting('portal_custom_footer') !!}
</div> </div>

View File

@ -164,7 +164,7 @@
@yield('footer') @yield('footer')
@stack('footer') @stack('footer')
@if((bool) \App\Utils\Ninja::isSelfHost() && !empty($settings->portal_custom_footer)) @if($company && $company->account->isPaid() && !empty($settings->portal_custom_footer))
<div class="py-1 text-sm text-center text-white bg-primary"> <div class="py-1 text-sm text-center text-white bg-primary">
{!! $settings->portal_custom_footer !!} {!! $settings->portal_custom_footer !!}
</div> </div>