mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Fixes for validation
This commit is contained in:
parent
871b6dd54d
commit
56fc585828
@ -45,6 +45,10 @@ class Request extends FormRequest
|
|||||||
$merge_rules = [];
|
$merge_rules = [];
|
||||||
|
|
||||||
foreach ($this->all() as $key => $value) {
|
foreach ($this->all() as $key => $value) {
|
||||||
|
|
||||||
|
if($key == 'user')
|
||||||
|
continue;
|
||||||
|
|
||||||
if (method_exists($this, $key)) {
|
if (method_exists($this, $key)) {
|
||||||
$merge_rules = $this->{$key}($rules);
|
$merge_rules = $this->{$key}($rules);
|
||||||
}
|
}
|
||||||
|
@ -92,7 +92,6 @@ class StoreTaskRequest extends Request
|
|||||||
$rules['file'] = $this->fileValidation();
|
$rules['file'] = $this->fileValidation();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return $this->globalRules($rules);
|
return $this->globalRules($rules);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -137,9 +137,6 @@ class UpdateTaskRequest extends Request
|
|||||||
$input['time_log'] = json_encode([]);
|
$input['time_log'] = json_encode([]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isset($input['user']))
|
|
||||||
unset($input['user']);
|
|
||||||
|
|
||||||
$this->replace($input);
|
$this->replace($input);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,6 +17,7 @@ use App\Utils\Helpers;
|
|||||||
use App\Models\Account;
|
use App\Models\Account;
|
||||||
use App\Models\Payment;
|
use App\Models\Payment;
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
|
use App\Utils\Traits\MakesHash;
|
||||||
use App\Utils\Traits\MakesDates;
|
use App\Utils\Traits\MakesDates;
|
||||||
use App\Jobs\Entity\CreateRawPdf;
|
use App\Jobs\Entity\CreateRawPdf;
|
||||||
use Illuminate\Support\Facades\App;
|
use Illuminate\Support\Facades\App;
|
||||||
@ -28,7 +29,8 @@ use App\Services\Template\TemplateAction;
|
|||||||
class PaymentEmailEngine extends BaseEmailEngine
|
class PaymentEmailEngine extends BaseEmailEngine
|
||||||
{
|
{
|
||||||
use MakesDates;
|
use MakesDates;
|
||||||
|
use MakesHash;
|
||||||
|
|
||||||
public $client;
|
public $client;
|
||||||
|
|
||||||
/** @var \App\Models\Payment $payment */
|
/** @var \App\Models\Payment $payment */
|
||||||
@ -97,11 +99,12 @@ class PaymentEmailEngine extends BaseEmailEngine
|
|||||||
->setViewLink('')
|
->setViewLink('')
|
||||||
->setViewText('');
|
->setViewText('');
|
||||||
|
|
||||||
|
|
||||||
if ($this->client->getSetting('pdf_email_attachment') !== false && $this->company->account->hasFeature(Account::FEATURE_PDF_ATTACHMENT)) {
|
if ($this->client->getSetting('pdf_email_attachment') !== false && $this->company->account->hasFeature(Account::FEATURE_PDF_ATTACHMENT)) {
|
||||||
|
|
||||||
$template_in_use = false;
|
$template_in_use = false;
|
||||||
|
|
||||||
if($this->is_refund && strlen($this->payment->client->getSetting('payment_refund_design_id')) > 2) {
|
if($this->is_refund && \App\Models\Design::where('id', $this->decodePrimaryKey($this->payment->client->getSetting('payment_refund_design_id')))->where('is_template', true)->exists()) {
|
||||||
$pdf = (new TemplateAction(
|
$pdf = (new TemplateAction(
|
||||||
[$this->payment->hashed_id],
|
[$this->payment->hashed_id],
|
||||||
$this->payment->client->getSetting('payment_refund_design_id'),
|
$this->payment->client->getSetting('payment_refund_design_id'),
|
||||||
@ -118,7 +121,7 @@ class PaymentEmailEngine extends BaseEmailEngine
|
|||||||
$this->setAttachments([['file' => base64_encode($pdf), 'name' => $file_name]]);
|
$this->setAttachments([['file' => base64_encode($pdf), 'name' => $file_name]]);
|
||||||
$template_in_use = true;
|
$template_in_use = true;
|
||||||
|
|
||||||
} elseif(!$this->is_refund && strlen($this->payment->client->getSetting('payment_receipt_design_id')) > 2) {
|
} elseif(!$this->is_refund && \App\Models\Design::where('id', $this->decodePrimaryKey($this->payment->client->getSetting('payment_receipt_design_id')))->where('is_template', true)->exists()) {
|
||||||
$pdf = (new TemplateAction(
|
$pdf = (new TemplateAction(
|
||||||
[$this->payment->hashed_id],
|
[$this->payment->hashed_id],
|
||||||
$this->payment->client->getSetting('payment_receipt_design_id'),
|
$this->payment->client->getSetting('payment_receipt_design_id'),
|
||||||
|
@ -66,7 +66,9 @@ class Statement
|
|||||||
|
|
||||||
$option_template = &$this->options['template'];
|
$option_template = &$this->options['template'];
|
||||||
|
|
||||||
if($this->client->getSetting('statement_design_id') != '' || $option_template && $option_template != '') {
|
$custom_statement_template = \App\Models\Design::where('id', $this->decodePrimaryKey($this->client->getSetting('statement_design_id')))->where('is_template',true)->first();
|
||||||
|
|
||||||
|
if($custom_statement_template || $option_template && $option_template != '') {
|
||||||
|
|
||||||
$variables['values']['$start_date'] = $this->translateDate($this->options['start_date'], $this->client->date_format(), $this->client->locale());
|
$variables['values']['$start_date'] = $this->translateDate($this->options['start_date'], $this->client->date_format(), $this->client->locale());
|
||||||
$variables['values']['$end_date'] = $this->translateDate($this->options['end_date'], $this->client->date_format(), $this->client->locale());
|
$variables['values']['$end_date'] = $this->translateDate($this->options['end_date'], $this->client->date_format(), $this->client->locale());
|
||||||
|
@ -104,6 +104,27 @@ class TaskApiTest extends TestCase
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testRequestRuleParsing()
|
||||||
|
{
|
||||||
|
|
||||||
|
$data = [
|
||||||
|
'client_id' => $this->client->hashed_id,
|
||||||
|
'description' => 'Test Task',
|
||||||
|
'time_log' => '[[1681165417,1681165432,"sumtin",true],[1681165446,0]]',
|
||||||
|
'assigned_user' => [],
|
||||||
|
'project' => [],
|
||||||
|
'user' => [],
|
||||||
|
// 'status' => [],
|
||||||
|
];
|
||||||
|
|
||||||
|
$response = $this->withHeaders([
|
||||||
|
'X-API-SECRET' => config('ninja.api_secret'),
|
||||||
|
'X-API-TOKEN' => $this->token,
|
||||||
|
])->postJson("/api/v1/tasks", $data);
|
||||||
|
|
||||||
|
$response->assertStatus(200);
|
||||||
|
|
||||||
|
}
|
||||||
public function testUserFilters()
|
public function testUserFilters()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user