Fix filters and other methods that used deprecated methods.

This commit is contained in:
James Cole
2016-05-20 08:09:53 +02:00
parent dda3082c7e
commit 70d936bb8f
10 changed files with 81 additions and 18 deletions

View File

@@ -10,6 +10,7 @@ declare(strict_types = 1);
namespace FireflyIII\Rules\Triggers;
use FireflyIII\Models\Account;
use FireflyIII\Models\TransactionJournal;
/**
@@ -52,9 +53,15 @@ final class ToAccountContains extends AbstractTrigger implements TriggerInterfac
*/
public function triggered(TransactionJournal $journal): bool
{
$toAccountName = strtolower($journal->destination_account_name ?? TransactionJournal::destinationAccount($journal)->name);
$search = strtolower($this->triggerValue);
$strpos = strpos($toAccountName, $search);
$toAccountName = '';
/** @var Account $account */
foreach (TransactionJournal::destinationAccountList($journal) as $account) {
$toAccountName .= strtolower($account->name);
}
$search = strtolower($this->triggerValue);
$strpos = strpos($toAccountName, $search);
if (!($strpos === false)) {
return true;