mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Better description for matchesAnything
This commit is contained in:
@@ -64,8 +64,9 @@ class AmountExactly implements TriggerInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks whether this trigger will match all transactions
|
* @{inheritdoc}
|
||||||
* For example: amount > 0 or description starts with ''
|
*
|
||||||
|
* @see TriggerInterface::matchesAnything
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -64,8 +64,9 @@ class AmountLess implements TriggerInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks whether this trigger will match all transactions
|
* @{inheritdoc}
|
||||||
* For example: amount > 0 or description starts with ''
|
*
|
||||||
|
* @see TriggerInterface::matchesAnything
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -64,8 +64,9 @@ class AmountMore implements TriggerInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks whether this trigger will match all transactions
|
* @{inheritdoc}
|
||||||
* This happens when the trigger_value is zero
|
*
|
||||||
|
* @see TriggerInterface::matchesAnything
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -65,8 +65,9 @@ class DescriptionContains implements TriggerInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks whether this trigger will match all transactions
|
* @{inheritdoc}
|
||||||
* This happens when the trigger_value is empty
|
*
|
||||||
|
* @see TriggerInterface::matchesAnything
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -74,8 +74,9 @@ class DescriptionEnds implements TriggerInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks whether this trigger will match all transactions
|
* @{inheritdoc}
|
||||||
* This happens when the trigger_value is empty
|
*
|
||||||
|
* @see TriggerInterface::matchesAnything
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -60,7 +60,9 @@ class DescriptionIs implements TriggerInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks whether this trigger will match all transactions
|
* @{inheritdoc}
|
||||||
|
*
|
||||||
|
* @see TriggerInterface::matchesAnything
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -21,12 +21,10 @@ use Log;
|
|||||||
*/
|
*/
|
||||||
class DescriptionStarts implements TriggerInterface
|
class DescriptionStarts implements TriggerInterface
|
||||||
{
|
{
|
||||||
/** @var RuleTrigger */
|
|
||||||
protected $trigger;
|
|
||||||
|
|
||||||
/** @var TransactionJournal */
|
/** @var TransactionJournal */
|
||||||
protected $journal;
|
protected $journal;
|
||||||
|
/** @var RuleTrigger */
|
||||||
|
protected $trigger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TriggerInterface constructor.
|
* TriggerInterface constructor.
|
||||||
@@ -40,6 +38,18 @@ class DescriptionStarts implements TriggerInterface
|
|||||||
$this->journal = $journal;
|
$this->journal = $journal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @{inheritdoc}
|
||||||
|
*
|
||||||
|
* @see TriggerInterface::matchesAnything
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function matchesAnything()
|
||||||
|
{
|
||||||
|
return $this->trigger->trigger_value === "";
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
@@ -61,15 +71,4 @@ class DescriptionStarts implements TriggerInterface
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 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 === "";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,8 +64,9 @@ class FromAccountContains implements TriggerInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks whether this trigger will match all transactions
|
* @{inheritdoc}
|
||||||
* This happens when the trigger_value is empty
|
*
|
||||||
|
* @see TriggerInterface::matchesAnything
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -75,8 +75,9 @@ class FromAccountEnds implements TriggerInterface
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks whether this trigger will match all transactions
|
* @{inheritdoc}
|
||||||
* This happens when the trigger_value is empty
|
*
|
||||||
|
* @see TriggerInterface::matchesAnything
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -60,7 +60,9 @@ class FromAccountIs implements TriggerInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks whether this trigger will match all transactions
|
* @{inheritdoc}
|
||||||
|
*
|
||||||
|
* @see TriggerInterface::matchesAnything
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -63,8 +63,9 @@ class FromAccountStarts implements TriggerInterface
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks whether this trigger will match all transactions
|
* @{inheritdoc}
|
||||||
* This happens when the trigger_value is empty
|
*
|
||||||
|
* @see TriggerInterface::matchesAnything
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -65,8 +65,9 @@ class ToAccountContains implements TriggerInterface
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks whether this trigger will match all transactions
|
* @{inheritdoc}
|
||||||
* This happens when the trigger_value is empty
|
*
|
||||||
|
* @see TriggerInterface::matchesAnything
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -75,8 +75,9 @@ class ToAccountEnds implements TriggerInterface
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks whether this trigger will match all transactions
|
* @{inheritdoc}
|
||||||
* This happens when the trigger_value is empty
|
*
|
||||||
|
* @see TriggerInterface::matchesAnything
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -60,7 +60,9 @@ class ToAccountIs implements TriggerInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks whether this trigger will match all transactions
|
* @{inheritdoc}
|
||||||
|
*
|
||||||
|
* @see TriggerInterface::matchesAnything
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -63,8 +63,9 @@ class ToAccountStarts implements TriggerInterface
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks whether this trigger will match all transactions
|
* @{inheritdoc}
|
||||||
* This happens when the trigger_value is empty
|
*
|
||||||
|
* @see TriggerInterface::matchesAnything
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -59,7 +59,9 @@ class TransactionType implements TriggerInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks whether this trigger will match all transactions
|
* @{inheritdoc}
|
||||||
|
*
|
||||||
|
* @see TriggerInterface::matchesAnything
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ class TriggerFactory
|
|||||||
abort(500, 'No such trigger exists ("' . $triggerType . '").');
|
abort(500, 'No such trigger exists ("' . $triggerType . '").');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @var TriggerInterface $class */
|
||||||
$class = $triggerTypes[$triggerType];
|
$class = $triggerTypes[$triggerType];
|
||||||
if (!class_exists($class)) {
|
if (!class_exists($class)) {
|
||||||
abort(500, 'Could not instantiate class for rule trigger type "' . $triggerType . '" (' . $class . ').');
|
abort(500, 'Could not instantiate class for rule trigger type "' . $triggerType . '" (' . $class . ').');
|
||||||
|
|||||||
@@ -29,8 +29,16 @@ interface TriggerInterface
|
|||||||
public function __construct(RuleTrigger $trigger, TransactionJournal $journal);
|
public function __construct(RuleTrigger $trigger, TransactionJournal $journal);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks whether this trigger will match all transactions
|
* A trigger is said to "match anything", or match any given transaction,
|
||||||
* For example: amount > 0 or description starts with ''
|
* when the trigger value is very vague or has no restrictions. Easy examples
|
||||||
|
* are the "AmountMore"-trigger combined with an amount of 0: any given transaction
|
||||||
|
* has an amount of more than zero! Other examples are all the "Description"-triggers
|
||||||
|
* which have hard time handling empty trigger values such as "" or "*" (wild cards).
|
||||||
|
*
|
||||||
|
* If the user tries to create such a trigger, this method MUST return true so Firefly III
|
||||||
|
* can stop the storing / updating the trigger. If the trigger is in any way restrictive
|
||||||
|
* (even if it will still include 99.9% of the users transactions), this method MUST return
|
||||||
|
* false.
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -54,7 +54,9 @@ class UserAction implements TriggerInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks whether this trigger will match all transactions
|
* @{inheritdoc}
|
||||||
|
*
|
||||||
|
* @see TriggerInterface::matchesAnything
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user