Minor fixes for validation

This commit is contained in:
David Bomba 2023-11-04 09:53:20 +11:00
parent 3013f64e10
commit 10a6f7755b
6 changed files with 11 additions and 4 deletions

View File

@ -41,6 +41,9 @@ class ExpenseFilters extends QueryFilters
->orWhere('custom_value4', 'like', '%'.$filter.'%') ->orWhere('custom_value4', 'like', '%'.$filter.'%')
->orWhereHas('category', function ($q) use ($filter) { ->orWhereHas('category', function ($q) use ($filter) {
$q->where('name', 'like', '%'.$filter.'%'); $q->where('name', 'like', '%'.$filter.'%');
})
->orWhereHas('vendor', function ($q) use ($filter) {
$q->where('name', 'like', '%'.$filter.'%');
}); });
}); });
} }

View File

@ -82,6 +82,8 @@ class StoreRecurringInvoiceRequest extends Request
public function prepareForValidation() public function prepareForValidation()
{ {
$input = $this->all(); $input = $this->all();
$input['amount'] = 0;
$input['balance'] = 0;
if (array_key_exists('due_date_days', $input) && is_null($input['due_date_days'])) { if (array_key_exists('due_date_days', $input) && is_null($input['due_date_days'])) {
$input['due_date_days'] = 'terms'; $input['due_date_days'] = 'terms';

View File

@ -404,7 +404,9 @@ class GoCardlessPaymentDriver extends BaseDriver
$this->init(); $this->init();
$mandate = $this->gateway->mandates()->get($token); $mandate = $this->gateway->mandates()->get($token);
if ($mandate->status !== 'active') { if(!in_array($mandate->status, ['pending_submission', 'submitted', 'active','pending_customer_approval'])) {
// if ($mandate->status !== 'active') {
throw new \Exception(ctrans('texts.gocardless_mandate_not_ready')); throw new \Exception(ctrans('texts.gocardless_mandate_not_ready'));
} }
} catch (\Exception $exception) { } catch (\Exception $exception) {

View File

@ -199,7 +199,7 @@ class BaseRepository
}); });
} }
} }
nlog($model->toArray());
$model->saveQuietly(); $model->saveQuietly();
/* Model now persisted, now lets do some child tasks */ /* Model now persisted, now lets do some child tasks */

View File

@ -522,7 +522,7 @@ class TemplateService
'balance_raw' => ($payment->amount - $payment->refunded - $payment->applied), 'balance_raw' => ($payment->amount - $payment->refunded - $payment->applied),
'date' => $this->translateDate($payment->date, $payment->client->date_format(), $payment->client->locale()), 'date' => $this->translateDate($payment->date, $payment->client->date_format(), $payment->client->locale()),
'method' => $payment->translatedType(), 'method' => $payment->translatedType(),
'currency' => $payment->currency->code ?? $this->company->currency()->code, 'currency' => $payment->currency->code ?? $payment->company->currency()->code,
'exchange_rate' => $payment->exchange_rate, 'exchange_rate' => $payment->exchange_rate,
'transaction_reference' => $payment->transaction_reference, 'transaction_reference' => $payment->transaction_reference,
'is_manual' => $payment->is_manual, 'is_manual' => $payment->is_manual,

View File

@ -19,7 +19,7 @@ return [
'app_tag' => env('APP_TAG','5.7.42'), 'app_tag' => env('APP_TAG','5.7.42'),
'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', false),
'google_maps_api_key' => env('GOOGLE_MAPS_API_KEY'), 'google_maps_api_key' => env('GOOGLE_MAPS_API_KEY'),
'google_analytics_url' => env('GOOGLE_ANALYTICS_URL', 'https://www.google-analytics.com/collect'), 'google_analytics_url' => env('GOOGLE_ANALYTICS_URL', 'https://www.google-analytics.com/collect'),
'key_length' => 32, 'key_length' => 32,