mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-09-20 08:21:34 +02:00
Fixes for type checking for purchase orders
This commit is contained in:
parent
20f2d09326
commit
9ae0474de3
@ -138,6 +138,14 @@ class InvoiceFilters extends QueryFilters
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function without_deleted_clients()
|
||||||
|
{
|
||||||
|
|
||||||
|
return $this->builder->whereHas('client', function ($query) {
|
||||||
|
$query->where('is_deleted',0);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
public function upcoming()
|
public function upcoming()
|
||||||
{
|
{
|
||||||
return $this->builder
|
return $this->builder
|
||||||
@ -212,7 +220,7 @@ class InvoiceFilters extends QueryFilters
|
|||||||
{
|
{
|
||||||
if (auth()->guard('contact')->user()) {
|
if (auth()->guard('contact')->user()) {
|
||||||
return $this->contactViewFilter();
|
return $this->contactViewFilter();
|
||||||
} else {
|
} else {
|
||||||
return $this->builder->company()->with(['invitations.company'], ['documents.company']);
|
return $this->builder->company()->with(['invitations.company'], ['documents.company']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,12 +14,15 @@ namespace App\Http\Requests\PurchaseOrder;
|
|||||||
|
|
||||||
use App\Http\Requests\Request;
|
use App\Http\Requests\Request;
|
||||||
use App\Models\PurchaseOrder;
|
use App\Models\PurchaseOrder;
|
||||||
|
use App\Utils\Traits\CleanLineItems;
|
||||||
use App\Utils\Traits\MakesHash;
|
use App\Utils\Traits\MakesHash;
|
||||||
use Illuminate\Validation\Rule;
|
use Illuminate\Validation\Rule;
|
||||||
|
|
||||||
class StorePurchaseOrderRequest extends Request
|
class StorePurchaseOrderRequest extends Request
|
||||||
{
|
{
|
||||||
use MakesHash;
|
use MakesHash;
|
||||||
|
use CleanLineItems;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine if the user is authorized to make this request.
|
* Determine if the user is authorized to make this request.
|
||||||
*
|
*
|
||||||
@ -43,8 +46,6 @@ class StorePurchaseOrderRequest extends Request
|
|||||||
$rules['number'] = ['nullable', Rule::unique('purchase_orders')->where('company_id', auth()->user()->company()->id)];
|
$rules['number'] = ['nullable', Rule::unique('purchase_orders')->where('company_id', auth()->user()->company()->id)];
|
||||||
$rules['discount'] = 'sometimes|numeric';
|
$rules['discount'] = 'sometimes|numeric';
|
||||||
$rules['is_amount_discount'] = ['boolean'];
|
$rules['is_amount_discount'] = ['boolean'];
|
||||||
|
|
||||||
|
|
||||||
$rules['line_items'] = 'array';
|
$rules['line_items'] = 'array';
|
||||||
|
|
||||||
return $rules;
|
return $rules;
|
||||||
@ -56,6 +57,12 @@ class StorePurchaseOrderRequest extends Request
|
|||||||
|
|
||||||
$input = $this->decodePrimaryKeys($input);
|
$input = $this->decodePrimaryKeys($input);
|
||||||
|
|
||||||
|
if (isset($input['line_items']) && is_array($input['line_items']))
|
||||||
|
$input['line_items'] = isset($input['line_items']) ? $this->cleanItems($input['line_items']) : [];
|
||||||
|
|
||||||
|
$input['amount'] = 0;
|
||||||
|
$input['balance'] = 0;
|
||||||
|
|
||||||
$this->replace($input);
|
$this->replace($input);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,6 +14,7 @@ namespace App\Http\Requests\PurchaseOrder;
|
|||||||
|
|
||||||
use App\Http\Requests\Request;
|
use App\Http\Requests\Request;
|
||||||
use App\Utils\Traits\ChecksEntityStatus;
|
use App\Utils\Traits\ChecksEntityStatus;
|
||||||
|
use App\Utils\Traits\CleanLineItems;
|
||||||
use App\Utils\Traits\MakesHash;
|
use App\Utils\Traits\MakesHash;
|
||||||
use Illuminate\Validation\Rule;
|
use Illuminate\Validation\Rule;
|
||||||
|
|
||||||
@ -21,6 +22,7 @@ class UpdatePurchaseOrderRequest extends Request
|
|||||||
{
|
{
|
||||||
use ChecksEntityStatus;
|
use ChecksEntityStatus;
|
||||||
use MakesHash;
|
use MakesHash;
|
||||||
|
use CleanLineItems;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine if the user is authorized to make this request.
|
* Determine if the user is authorized to make this request.
|
||||||
@ -57,6 +59,10 @@ class UpdatePurchaseOrderRequest extends Request
|
|||||||
|
|
||||||
$input['id'] = $this->purchase_order->id;
|
$input['id'] = $this->purchase_order->id;
|
||||||
|
|
||||||
|
if (isset($input['line_items']) && is_array($input['line_items'])) {
|
||||||
|
$input['line_items'] = isset($input['line_items']) ? $this->cleanItems($input['line_items']) : [];
|
||||||
|
}
|
||||||
|
|
||||||
$this->replace($input);
|
$this->replace($input);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -318,20 +318,25 @@ class NinjaMailerJob implements ShouldQueue
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
/* GMail users are uncapped */
|
/* GMail users are uncapped */
|
||||||
if(Ninja::isHosted() && $this->nmo->settings->email_sending_method == 'gmail')
|
if(Ninja::isHosted() && ($this->nmo->settings->email_sending_method == 'gmail' || $this->nmo->settings->email_sending_method == 'office365'))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
/* On the hosted platform, if the user is over the email quotas, we do not send the email. */
|
/* On the hosted platform, if the user is over the email quotas, we do not send the email. */
|
||||||
if(Ninja::isHosted() && $this->company->account && $this->company->account->emailQuotaExceeded())
|
if(Ninja::isHosted() && $this->company->account && $this->company->account->emailQuotaExceeded())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
/* To handle spam users we drop all emails from flagged accounts */
|
||||||
if(Ninja::isHosted() && $this->company->account && $this->nmo->company->account->is_flagged)
|
if(Ninja::isHosted() && $this->company->account && $this->nmo->company->account->is_flagged)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
/* Ensure the user has a valid email address */
|
/* Ensure the user has a valid email address */
|
||||||
if(!str_contains($this->nmo->to_user->email, "@"))
|
if(!str_contains($this->nmo->to_user->email, "@"))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
/* On the hosted platform we actively scan all outbound emails to ensure outbound email quality remains high */
|
||||||
|
if(Ninja::isHosted())
|
||||||
|
return (new \Modules\Admin\Jobs\Account\EmailQuality($this->nmo, $this->company))->run();
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -373,7 +378,7 @@ class NinjaMailerJob implements ShouldQueue
|
|||||||
'form_params' => [
|
'form_params' => [
|
||||||
'client_id' => config('ninja.o365.client_id') ,
|
'client_id' => config('ninja.o365.client_id') ,
|
||||||
'client_secret' => config('ninja.o365.client_secret') ,
|
'client_secret' => config('ninja.o365.client_secret') ,
|
||||||
'scope' => 'email Mail.ReadWrite Mail.Send offline_access profile User.Read openid',
|
'scope' => 'email Mail.Send offline_access profile User.Read openid',
|
||||||
'grant_type' => 'refresh_token',
|
'grant_type' => 'refresh_token',
|
||||||
'refresh_token' => $user->oauth_user_refresh_token
|
'refresh_token' => $user->oauth_user_refresh_token
|
||||||
],
|
],
|
||||||
|
@ -15,6 +15,7 @@ class AddFlagToAccountsTable extends Migration
|
|||||||
{
|
{
|
||||||
Schema::table('accounts', function (Blueprint $table) {
|
Schema::table('accounts', function (Blueprint $table) {
|
||||||
$table->boolean('is_flagged')->default(0);
|
$table->boolean('is_flagged')->default(0);
|
||||||
|
$table->boolean('is_verified_account')->default(0);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user