mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2024-12-26 00:41:34 -06:00
Merge pull request #189 from roberthorlings/feature/trigger-matches-anything
Check for triggers that match anything
This commit is contained in:
commit
b3e18f4e56
@ -36,4 +36,12 @@ class RuleTrigger extends Model
|
||||
{
|
||||
return $this->belongsTo('FireflyIII\Models\Rule');
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether this trigger will match all transactions
|
||||
* For example: amount > 0 or description starts with ''
|
||||
*/
|
||||
public function matchesAnything() {
|
||||
return TriggerFactory::getTrigger($this, new TransactionJournal)->matchesAnything();
|
||||
}
|
||||
}
|
||||
|
@ -62,4 +62,11 @@ class AmountExactly implements TriggerInterface
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether this trigger will match all transactions
|
||||
* For example: amount > 0 or description starts with ''
|
||||
* @return bool
|
||||
*/
|
||||
public function matchesAnything() { return false; }
|
||||
}
|
||||
|
@ -62,4 +62,11 @@ class AmountLess implements TriggerInterface
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether this trigger will match all transactions
|
||||
* For example: amount > 0 or description starts with ''
|
||||
* @return bool
|
||||
*/
|
||||
public function matchesAnything() { return false; }
|
||||
}
|
||||
|
@ -62,4 +62,13 @@ class AmountMore implements TriggerInterface
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether this trigger will match all transactions
|
||||
* This happens when the trigger_value is zero
|
||||
* @return bool
|
||||
*/
|
||||
public function matchesAnything() {
|
||||
return bccomp('0', $this->trigger->trigger_value) === 0;
|
||||
}
|
||||
}
|
||||
|
@ -63,4 +63,13 @@ class DescriptionContains implements TriggerInterface
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether this trigger will match all transactions
|
||||
* This happens when the trigger_value is empty
|
||||
* @return bool
|
||||
*/
|
||||
public function matchesAnything() {
|
||||
return $this->trigger->trigger_value === "";
|
||||
}
|
||||
}
|
||||
|
@ -72,4 +72,14 @@ class DescriptionEnds implements TriggerInterface
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether this trigger will match all transactions
|
||||
* This happens when the trigger_value is empty
|
||||
* @return bool
|
||||
*/
|
||||
public function matchesAnything() {
|
||||
return $this->trigger->trigger_value === "";
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -58,4 +58,11 @@ class DescriptionIs implements TriggerInterface
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether this trigger will match all transactions
|
||||
* @return bool
|
||||
*/
|
||||
public function matchesAnything() { return false; }
|
||||
|
||||
}
|
||||
|
@ -60,4 +60,14 @@ class DescriptionStarts implements TriggerInterface
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether this trigger will match all transactions
|
||||
* This happens when the trigger_value is empty
|
||||
* @return bool
|
||||
*/
|
||||
public function matchesAnything() {
|
||||
return $this->trigger->trigger_value === "";
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -62,4 +62,14 @@ class FromAccountContains implements TriggerInterface
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether this trigger will match all transactions
|
||||
* This happens when the trigger_value is empty
|
||||
* @return bool
|
||||
*/
|
||||
public function matchesAnything() {
|
||||
return $this->trigger->trigger_value === "";
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -72,4 +72,15 @@ class FromAccountEnds implements TriggerInterface
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Checks whether this trigger will match all transactions
|
||||
* This happens when the trigger_value is empty
|
||||
* @return bool
|
||||
*/
|
||||
public function matchesAnything() {
|
||||
return $this->trigger->trigger_value === "";
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -58,4 +58,11 @@ class FromAccountIs implements TriggerInterface
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether this trigger will match all transactions
|
||||
* @return bool
|
||||
*/
|
||||
public function matchesAnything() { return false; }
|
||||
|
||||
}
|
||||
|
@ -60,4 +60,15 @@ class FromAccountStarts implements TriggerInterface
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Checks whether this trigger will match all transactions
|
||||
* This happens when the trigger_value is empty
|
||||
* @return bool
|
||||
*/
|
||||
public function matchesAnything() {
|
||||
return $this->trigger->trigger_value === "";
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -62,4 +62,15 @@ class ToAccountContains implements TriggerInterface
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Checks whether this trigger will match all transactions
|
||||
* This happens when the trigger_value is empty
|
||||
* @return bool
|
||||
*/
|
||||
public function matchesAnything() {
|
||||
return $this->trigger->trigger_value === "";
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -72,4 +72,14 @@ class ToAccountEnds implements TriggerInterface
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Checks whether this trigger will match all transactions
|
||||
* This happens when the trigger_value is empty
|
||||
* @return bool
|
||||
*/
|
||||
public function matchesAnything() {
|
||||
return $this->trigger->trigger_value === "";
|
||||
}
|
||||
}
|
||||
|
@ -58,4 +58,11 @@ class ToAccountIs implements TriggerInterface
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether this trigger will match all transactions
|
||||
* @return bool
|
||||
*/
|
||||
public function matchesAnything() { return false; }
|
||||
|
||||
}
|
||||
|
@ -60,4 +60,15 @@ class ToAccountStarts implements TriggerInterface
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Checks whether this trigger will match all transactions
|
||||
* This happens when the trigger_value is empty
|
||||
* @return bool
|
||||
*/
|
||||
public function matchesAnything() {
|
||||
return $this->trigger->trigger_value === "";
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -57,4 +57,11 @@ class TransactionType implements TriggerInterface
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether this trigger will match all transactions
|
||||
* @return bool
|
||||
*/
|
||||
public function matchesAnything() { return false; }
|
||||
|
||||
}
|
||||
|
@ -32,4 +32,11 @@ interface TriggerInterface
|
||||
* @return bool
|
||||
*/
|
||||
public function triggered();
|
||||
|
||||
/**
|
||||
* Checks whether this trigger will match all transactions
|
||||
* For example: amount > 0 or description starts with ''
|
||||
* @return bool
|
||||
*/
|
||||
public function matchesAnything();
|
||||
}
|
||||
|
@ -53,4 +53,10 @@ class UserAction implements TriggerInterface
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether this trigger will match all transactions
|
||||
* @return bool
|
||||
*/
|
||||
public function matchesAnything() { return true; }
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user