Pad out operators for rules

This commit is contained in:
David Bomba 2022-11-13 15:41:34 +11:00
parent 6ef21be16c
commit dc6aca74b2
3 changed files with 38 additions and 2 deletions

View File

@ -33,7 +33,12 @@ class StoreBankTransactionRuleRequest extends Request
{
/* Ensure we have a client name, and that all emails are unique*/
$rules = [
'name' => 'bail|required|string'
'name' => 'bail|required|string',
'rules' => 'bail|array',
'auto_convert' => 'bail|sometimes|bool',
'matches_on_all' => 'bail|sometimes|bool',
'applies_to' => 'bail|sometimes|bool',
'record_as' => 'bail|sometimes|bool',
];
if (isset($this->currency_id))

View File

@ -32,7 +32,12 @@ class UpdateBankTransactionRuleRequest extends Request
{
/* Ensure we have a client name, and that all emails are unique*/
$rules = [
'name' => 'bail|required|string'
'name' => 'bail|required|string',
'rules' => 'bail|array',
'auto_convert' => 'bail|sometimes|bool',
'matches_on_all' => 'bail|sometimes|bool',
'applies_to' => 'bail|sometimes|bool',
'record_as' => 'bail|sometimes|bool',
];
if (isset($this->currency_id))

View File

@ -36,6 +36,32 @@ class BankTransactionRule extends BaseModel
protected $dates = [
];
/* Columns to search */
protected array $search_keys = [
'client_id' => 'client',
'vendor_id' => 'vendor',
'description' => 'description',
'transaction_reference' => 'transaction_reference',
'amount' => 'amount',
];
/* Amount */
protected array $number_operators = [
'=',
'>',
'>=',
'<',
'<='
];
/* Description, Client, Vendor, Reference Number */
protected array $string_operators = [
'is',
'contains',
'starts_with',
'is_empty',
];
public function getEntityType()
{
return self::class;