mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-01-23 23:13:18 -06:00
Basic logging for willMatchEverything #322
This commit is contained in:
parent
d221ea68d0
commit
a31b4ccf01
@ -8,14 +8,13 @@ declare(strict_types = 1);
|
||||
* of the MIT license. See the LICENSE file for details.
|
||||
*/
|
||||
|
||||
declare(strict_types = 1);
|
||||
|
||||
namespace FireflyIII\Rules\Factory;
|
||||
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Models\RuleAction;
|
||||
use FireflyIII\Rules\Actions\ActionInterface;
|
||||
use FireflyIII\Support\Domain;
|
||||
use Log;
|
||||
|
||||
/**
|
||||
* Interface ActionInterface
|
||||
@ -39,6 +38,7 @@ class ActionFactory
|
||||
public static function getAction(RuleAction $action): ActionInterface
|
||||
{
|
||||
$class = self::getActionClass($action->action_type);
|
||||
Log::debug(sprintf('self::getActionClass("%s") = "%s"', $action->action_type, $class));
|
||||
|
||||
return new $class($action);
|
||||
}
|
||||
|
@ -46,6 +46,9 @@ class TriggerFactory
|
||||
$class = self::getTriggerClass($triggerType);
|
||||
$obj = $class::makeFromTriggerValue($trigger->trigger_value);
|
||||
|
||||
Log::debug(sprintf('self::getTriggerClass("%s") = "%s"', $triggerType, $class));
|
||||
Log::debug(sprintf('%s::makeFromTriggerValue(%s) = object of class "%s"', $class, $trigger->trigger_value, get_class($obj)));
|
||||
|
||||
return $obj;
|
||||
}
|
||||
|
||||
|
@ -13,6 +13,7 @@ namespace FireflyIII\Rules\Triggers;
|
||||
|
||||
|
||||
use FireflyIII\Models\TransactionJournal;
|
||||
use Log;
|
||||
|
||||
/**
|
||||
* Class AmountExactly
|
||||
@ -43,6 +44,7 @@ final class AmountExactly extends AbstractTrigger implements TriggerInterface
|
||||
if (!is_null($value)) {
|
||||
return false;
|
||||
}
|
||||
Log::error(sprintf('Cannot use %s with a null value.', self::class));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -13,6 +13,7 @@ namespace FireflyIII\Rules\Triggers;
|
||||
|
||||
|
||||
use FireflyIII\Models\TransactionJournal;
|
||||
use Log;
|
||||
|
||||
/**
|
||||
* Class AmountLess
|
||||
@ -43,6 +44,7 @@ final class AmountLess extends AbstractTrigger implements TriggerInterface
|
||||
if (!is_null($value)) {
|
||||
return false;
|
||||
}
|
||||
Log::error(sprintf('Cannot use %s with a null value.', self::class));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -13,6 +13,7 @@ namespace FireflyIII\Rules\Triggers;
|
||||
|
||||
|
||||
use FireflyIII\Models\TransactionJournal;
|
||||
use Log;
|
||||
|
||||
/**
|
||||
* Class AmountMore
|
||||
@ -41,9 +42,16 @@ final class AmountMore extends AbstractTrigger implements TriggerInterface
|
||||
public static function willMatchEverything($value = null)
|
||||
{
|
||||
if (!is_null($value)) {
|
||||
return bccomp('0', strval($value)) === 0;
|
||||
$res = bccomp('0', strval($value)) === 0;
|
||||
if ($res === true) {
|
||||
Log::error(sprintf('Cannot use %s with a value equal to 0.', self::class));
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
Log::error(sprintf('Cannot use %s with a null value.', self::class));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -13,6 +13,7 @@ namespace FireflyIII\Rules\Triggers;
|
||||
|
||||
|
||||
use FireflyIII\Models\TransactionJournal;
|
||||
use Log;
|
||||
|
||||
/**
|
||||
* Class DescriptionContains
|
||||
@ -41,9 +42,16 @@ final class DescriptionContains extends AbstractTrigger implements TriggerInterf
|
||||
public static function willMatchEverything($value = null)
|
||||
{
|
||||
if (!is_null($value)) {
|
||||
return strval($value) === '';
|
||||
$res = strval($value) === '';
|
||||
if ($res === true) {
|
||||
Log::error(sprintf('Cannot use %s with "" as a value.', self::class));
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
Log::error(sprintf('Cannot use %s with a null value.', self::class));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -12,6 +12,7 @@ declare(strict_types = 1);
|
||||
namespace FireflyIII\Rules\Triggers;
|
||||
|
||||
use FireflyIII\Models\TransactionJournal;
|
||||
use Log;
|
||||
|
||||
/**
|
||||
* Class DescriptionEnds
|
||||
@ -40,9 +41,16 @@ final class DescriptionEnds extends AbstractTrigger implements TriggerInterface
|
||||
public static function willMatchEverything($value = null)
|
||||
{
|
||||
if (!is_null($value)) {
|
||||
return strval($value) === '';
|
||||
$res = strval($value) === '';
|
||||
if ($res === true) {
|
||||
Log::error(sprintf('Cannot use %s with "" as a value.', self::class));
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
Log::error(sprintf('Cannot use %s with a null value.', self::class));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -12,6 +12,7 @@ declare(strict_types = 1);
|
||||
namespace FireflyIII\Rules\Triggers;
|
||||
|
||||
use FireflyIII\Models\TransactionJournal;
|
||||
use Log;
|
||||
|
||||
/**
|
||||
* Class DescriptionIs
|
||||
@ -43,6 +44,8 @@ final class DescriptionIs extends AbstractTrigger implements TriggerInterface
|
||||
return false;
|
||||
}
|
||||
|
||||
Log::error(sprintf('Cannot use %s with a null value.', self::class));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -12,6 +12,7 @@ declare(strict_types = 1);
|
||||
namespace FireflyIII\Rules\Triggers;
|
||||
|
||||
use FireflyIII\Models\TransactionJournal;
|
||||
use Log;
|
||||
|
||||
/**
|
||||
* Class DescriptionStarts
|
||||
@ -40,9 +41,16 @@ final class DescriptionStarts extends AbstractTrigger implements TriggerInterfac
|
||||
public static function willMatchEverything($value = null)
|
||||
{
|
||||
if (!is_null($value)) {
|
||||
return strval($value) === '';
|
||||
$res = strval($value) === '';
|
||||
if ($res === true) {
|
||||
Log::error(sprintf('Cannot use %s with "" as a value.', self::class));
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
Log::error(sprintf('Cannot use %s with a null value.', self::class));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -13,6 +13,7 @@ namespace FireflyIII\Rules\Triggers;
|
||||
|
||||
use FireflyIII\Models\Account;
|
||||
use FireflyIII\Models\TransactionJournal;
|
||||
use Log;
|
||||
|
||||
/**
|
||||
* Class FromAccountContains
|
||||
@ -41,9 +42,15 @@ final class FromAccountContains extends AbstractTrigger implements TriggerInterf
|
||||
public static function willMatchEverything($value = null)
|
||||
{
|
||||
if (!is_null($value)) {
|
||||
return strval($value) === '';
|
||||
$res = strval($value) === '';
|
||||
if ($res === true) {
|
||||
Log::error(sprintf('Cannot use %s with "" as a value.', self::class));
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
Log::error(sprintf('Cannot use %s with a null value.', self::class));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -13,6 +13,7 @@ namespace FireflyIII\Rules\Triggers;
|
||||
|
||||
use FireflyIII\Models\Account;
|
||||
use FireflyIII\Models\TransactionJournal;
|
||||
use Log;
|
||||
|
||||
/**
|
||||
* Class FromAccountEnds
|
||||
@ -41,9 +42,15 @@ final class FromAccountEnds extends AbstractTrigger implements TriggerInterface
|
||||
public static function willMatchEverything($value = null)
|
||||
{
|
||||
if (!is_null($value)) {
|
||||
return strval($value) === '';
|
||||
$res = strval($value) === '';
|
||||
if ($res === true) {
|
||||
Log::error(sprintf('Cannot use %s with "" as a value.', self::class));
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
Log::error(sprintf('Cannot use %s with a null value.', self::class));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -13,7 +13,7 @@ namespace FireflyIII\Rules\Triggers;
|
||||
|
||||
use FireflyIII\Models\Account;
|
||||
use FireflyIII\Models\TransactionJournal;
|
||||
|
||||
use Log;
|
||||
/**
|
||||
* Class FromAccountIs
|
||||
*
|
||||
@ -43,6 +43,7 @@ final class FromAccountIs extends AbstractTrigger implements TriggerInterface
|
||||
if (!is_null($value)) {
|
||||
return false;
|
||||
}
|
||||
Log::error(sprintf('Cannot use %s with a null value.', self::class));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -13,6 +13,7 @@ namespace FireflyIII\Rules\Triggers;
|
||||
|
||||
use FireflyIII\Models\Account;
|
||||
use FireflyIII\Models\TransactionJournal;
|
||||
use Log;
|
||||
|
||||
/**
|
||||
* Class FromAccountStarts
|
||||
@ -41,9 +42,15 @@ final class FromAccountStarts extends AbstractTrigger implements TriggerInterfac
|
||||
public static function willMatchEverything($value = null)
|
||||
{
|
||||
if (!is_null($value)) {
|
||||
return strval($value) === '';
|
||||
$res = strval($value) === '';
|
||||
if ($res === true) {
|
||||
Log::error(sprintf('Cannot use %s with "" as a value.', self::class));
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
Log::error(sprintf('Cannot use %s with a null value.', self::class));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -13,6 +13,7 @@ namespace FireflyIII\Rules\Triggers;
|
||||
|
||||
use FireflyIII\Models\Account;
|
||||
use FireflyIII\Models\TransactionJournal;
|
||||
use Log;
|
||||
|
||||
/**
|
||||
* Class ToAccountContains
|
||||
@ -41,9 +42,15 @@ final class ToAccountContains extends AbstractTrigger implements TriggerInterfac
|
||||
public static function willMatchEverything($value = null)
|
||||
{
|
||||
if (!is_null($value)) {
|
||||
return strval($value) === '';
|
||||
$res = strval($value) === '';
|
||||
if ($res === true) {
|
||||
Log::error(sprintf('Cannot use %s with "" as a value.', self::class));
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
Log::error(sprintf('Cannot use %s with a null value.', self::class));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -13,6 +13,7 @@ namespace FireflyIII\Rules\Triggers;
|
||||
|
||||
use FireflyIII\Models\Account;
|
||||
use FireflyIII\Models\TransactionJournal;
|
||||
use Log;
|
||||
|
||||
/**
|
||||
* Class ToAccountEnds
|
||||
@ -41,9 +42,15 @@ final class ToAccountEnds extends AbstractTrigger implements TriggerInterface
|
||||
public static function willMatchEverything($value = null)
|
||||
{
|
||||
if (!is_null($value)) {
|
||||
return strval($value) === '';
|
||||
$res = strval($value) === '';
|
||||
if ($res === true) {
|
||||
Log::error(sprintf('Cannot use %s with "" as a value.', self::class));
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
Log::error(sprintf('Cannot use %s with a null value.', self::class));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -13,6 +13,7 @@ namespace FireflyIII\Rules\Triggers;
|
||||
|
||||
use FireflyIII\Models\Account;
|
||||
use FireflyIII\Models\TransactionJournal;
|
||||
use Log;
|
||||
|
||||
/**
|
||||
* Class ToAccountIs
|
||||
@ -41,9 +42,15 @@ final class ToAccountIs extends AbstractTrigger implements TriggerInterface
|
||||
public static function willMatchEverything($value = null)
|
||||
{
|
||||
if (!is_null($value)) {
|
||||
return false;
|
||||
$res = strval($value) === '';
|
||||
if ($res === true) {
|
||||
Log::error(sprintf('Cannot use %s with "" as a value.', self::class));
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
Log::error(sprintf('Cannot use %s with a null value.', self::class));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -13,6 +13,7 @@ namespace FireflyIII\Rules\Triggers;
|
||||
|
||||
use FireflyIII\Models\Account;
|
||||
use FireflyIII\Models\TransactionJournal;
|
||||
use Log;
|
||||
|
||||
/**
|
||||
* Class ToAccountStarts
|
||||
@ -41,9 +42,15 @@ final class ToAccountStarts extends AbstractTrigger implements TriggerInterface
|
||||
public static function willMatchEverything($value = null)
|
||||
{
|
||||
if (!is_null($value)) {
|
||||
return strval($value) === '';
|
||||
$res = strval($value) === '';
|
||||
if ($res === true) {
|
||||
Log::error(sprintf('Cannot use %s with "" as a value.', self::class));
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
Log::error(sprintf('Cannot use %s with a null value.', self::class));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -12,6 +12,7 @@ declare(strict_types = 1);
|
||||
namespace FireflyIII\Rules\Triggers;
|
||||
|
||||
use FireflyIII\Models\TransactionJournal;
|
||||
use Log;
|
||||
|
||||
/**
|
||||
* Class TransactionType
|
||||
@ -42,6 +43,7 @@ final class TransactionType extends AbstractTrigger implements TriggerInterface
|
||||
if (!is_null($value)) {
|
||||
return false;
|
||||
}
|
||||
Log::error(sprintf('Cannot use %s with a null value.', self::class));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user